Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-5086147

File,URI,URL conversions are strange for UNC path

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 6
    • 5.0u1
    • core-libs
    • beta
    • x86
    • windows_2000

        See:
        Exception in thread "main" java.lang.IllegalArgumentException: URI has an authority component
        at java.io.File.<init>(File.java:340)

        caused by code:

        File f = new File ("//SERVER/MyDocuments/USER/DIR/");
        new File (f.toURI().toURL().toURI()); /* file://SERVER/MyDocuments/USER/DIR */


        but following code is OK:
        new File (f.toURI()); /* file:////SERVER/MyDocuments/USER/DIR */

        Its fragile, not mentioning that URI.normalize () complicates it even more (file:/SERVER/MyDocuments/USER/DIR)

              yuwangsunw Yujiang Wang (Inactive)
              rmatous Radek Matouš
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: