changeset 2692:d4012b86a6e9

6972495: javax/imageio/CachePremissionsTest/CachePermissionsTest.java failed Reviewed-by: prr
author bae
date Tue, 07 Sep 2010 16:54:39 +0400
parents 043d2736d44c
children fd7eb86ac690
files test/javax/imageio/CachePremissionsTest/CachePermissionsTest.java
diffstat 1 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/test/javax/imageio/CachePremissionsTest/CachePermissionsTest.java	Sun Aug 29 22:41:28 2010 -0700
+++ b/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 {