File,URI,URL conversions are strange for UNC path

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P3
    • 6
    • Affects Version/s: 5.0u1
    • Component/s: 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)

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

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: