diff --git a/test/javax/swing/JFileChooser/6798062/bug6798062.html b/test/javax/swing/JFileChooser/6798062/bug6798062.html index 12955f6eee722d6892e1bdc337140d5c3e5746ee..80a3e1c503d80a6a7c58d1d1db8194b0f79692ee 100644 --- a/test/javax/swing/JFileChooser/6798062/bug6798062.html +++ b/test/javax/swing/JFileChooser/6798062/bug6798062.html @@ -1,6 +1,8 @@
+The test is suitable only for Windows + 1. Create a link 2. Copy path to the link into TextField 3. Run the Windows Task Manager. Select the Processes tab and find the java process diff --git a/test/javax/swing/JFileChooser/6798062/bug6798062.java b/test/javax/swing/JFileChooser/6798062/bug6798062.java index 44d59dc82783bb3780031a3e7edb0fc83df8b266..45df0b643de68bd3964c9f03013257ca0940c257 100644 --- a/test/javax/swing/JFileChooser/6798062/bug6798062.java +++ b/test/javax/swing/JFileChooser/6798062/bug6798062.java @@ -28,6 +28,7 @@ @run applet/manual=done bug6798062.html */ +import sun.awt.OSInfo; import sun.awt.shell.ShellFolder; import javax.swing.*; @@ -68,13 +69,23 @@ public class bug6798062 extends JApplet { add(initialize()); } - private JPanel initialize() { - File file = new File("c:/"); + private JComponent initialize() { + if (OSInfo.getOSType() != OSInfo.OSType.WINDOWS) { + return new JLabel("The test is suitable only for Windows"); + } + + String tempDir = System.getProperty("java.io.tmpdir"); + + if (tempDir.length() == 0) { // 'java.io.tmpdir' isn't guaranteed to be defined + tempDir = System.getProperty("user.home"); + } + + System.out.println("Temp directory: " + tempDir); try { - folder = ShellFolder.getShellFolder(file); + folder = ShellFolder.getShellFolder(new File(tempDir)); } catch (FileNotFoundException e) { - fail("Directory " + file.getPath() + " not found"); + fail("Directory " + tempDir + " not found"); } slider.setMajorTickSpacing(10);