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

all Desktop methods (browse, open etc.) only accept canonical path

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • 6
    • client-libs
    • Cause Known
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      java version "1.6.0-rc"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-rc-b70)
      Java HotSpot(TM) Client VM (build 1.6.0-rc-b70, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      All methods of java.awt.Desktop only work if
      path are canonical (at least on windows).



      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      run the test case

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      open an explorer on the current directory.
      ACTUAL -
      an IOException (see below)

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Exception in thread "main" java.io.IOException: Failed to open file:/C:/java/workspace/java-patch/./. Error message: Le chemin d'accès spécifié est introuvable.

      at sun.awt.windows.WDesktopPeer.ShellExecute(WDesktopPeer.java:59)
      at sun.awt.windows.WDesktopPeer.browse(WDesktopPeer.java:52)
      at java.awt.Desktop.browse(Desktop.java:348)
      at DesktopBug.main(DesktopBug.java:11)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.Desktop;
      import java.io.File;
      import java.io.IOException;
      import java.net.URI;

      public class DesktopBug {
         public static void main(String[] args) throws IOException {
          Desktop desktop=Desktop.getDesktop();
          URI uri=new File(".").toURI();
          //URI uri=new File(".").getCanonicalFile().toURI(); // works
          desktop.browse(uri);
        }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      use getCanonical() before transform the Fil to an URI.

            denis Denis Fokin (Inactive)
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: