db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r1434363 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/sql/compile/AggregateNode.java testing/org/apache/derbyTesting/functionTests/tests/lang/UDAPermsTest.java
Date Wed, 16 Jan 2013 20:23:35 GMT
Author: rhillegas
Date: Wed Jan 16 20:23:34 2013
New Revision: 1434363

URL: http://svn.apache.org/viewvc?rev=1434363&view=rev
Log:
DERBY-6022: Fix NPE when resolving a function/aggregate name in a schema which hasn't been
created yet.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AggregateNode.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UDAPermsTest.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AggregateNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AggregateNode.java?rev=1434363&r1=1434362&r2=1434363&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AggregateNode.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/AggregateNode.java Wed
Jan 16 20:23:34 2013
@@ -454,6 +454,10 @@ public class AggregateNode extends Unary
         ( DataDictionary dd, SchemaDescriptor sd, String rawName )
         throws StandardException
     {
+        // if the schema has a null UUID, that means the schema has not
+        // been created yet. in that case, it doesn't have any aggregates in it.
+        if ( sd.getUUID() == null ) { return null; }
+        
 		java.util.List list = dd.getRoutineList
             ( sd.getUUID().toString(), rawName, AliasInfo.ALIAS_NAME_SPACE_AGGREGATE_AS_CHAR
);
 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UDAPermsTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UDAPermsTest.java?rev=1434363&r1=1434362&r2=1434363&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UDAPermsTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/UDAPermsTest.java
Wed Jan 16 20:23:34 2013
@@ -60,7 +60,10 @@ public class UDAPermsTest extends Genera
     private static  final   String      RUTH = "RUTH";
     private static  final   String      ALICE = "ALICE";
     private static  final   String      FRANK = "FRANK";
-    private static  final   String[]    LEGAL_USERS = { TEST_DBO, ALICE, RUTH, FRANK  };
+    private static  final   String      TONY = "TONY";
+    private static  final   String[]    LEGAL_USERS = { TEST_DBO, ALICE, RUTH, FRANK, TONY
 };
+
+    private static  final   String      MISSING_ROUTINE = "42Y03";
 
     ///////////////////////////////////////////////////////////////////////////////////
     //
@@ -439,4 +442,18 @@ public class UDAPermsTest extends Genera
              );
     }
     
+   /**
+     * <p>
+     * Test that we fixed an NPE in resolving function names when the
+     * schema hasn't been created yet.
+     * </p>
+     */
+    public  void    test_004_emptySchema()
+        throws Exception
+    {
+        Connection  tonyConnection = openUserConnection( TONY );
+
+        expectCompilationError( tonyConnection, MISSING_ROUTINE, "values toString( 100 )"
);
+    }
+
 }



Mime
View raw message