Uploaded image for project: 'Commons IO'
  1. Commons IO
  2. IO-163

FileUtils.toURLs() uses deprecated (and bad) method of conversion to URL

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.4
    • Fix Version/s: 2.0
    • Component/s: Utilities
    • Labels:
      None

      Description

      The method FileUtils.toURLs() uses the following method to convert from File to URL:
      File.toURL();

      This method has scary warnings that it's a bad way to do the conversion because characters will not be escaped as required in URL strings. In Java 1.6, this method has actually been deprecated. All recent JDK versions recommend instead using:
      File.toURI().toURL();

      as the URI code will properly perform the escaping.

        Attachments

          Activity

            People

            • Assignee:
              niallp Niall Pemberton
              Reporter:
              puredanger Alex Miller
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: