You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@velocity.apache.org by he...@apache.org on 2007/01/09 22:45:21 UTC

svn commit: r494607 - /velocity/engine/trunk/src/test/org/apache/velocity/test/issues/VelTools66TestCase.java

Author: henning
Date: Tue Jan  9 13:45:20 2007
New Revision: 494607

URL: http://svn.apache.org/viewvc?view=rev&rev=494607
Log:
Under JDK 1.3.1 on Linux, we cannot access the TestObject when the security
manager is active. Shuffle an instance to the side in the C'tor so no one will
notice. Fixes VELOCITY-501, makes all test pass on Linux with JDK 1.3.1


Modified:
    velocity/engine/trunk/src/test/org/apache/velocity/test/issues/VelTools66TestCase.java

Modified: velocity/engine/trunk/src/test/org/apache/velocity/test/issues/VelTools66TestCase.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/test/org/apache/velocity/test/issues/VelTools66TestCase.java?view=diff&rev=494607&r1=494606&r2=494607
==============================================================================
--- velocity/engine/trunk/src/test/org/apache/velocity/test/issues/VelTools66TestCase.java (original)
+++ velocity/engine/trunk/src/test/org/apache/velocity/test/issues/VelTools66TestCase.java Tue Jan  9 13:45:20 2007
@@ -21,7 +21,9 @@
 
 import java.lang.reflect.Method;
 import java.security.AccessControlException;
+import java.security.AccessController;
 import java.security.Permission;
+import java.security.PrivilegedAction;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
@@ -108,6 +110,8 @@
     
     public static final class TestSecurityManager extends SecurityManager
     {
+        private final Class clazz = TestObject.class;
+
 	public TestSecurityManager()
 	{
 	    super();
@@ -117,7 +121,7 @@
         {
             System.out.println("checkMemberAccess(" + c.getName() + ", " + i + ")");
             
-            if (c.equals(TestObject.class))
+            if (c.equals(clazz))
             {
         	throw new AccessControlException("You are not allowed to access TestObject directly!");
             }