changeset 17694:d23d309ef85a

6962725: Regtest javax/swing/JFileChooser/6738668/bug6738668.java fails under Linux Reviewed-by: serb
author psadhukhan
date Tue, 06 Jun 2017 10:58:02 +0530
parents 13f281a646ec
children 7d3e0c5b5e25
files test/javax/swing/JFileChooser/6738668/bug6738668.java test/javax/swing/JFileChooser/6738668/security.policy
diffstat 2 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/test/javax/swing/JFileChooser/6738668/bug6738668.java	Fri Jun 02 14:45:30 2017 -0700
+++ b/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/test/javax/swing/JFileChooser/6738668/security.policy	Fri Jun 02 14:45:30 2017 -0700
+++ b/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";
 };