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

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

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 6
    • Fix Version/s: None
    • Component/s: client-libs
    • Subcomponent:
    • Understanding:
      Cause Known
    • CPU:
      x86
    • OS:
      windows_xp

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Imported:
                  Indexed: