You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Daniel John Debrunner (JIRA)" <de...@db.apache.org> on 2005/05/03 23:59:05 UTC

[jira] Created: (DERBY-258) Incorrect method resolution with explicit method signature

Incorrect method resolution with explicit method signature
----------------------------------------------------------

         Key: DERBY-258
         URL: http://issues.apache.org/jira/browse/DERBY-258
     Project: Derby
        Type: Bug
  Components: SQL  
    Versions: 10.1.0.0    
    Reporter: Daniel John Debrunner


If an explicit method signature has Java type that does not match the correct SQL to Java mapping as defined by JDBC, then method resolution seems to try and pick the incorrect method.

With this example an attempt is made to force an INT procedure parameter to resolve to a java.lang.String, which is not supported. However the engine trys to resolve to a method with an Integr parameter.


ij> CREATE PROCEDURE SIGNATURE_BUG_1(IN A INT)
  LANGUAGE JAVA PARAMETER STYLE JAVA
  EXTERNAL NAME 'java.lang.System.load(java.lang.String)';
0 rows inserted/updated/deleted
ij> CALL SIGNATURE_BUG_1(4);
ERROR 38000: The exception 'java.lang.NoSuchMethodError: java.lang.System.load(Ljava/lang/Integer;)V' was thrown while evaluating an expression.
ERROR XJ001: Java exception: 'java.lang.System.load(Ljava/lang/Integer;)V: java.lang.NoSuchMethodError'.

I believe that the resolution should fail with an illegal conversion error if the supplied Java type is not a match for the SQL type according to JDBC, in this case int or java.lang.Integer.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (DERBY-258) Incorrect method resolution with explicit method signature

Posted by "Daniel John Debrunner (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-258?page=all ]
     
Daniel John Debrunner resolved DERBY-258:
-----------------------------------------

    Fix Version: 10.1.0.0
     Resolution: Fixed

Committed revision 190508. Included updating the client and JCC master files for procedure.java test

> Incorrect method resolution with explicit method signature
> ----------------------------------------------------------
>
>          Key: DERBY-258
>          URL: http://issues.apache.org/jira/browse/DERBY-258
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.1.0.0
>     Reporter: Daniel John Debrunner
>     Assignee: Daniel John Debrunner
>      Fix For: 10.1.0.0
>  Attachments: derby258_20050607.txt
>
> If an explicit method signature has Java type that does not match the correct SQL to Java mapping as defined by JDBC, then method resolution seems to try and pick the incorrect method.
> With this example an attempt is made to force an INT procedure parameter to resolve to a java.lang.String, which is not supported. However the engine trys to resolve to a method with an Integr parameter.
> ij> CREATE PROCEDURE SIGNATURE_BUG_1(IN A INT)
>   LANGUAGE JAVA PARAMETER STYLE JAVA
>   EXTERNAL NAME 'java.lang.System.load(java.lang.String)';
> 0 rows inserted/updated/deleted
> ij> CALL SIGNATURE_BUG_1(4);
> ERROR 38000: The exception 'java.lang.NoSuchMethodError: java.lang.System.load(Ljava/lang/Integer;)V' was thrown while evaluating an expression.
> ERROR XJ001: Java exception: 'java.lang.System.load(Ljava/lang/Integer;)V: java.lang.NoSuchMethodError'.
> I believe that the resolution should fail with an illegal conversion error if the supplied Java type is not a match for the SQL type according to JDBC, in this case int or java.lang.Integer.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Closed: (DERBY-258) Incorrect method resolution with explicit method signature

Posted by "Daniel John Debrunner (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-258?page=all ]
     
Daniel John Debrunner closed DERBY-258:
---------------------------------------


> Incorrect method resolution with explicit method signature
> ----------------------------------------------------------
>
>          Key: DERBY-258
>          URL: http://issues.apache.org/jira/browse/DERBY-258
>      Project: Derby
>         Type: Bug

>   Components: SQL
>     Versions: 10.1.1.0
>     Reporter: Daniel John Debrunner
>     Assignee: Daniel John Debrunner
>      Fix For: 10.1.1.0
>  Attachments: derby258_20050607.txt
>
> If an explicit method signature has Java type that does not match the correct SQL to Java mapping as defined by JDBC, then method resolution seems to try and pick the incorrect method.
> With this example an attempt is made to force an INT procedure parameter to resolve to a java.lang.String, which is not supported. However the engine trys to resolve to a method with an Integr parameter.
> ij> CREATE PROCEDURE SIGNATURE_BUG_1(IN A INT)
>   LANGUAGE JAVA PARAMETER STYLE JAVA
>   EXTERNAL NAME 'java.lang.System.load(java.lang.String)';
> 0 rows inserted/updated/deleted
> ij> CALL SIGNATURE_BUG_1(4);
> ERROR 38000: The exception 'java.lang.NoSuchMethodError: java.lang.System.load(Ljava/lang/Integer;)V' was thrown while evaluating an expression.
> ERROR XJ001: Java exception: 'java.lang.System.load(Ljava/lang/Integer;)V: java.lang.NoSuchMethodError'.
> I believe that the resolution should fail with an illegal conversion error if the supplied Java type is not a match for the SQL type according to JDBC, in this case int or java.lang.Integer.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Assigned: (DERBY-258) Incorrect method resolution with explicit method signature

