You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by rh...@apache.org on 2011/08/03 15:15:57 UTC
svn commit: r1153474 - in /db/derby/code/trunk/java:
engine/org/apache/derby/impl/services/reflect/
testing/org/apache/derbyTesting/functionTests/tests/lang/
Author: rhillegas
Date: Wed Aug 3 13:15:56 2011
New Revision: 1153474
URL: http://svn.apache.org/viewvc?rev=1153474&view=rev
Log:
DERBY-5352: Commit Brett Bergquist's patch to include org.apache.derby.vti classes in the database jar loader.
Modified:
db/derby/code/trunk/java/engine/org/apache/derby/impl/services/reflect/JarLoader.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/DatabaseClassLoadingTest.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/dummy_vti.jar
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/services/reflect/JarLoader.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/services/reflect/JarLoader.java?rev=1153474&r1=1153473&r2=1153474&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/services/reflect/JarLoader.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/services/reflect/JarLoader.java Wed Aug 3 13:15:56 2011
@@ -175,7 +175,8 @@ final class JarLoader extends SecureClas
// not make assumptions about this check reducing the
// number of classes it has to check for.
if (className.startsWith("org.apache.derby.")
- && !className.startsWith("org.apache.derby.jdbc."))
+ && !className.startsWith("org.apache.derby.jdbc.")
+ && !className.startsWith("org.apache.derby.vti."))
{
ClassNotFoundException cnfe = new ClassNotFoundException(className);
//cnfe.printStackTrace(System.out);
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/DatabaseClassLoadingTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/DatabaseClassLoadingTest.java?rev=1153474&r1=1153473&r2=1153474&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/DatabaseClassLoadingTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/DatabaseClassLoadingTest.java Wed Aug 3 13:15:56 2011
@@ -108,6 +108,7 @@ public class DatabaseClassLoadingTest ex
"testLoadDerbyClassIndirectly",
"testIndirectLoading",
"testTableFunctionInJar",
+ "test_5352",
};
for (int i = 0; i < orderedTests.length; i++)
@@ -1044,7 +1045,7 @@ public class DatabaseClassLoadingTest ex
"language java\n" +
"parameter style DERBY_JDBC_RESULT_SET\n" +
"reads sql data\n" +
- "external name 'DummyVTI2.dummyVTI'\n"
+ "external name 'MissingClass.dummyVTI'\n"
);
// invoke the scalar function
@@ -1078,7 +1079,63 @@ public class DatabaseClassLoadingTest ex
} catch (SQLException e) {
assertSQLState("XJ001", e);
}
+
+ // drop the useless function
+ s.executeUpdate( "drop function dummyVTI2\n" );
+
+ setDBClasspath(null);
+
+ s.close();
+ }
+
+ /**
+ * Test that restricted table functions can be invoked from inside jar files stored in
+ * the database.
+ */
+ public void test_5352() throws SQLException, MalformedURLException
+ {
+ // skip this test if vm is pre Java 5. This is because the jar file was
+ // compiled by a modern compiler and the jar file won't load on
+ // old vms.
+ if ( JVMInfo.J2ME || (JVMInfo.JDK_ID < JVMInfo.J2SE_15 ) ) { return; }
+
+ String jarName = "EMC.DUMMY_VTI2";
+
+ installJar("dummy_vti.jar", jarName );
+
+ setDBClasspath( jarName );
+
+ Statement s = createStatement();
+
+ // register the table function
+ s.executeUpdate
+ (
+ "create function dummyVTI2( allowsRestriction boolean )\n" +
+ "returns table( a int )\n" +
+ "language java\n" +
+ "parameter style DERBY_JDBC_RESULT_SET\n" +
+ "no sql\n" +
+ "external name 'DummyVTI2.dummyVTI2'\n"
+ );
+ // invoke the table function
+ JDBC.assertFullResultSet
+ (
+ s.executeQuery
+ (
+ "select * from table( dummyVTI2( true ) ) s where a = 1"
+ ),
+ new String[][]
+ {
+ { "1" }
+ }
+ );
+
+ // verify that the RestrictedVTI machinery is really invoked
+ assertStatementError( "XYZZY", s, "select * from table( dummyVTI2( false ) ) s where a = 1" );
+
+ s.executeUpdate( "drop function dummyVTI2\n" );
+
setDBClasspath(null);
s.close();
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/dummy_vti.jar
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/dummy_vti.jar?rev=1153474&r1=1153473&r2=1153474&view=diff
==============================================================================
Binary files - no diff available.