6972495: javax/imageio/CachePremissionsTest/CachePermissionsTest.java failed
authorbae
Tue, 07 Sep 2010 16:54:39 +0400
changeset 6481 78d56f33c3a7
parent 6325 adf468d05745
child 6482 0f6a4442b29e
6972495: javax/imageio/CachePremissionsTest/CachePermissionsTest.java failed Reviewed-by: prr
jdk/test/javax/imageio/CachePremissionsTest/CachePermissionsTest.java
--- a/jdk/test/javax/imageio/CachePremissionsTest/CachePermissionsTest.java	Sun Aug 29 22:41:28 2010 -0700
+++ b/jdk/test/javax/imageio/CachePremissionsTest/CachePermissionsTest.java	Tue Sep 07 16:54:39 2010 +0400
@@ -50,9 +50,9 @@
  *           -Djava.security.debug=access can be used to verify file permissions.
  *
  * @run     main CachePermissionsTest true
- * @run     main/othervm/policy=w.policy CachePermissionsTest false
- * @run     main/othervm/policy=rw.policy CachePermissionsTest false
- * @run     main/othervm/policy=rwd.policy CachePermissionsTest true
+ * @run     main/othervm CachePermissionsTest false w.policy
+ * @run     main/othervm CachePermissionsTest false rw.policy
+ * @run     main/othervm CachePermissionsTest true rwd.policy
  */
 
 import java.io.File;
@@ -73,6 +73,17 @@
 
         System.out.println("java.io.tmpdir is " + System.getProperty("java.io.tmpdir"));
 
+        if (args.length > 1) {
+            String testsrc = System.getProperty("test.src", ".");
+            String policy = testsrc + File.separator + args[1];
+
+            System.out.println("Policy file: " + policy);
+            System.setProperty("java.security.policy", policy);
+
+            System.out.println("Install security manager...");
+            System.setSecurityManager(new SecurityManager());
+        }
+
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
 
         try {