[
https://issues.apache.org/jira/browse/DERBY-6047?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Rick Hillegas updated DERBY-6047:
---------------------------------
Attachment: derby-6047-01-aa-passRoutineInfo.diff
Attaching derby-6047-01-aa-passRoutineInfo.diff. This fixes the NPE reported by
Dag. I am running regression tests now.
The bug arises because StaticMethodCallNode.coerceMethodParameter() tries to
reference the routineInfo field, which has not been filled in. As part of the
work on DERBY-3069, I abstracted the coerceMethodParameter() method out of the
pinball machine in the bind-time resolveRoutine() method. The resolveRoutine()
method creates its own variable called routineInfo, which shadows the instance
field by the same name. The instance field is not filled in unless
resolveRoutine() successfully matches a routine. The fix is to pass the
variable to coerceMethodParameter().
While I was in there, I changed the name of the variable used by
resolveRoutine() so that it no longer shadows the instance field. Hopefully,
this will help the compiler catch mistakes like this in the future.
Touches the following files:
-------------
M java/engine/org/apache/derby/impl/sql/compile/StaticMethodCallNode.java
The fix.
-------------
M
java/testing/org/apache/derbyTesting/functionTests/tests/lang/VarargsTest.java
Added a regression test case for this bug.
> NPE in StaticCallMethod#coerceMethodParameter with a constant argument to
> INOUT parameter
> -----------------------------------------------------------------------------------------
>
> Key: DERBY-6047
> URL: https://issues.apache.org/jira/browse/DERBY-6047
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Reporter: Dag H. Wanvik
> Assignee: Rick Hillegas
> Attachments: derby-6047-01-aa-passRoutineInfo.diff
>
>
> The following repro shows the problem (provided by Holger Rehn, cf. issue
> DERBY-5945).
> sta.execute( "create procedure PROC( inout x int ) " +
> "parameter style java modifies sql data language java " +
> "external name 'DUMMY.PROC'" );
> sta.execute( "{call PROC(1)}" );
> gives NPE on trunk (even before the fixes introduced for DERBY-5945), but not
> on 10.9, so I believe it's a regression:
> :
> Caused by: java.lang.NullPointerException
> ...sql.compile.StaticMethodCallNode.coerceMethodParameter(StaticMethodCallNode.java:702)
> ...sql.compile.StaticMethodCallNode.resolveRoutine(StaticMethodCallNode.java:620)
> ...sql.compile.StaticMethodCallNode.bindExpression(StaticMethodCallNode.java:210)
> ...sql.compile.JavaToSQLValueNode.bindExpression(JavaToSQLValueNode.java:237)
> ...sql.compile.CallStatementNode.bindStatement(CallStatementNode.java:126)
> ...sql.GenericStatement.prepMinion(GenericStatement.java:400)
> :
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira