db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r1626806 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/services/reflect/ReflectClassesJava2.java testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
Date Mon, 22 Sep 2014 15:16:24 GMT
Author: rhillegas
Date: Mon Sep 22 15:16:24 2014
New Revision: 1626806

URL: http://svn.apache.org/r1626806
Log:
DERBY-6654: Require that generated code live in the org.apache.derby.exe package; commit derby-6654-01-aa-requireCorrectPackage.diff.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/services/reflect/ReflectClassesJava2.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/services/reflect/ReflectClassesJava2.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/services/reflect/ReflectClassesJava2.java?rev=1626806&r1=1626805&r2=1626806&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/services/reflect/ReflectClassesJava2.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/services/reflect/ReflectClassesJava2.java
Mon Sep 22 15:16:24 2014
@@ -20,10 +20,12 @@
  */
 
 package org.apache.derby.impl.services.reflect;
+
+import org.apache.derby.iapi.sql.compile.CodeGeneration;
 import org.apache.derby.iapi.util.ByteArray;
 
 /**
-	Relfect loader with Privileged block for Java 2 security. 
+	Reflect loader with Privileged block for Java 2 security. 
 */
 
 public class ReflectClassesJava2 extends DatabaseClasses
@@ -58,6 +60,20 @@ public class ReflectClassesJava2 extends
 			}
 		}
 
+        // Generated class. Make sure that it lives in the org.apache.derby.exe package
+        int     lastDot = fullyQualifiedName.lastIndexOf( "." );
+        String  actualPackage;
+        if ( lastDot < 0 ) { actualPackage = ""; }
+        else
+        {
+            actualPackage = fullyQualifiedName.substring( 0, lastDot + 1 );
+        }
+
+        if ( !CodeGeneration.GENERATED_PACKAGE_PREFIX.equals( actualPackage ) )
+        {
+            throw new IllegalArgumentException( fullyQualifiedName );
+        }
+        
 		action = 1;
 		return ((ReflectLoaderJava2) java.security.AccessController.doPrivileged(this)).loadGeneratedClass(fullyQualifiedName,
classDump);
 	}

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java?rev=1626806&r1=1626805&r2=1626806&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/_Suite.java
Mon Sep 22 15:16:24 2014
@@ -260,6 +260,7 @@ public class _Suite extends BaseTestCase
         suite.addTest(ConsistencyCheckerTest.suite());
         suite.addTest(Derby5866TriggerOrderTest.suite());
         suite.addTest(NoDBInternalsPermissionTest.suite());
+        suite.addTest(ClassLoadingTest.suite());
         return suite;
 	}
 }



Mime
View raw message