提交 3af36997 编写于 作者: R rupashka

6997102: Test case has hard code, so that applet thread threw exception

Reviewed-by: alexp
上级 c3a60e21
<html>
<body>
<applet code="bug6798062.class" width=400 height=300></applet>
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
......
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册