Posted by "Daniel John Debrunner (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-258?page=all ]

Daniel John Debrunner reassigned DERBY-258:
-------------------------------------------

    Assign To: Daniel John Debrunner

> Incorrect method resolution with explicit method signature
> ----------------------------------------------------------
>
>          Key: DERBY-258
>          URL: http://issues.apache.org/jira/browse/DERBY-258
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.1.0.0
>     Reporter: Daniel John Debrunner
>     Assignee: Daniel John Debrunner

>
> If an explicit method signature has Java type that does not match the correct SQL to Java mapping as defined by JDBC, then method resolution seems to try and pick the incorrect method.
> With this example an attempt is made to force an INT procedure parameter to resolve to a java.lang.String, which is not supported. However the engine trys to resolve to a method with an Integr parameter.
> ij> CREATE PROCEDURE SIGNATURE_BUG_1(IN A INT)
>   LANGUAGE JAVA PARAMETER STYLE JAVA
>   EXTERNAL NAME 'java.lang.System.load(java.lang.String)';
> 0 rows inserted/updated/deleted
> ij> CALL SIGNATURE_BUG_1(4);
> ERROR 38000: The exception 'java.lang.NoSuchMethodError: java.lang.System.load(Ljava/lang/Integer;)V' was thrown while evaluating an expression.
> ERROR XJ001: Java exception: 'java.lang.System.load(Ljava/lang/Integer;)V: java.lang.NoSuchMethodError'.
> I believe that the resolution should fail with an illegal conversion error if the supplied Java type is not a match for the SQL type according to JDBC, in this case int or java.lang.Integer.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-258) Incorrect method resolution with explicit method signature

Posted by "Daniel John Debrunner (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-258?page=comments#action_12312553 ] 

Daniel John Debrunner commented on DERBY-258:
---------------------------------------------

Other example that lead to incorrect resolution (all cause issues when called)

-- function with more types in signature than parameters, tries to resolve to
-- int toString(int, int) [note return type should be String]
CREATE FUNCTION SIGNATURE_BUG_DERBY_258_B(A INT) RETURNS VARCHAR(128) 
LANGUAGE JAVA PARAMETER STYLE JAVA
EXTERNAL NAME 'java.lang.Integer.toString(int, int)

-- procedure with less types in signature than arguments, causes an array out of bounds exception
CREATE PROCEDURE SIGNATURE_BUG_DERBY_258_C(IN A INT)
LANGUAGE JAVA PARAMETER STYLE JAVA 
EXTERNAL NAME 'java.lang.System.gc()'

-- any method signature that  leads to a method that does not exist
-- causes a null pointer exception
CREATE FUNCTION SIGNATURE_BUG_DERBY_258_E(P_VAL INT, P_RADIX INT) RETURNS VARCHAR(20)
LANGUAGE JAVA PARAMETER STYLE JAVA EXTERNAL NAME 'java.lang.Integer.toXXString()';

-- this valid first function defintion fails to resolve where as rhe second (with no signature) succeeds
CREATE FUNCTION SIGNATURE_BUG_DERBY_258_D(P_VAL INT, P_RADIX INT) RETURNS VARCHAR(20)
LANGUAGE JAVA PARAMETER STYLE JAVA EXTERNAL NAME 'java.lang.Integer.toString(int, int)';
CREATE FUNCTION SIGNATURE_BUG_DERBY_258_NS(P_VAL INT, P_RADIX INT) RETURNS VARCHAR(20)
LANGUAGE JAVA PARAMETER STYLE JAVA EXTERNAL NAME 'java.lang.Integer.toString';

> Incorrect method resolution with explicit method signature
> ----------------------------------------------------------
>
>          Key: DERBY-258
>          URL: http://issues.apache.org/jira/browse/DERBY-258
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.1.0.0
>     Reporter: Daniel John Debrunner
>     Assignee: Daniel John Debrunner

>
> If an explicit method signature has Java type that does not match the correct SQL to Java mapping as defined by JDBC, then method resolution seems to try and pick the incorrect method.
> With this example an attempt is made to force an INT procedure parameter to resolve to a java.lang.String, which is not supported. However the engine trys to resolve to a method with an Integr parameter.
> ij> CREATE PROCEDURE SIGNATURE_BUG_1(IN A INT)
>   LANGUAGE JAVA PARAMETER STYLE JAVA
>   EXTERNAL NAME 'java.lang.System.load(java.lang.String)';
> 0 rows inserted/updated/deleted
> ij> CALL SIGNATURE_BUG_1(4);
> ERROR 38000: The exception 'java.lang.NoSuchMethodError: java.lang.System.load(Ljava/lang/Integer;)V' was thrown while evaluating an expression.
> ERROR XJ001: Java exception: 'java.lang.System.load(Ljava/lang/Integer;)V: java.lang.NoSuchMethodError'.
> I believe that the resolution should fail with an illegal conversion error if the supplied Java type is not a match for the SQL type according to JDBC, in this case int or java.lang.Integer.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DERBY-258) Incorrect method resolution with explicit method signature

