db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r1435267 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/sql/compile/StaticMethodCallNode.java testing/org/apache/derbyTesting/functionTests/tests/lang/VarargsTest.java
Date Fri, 18 Jan 2013 17:43:20 GMT
Author: rhillegas
Date: Fri Jan 18 17:43:20 2013
New Revision: 1435267

URL: http://svn.apache.org/viewvc?rev=1435267&view=rev
Log:
DERBY-6047: Fix NPE in routine resolution introduced by work on DERBY-3069.

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

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/StaticMethodCallNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/StaticMethodCallNode.java?rev=1435267&r1=1435266&r2=1435267&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/StaticMethodCallNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/StaticMethodCallNode.java
Fri Jan 18 17:43:20 2013
@@ -512,9 +512,9 @@ public class StaticMethodCallNode extend
 
 			AliasDescriptor proc = (AliasDescriptor) list.get(i);
 
-			RoutineAliasInfo routineInfo = (RoutineAliasInfo) proc.getAliasInfo();
-			int parameterCount = routineInfo.getParameterCount();
-            boolean hasVarargs = routineInfo.hasVarargs();
+			RoutineAliasInfo rai = (RoutineAliasInfo) proc.getAliasInfo();
+			int parameterCount = rai.getParameterCount();
+            boolean hasVarargs = rai.hasVarargs();
 
             if ( hasVarargs )
             {
@@ -528,10 +528,10 @@ public class StaticMethodCallNode extend
 			// pre-form the method signature. If it is a dynamic result set procedure
 			// then we need to add in the ResultSet array
 
-			TypeDescriptor[] parameterTypes = routineInfo.getParameterTypes();
+			TypeDescriptor[] parameterTypes = rai.getParameterTypes();
 
 			int sigParameterCount = parameterCount;
-			if (routineInfo.getMaxDynamicResultSets() > 0)
+			if (rai.getMaxDynamicResultSets() > 0)
             { sigParameterCount++; }
 
 			signature = new JSQLType[sigParameterCount];
@@ -547,7 +547,7 @@ public class StaticMethodCallNode extend
 
 
 				// if it's an OUT or INOUT parameter we need an array.
-				int parameterMode = routineInfo.getParameterModes()[ getRoutineArgIdx( routineInfo, p
) ];
+				int parameterMode = rai.getParameterModes()[ getRoutineArgIdx( rai, p ) ];
 
 				if (parameterMode != JDBC30Translation.PARAMETER_MODE_IN) {
 
@@ -609,6 +609,7 @@ public class StaticMethodCallNode extend
                         coerceMethodParameter
                             (
                              fromList, subqueryList, aggregateVector,
+                             rai,
                              methodParms.length,
                              paramdtd, parameterTypeId, parameterMode,
                              idx
@@ -620,6 +621,7 @@ public class StaticMethodCallNode extend
                     coerceMethodParameter
                         (
                          fromList, subqueryList, aggregateVector,
+                         rai,
                          methodParms.length,
                          paramdtd, parameterTypeId, parameterMode,
                          p
@@ -641,7 +643,7 @@ public class StaticMethodCallNode extend
 
 			}
 
-			this.routineInfo = routineInfo;
+			this.routineInfo = rai;
 			ad = proc;
 
 			// If a procedure is in the system schema and defined as executing
@@ -675,7 +677,8 @@ public class StaticMethodCallNode extend
         (
          FromList fromList,
          SubqueryList subqueryList,
-         Vector aggregateVector, 
+         Vector aggregateVector,
+         RoutineAliasInfo rai,
          int    parameterCount, // number of declared routine args
          DataTypeDescriptor paramdtd,   // declared type of routine arg
          TypeId parameterTypeId,    // declared type id of routine arg
@@ -703,7 +706,7 @@ public class StaticMethodCallNode extend
                     (
                      SQLState.LANG_DB2_PARAMETER_NEEDS_MARKER,
                      RoutineAliasInfo.parameterMode(parameterMode),
-                     routineInfo.getParameterNames()[p]
+                     rai.getParameterNames()[p]
                      );
             }
             isParameterMarker = false;

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/VarargsTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/VarargsTest.java?rev=1435267&r1=1435266&r2=1435267&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/VarargsTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/VarargsTest.java
Fri Jan 18 17:43:20 2013
@@ -54,6 +54,7 @@ public class VarargsTest  extends Genera
     private static  final   String  BAD_TIME_FORMAT = "22007";
     private static  final   String  BAD_BOOLEAN_FORMAT = "22018";
     private static  final   String  NEEDS_DJRS_STYLE = "42ZB2";
+    private static  final   String  NEEDS_PARAMETER_MARKER = "42886";
 
     ///////////////////////////////////////////////////////////////////////////////////
     //
@@ -1157,6 +1158,28 @@ public class VarargsTest  extends Genera
 
     }
 
+    /**
+     * <p>
+     * Test for NPE reported on DERBY-6047.
+     * </p>
+     */
+    public void test_07_6047() throws Exception
+    {
+        Connection conn = getConnection();
+
+        goodStatement
+            ( conn,
+              "create procedure PROC_6047( inout x int )\n" +
+              "parameter style java modifies sql data language java\n" +
+              "external name 'DUMMY.PROC_6047'\n"
+              );
+
+        expectCompilationError
+            ( NEEDS_PARAMETER_MARKER,
+              "call PROC_6047(1)"
+              );
+    }
+    
     ///////////////////////////////////////////////////////////////////////////////////
     //
     // MINIONS



Mime
View raw message