6962725: Regtest javax/swing/JFileChooser/6738668/bug6738668.java fails under Linux
authorpsadhukhan
Tue, 06 Jun 2017 10:58:02 +0530
changeset 47133 d9673218a1aa
parent 47132 0d03b6efffd3
child 47134 bb00cc237908
6962725: Regtest javax/swing/JFileChooser/6738668/bug6738668.java fails under Linux Reviewed-by: serb
jdk/test/javax/swing/JFileChooser/6738668/bug6738668.java
jdk/test/javax/swing/JFileChooser/6738668/security.policy
--- a/jdk/test/javax/swing/JFileChooser/6738668/bug6738668.java	Fri Jun 02 14:45:30 2017 -0700
+++ b/jdk/test/javax/swing/JFileChooser/6738668/bug6738668.java	Tue Jun 06 10:58:02 2017 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009,2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,21 +22,25 @@
  */
 
 /* @test
-   @bug 6738668
+   @bug 6738668 6962725
    @summary JFileChooser cannot be created under SecurityManager
    @author Pavel Porvatov
    @run main/othervm/policy=security.policy bug6738668
 */
 
-import javax.swing.*;
 import java.io.File;
+import javax.swing.JFileChooser;
+import javax.swing.UIManager;
 
 public class bug6738668 {
     public static void main(String[] args) throws Exception {
         for (UIManager.LookAndFeelInfo lookAndFeelInfo : UIManager.getInstalledLookAndFeels()) {
             UIManager.setLookAndFeel(lookAndFeelInfo.getClassName());
 
-            new JFileChooser(new File("c:/temp"));
+            String tmpdir = System.getProperty("java.io.tmpdir");
+            System.out.println("tmp dir " + tmpdir);
+            new JFileChooser(new File(tmpdir+"/temp"));
+
 
             System.out.println("Test passed for LookAndFeel " + lookAndFeelInfo.getClassName());
         }
--- a/jdk/test/javax/swing/JFileChooser/6738668/security.policy	Fri Jun 02 14:45:30 2017 -0700
+++ b/jdk/test/javax/swing/JFileChooser/6738668/security.policy	Tue Jun 06 10:58:02 2017 +0530
@@ -1,5 +1,5 @@
 grant {
-    permission java.io.FilePermission "C:\\temp\\*", "read";
-    permission java.io.FilePermission "C:\\temp", "read";
+    permission java.io.FilePermission "${java.io.tmpdir}${/}temp${/}*", "read";
+    permission java.io.FilePermission "${java.io.tmpdir}${/}temp", "read";
     permission java.util.PropertyPermission "*", "read";
 };