Posted by "Daniel John Debrunner (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-258?page=all ]

Daniel John Debrunner updated DERBY-258:
----------------------------------------

    Attachment: derby258_20050607.txt

Changes to parse the signature in the context of the parameter types of the function or procedure.
Ensures declared signature Java types are mappable to the parameter types, as specified in the SQL2003 spec part 13
Checks for various invalid formats as well.

I'll commit this in a couple of days addressing any review comments. PAtch is missing master file updates for procedure.java with JCC and the derbyt client, will address those in the commit.

> Incorrect method resolution with explicit method signature
> ----------------------------------------------------------
>
>          Key: DERBY-258
>          URL: http://issues.apache.org/jira/browse/DERBY-258
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.1.0.0
>     Reporter: Daniel John Debrunner
>     Assignee: Daniel John Debrunner
>  Attachments: derby258_20050607.txt
>
> If an explicit method signature has Java type that does not match the correct SQL to Java mapping as defined by JDBC, then method resolution seems to try and pick the incorrect method.
> With this example an attempt is made to force an INT procedure parameter to resolve to a java.lang.String, which is not supported. However the engine trys to resolve to a method with an Integr parameter.
> ij> CREATE PROCEDURE SIGNATURE_BUG_1(IN A INT)
>   LANGUAGE JAVA PARAMETER STYLE JAVA
>   EXTERNAL NAME 'java.lang.System.load(java.lang.String)';
> 0 rows inserted/updated/deleted
> ij> CALL SIGNATURE_BUG_1(4);
> ERROR 38000: The exception 'java.lang.NoSuchMethodError: java.lang.System.load(Ljava/lang/Integer;)V' was thrown while evaluating an expression.
> ERROR XJ001: Java exception: 'java.lang.System.load(Ljava/lang/Integer;)V: java.lang.NoSuchMethodError'.
> I believe that the resolution should fail with an illegal conversion error if the supplied Java type is not a match for the SQL type according to JDBC, in this case int or java.lang.Integer.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DERBY-258) Incorrect method resolution with explicit method signature

Posted by "Daniel John Debrunner (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-258?page=comments#action_12312932 ] 

Daniel John Debrunner commented on DERBY-258:
---------------------------------------------

Forgot to add the svn status

M      java\engine\org\apache\derby\impl\sql\compile\MethodCallNode.java
M      java\engine\org\apache\derby\iapi\services\loader\ClassInspector.java
M      java\engine\org\apache\derby\iapi\reference\SQLState.java
M      java\engine\org\apache\derby\loc\messages_en.properties
M      java\testing\org\apache\derbyTesting\functionTests\tests\lang\procedure.java
M      java\testing\org\apache\derbyTesting\functionTests\tests\lang\functions.sql
M      java\testing\org\apache\derbyTesting\functionTests\master\functions.out
M      java\testing\org\apache\derbyTesting\functionTests\master\procedure.out

> Incorrect method resolution with explicit method signature
> ----------------------------------------------------------
>
>          Key: DERBY-258
>          URL: http://issues.apache.org/jira/browse/DERBY-258
>      Project: Derby
>         Type: Bug
>   Components: SQL
>     Versions: 10.1.0.0
>     Reporter: Daniel John Debrunner
>     Assignee: Daniel John Debrunner
>  Attachments: derby258_20050607.txt
>
> If an explicit method signature has Java type that does not match the correct SQL to Java mapping as defined by JDBC, then method resolution seems to try and pick the incorrect method.
> With this example an attempt is made to force an INT procedure parameter to resolve to a java.lang.String, which is not supported. However the engine trys to resolve to a method with an Integr parameter.
> ij> CREATE PROCEDURE SIGNATURE_BUG_1(IN A INT)
>   LANGUAGE JAVA PARAMETER STYLE JAVA
>   EXTERNAL NAME 'java.lang.System.load(java.lang.String)';
> 0 rows inserted/updated/deleted
> ij> CALL SIGNATURE_BUG_1(4);
> ERROR 38000: The exception 'java.lang.NoSuchMethodError: java.lang.System.load(Ljava/lang/Integer;)V' was thrown while evaluating an expression.
> ERROR XJ001: Java exception: 'java.lang.System.load(Ljava/lang/Integer;)V: java.lang.NoSuchMethodError'.
> I believe that the resolution should fail with an illegal conversion error if the supplied Java type is not a match for the SQL type according to JDBC, in this case int or java.lang.Integer.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira