[ 
https://issues.apache.org/jira/browse/DERBY-4459?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rick Hillegas updated DERBY-4459:
---------------------------------

    Attachment: derby4459.java
                derby-4459.sql

Attaching a reproducible test case: derby4459.java and derby-4459.sql. If you 
compile the class and run the script through ij, you will see this output:

ij version 10.6
ij> connect 'jdbc:derby:memory:db;create=true';
ij> create function getNullInt() returns int language java parameter style java 
external name 'derby4459.getNullInt';
0 rows inserted/updated/deleted
ij> create function negateInt( a int ) returns int language java parameter 
style java external name 'derby4459.negateInt';
0 rows inserted/updated/deleted
ij> -- this fails gracefully
values( negateInt( cast( null as int) ) );
1          
-----------
ERROR 39004: A NULL value cannot be passed to a method which takes a parameter 
of primitive type 'int'.
ij> -- this fails gracelessly
values( negateInt( getNullInt() ) );
ERROR XBCM2: Cannot create an instance of generated class 
org.apache.derby.exe.ac0b5b0099x0125x4b6bxa3fdx000000135f981.
ERROR XJ001: Java exception: '(class: 
org/apache/derby/exe/ac0b5b0099x0125x4b6bxa3fdx000000135f981, method: e0 
signature: ()Ljava/lang/Object;) Expecting to find integer on stack: 
java.lang.VerifyError'.

> Verification error at execute-time when an outer function which takes a 
> primitive arg is wrapped around an inner function which returns the 
> corresponding Java wrapper object
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-4459
>                 URL: https://issues.apache.org/jira/browse/DERBY-4459
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.4.2.1, 10.4.3.0, 10.5.3.1, 10.5.4.0, 10.6.0.0
>            Reporter: Rick Hillegas
>         Attachments: derby-4459.sql, derby4459.java
>
>
> An insane Derby raises a verification error when trying to run the following 
> query:
> values( negateInt( getNullInt() ) );
> where negateInt() takes a primitive int argument and getNullInt() returns an 
> Integer.
> Sane Derby raises an assertion. The same test case, run against 10.3.3.1, 
> also fails but raises a more graceful compile-time exception.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to