db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bryan Pendleton (JIRA)" <j...@apache.org>
Subject [jira] Updated: (DERBY-2558) client trhows ArrayIndexOutOfBounds exception instead of parameter out of range
Date Mon, 14 May 2007 23:59:16 GMT

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

Bryan Pendleton updated DERBY-2558:
-----------------------------------

    Attachment: setObjectCheckIndex.diff

Attached is setObjectCheckIndex.diff, an alternate patch proposal.

Instead of checking the parameter index in IJ, this change checks
the parameterIndex at the start of the client's setObject() method,
using the same method as is done for the other overloads of
setObject.

As Kathey observed, it's better to fix this in the client code directly
because then it fixes not only the IJ case but also all other code that
might use the client APIs, such as a user's application.

The patch proposal contains a new test case, as an IJ script, taken
from the initial repro.

I'd appreciate feedback about whether we should also add some
test cases which directly call the JDBC API as well, based on
Kathey's d2558.java test program, or whether that
would be overkill and it's adequate just to test this via IJ.

derbyall and suites.All testing was clean with this patch.

> client trhows ArrayIndexOutOfBounds exception instead of parameter out of range 
> --------------------------------------------------------------------------------
>
>                 Key: DERBY-2558
>                 URL: https://issues.apache.org/jira/browse/DERBY-2558
>             Project: Derby
>          Issue Type: Bug
>          Components: Network Client
>    Affects Versions: 10.3.0.0
>            Reporter: Kathey Marsden
>         Assigned To: Bryan Pendleton
>            Priority: Minor
>         Attachments: d2558.java, IJCheckParms.diff, setObjectCheckIndex.diff
>
>
>       
> The following sql gives an ArrayIndexOutOfBoundsException with client.  With embedded
we get the expected.
> ERROR XCL13: The parameter position '2' is out of range.  The number of parameters for
this prepared  statement is '1'.
> ij> create table t (i int);
> 0 rows inserted/updated/deleted
> ij> insert into t values (3), (4);
> 2 rows inserted/updated/deleted
> ij> execute 'select * from t where i=?' using 'values (3,4)';
> IJ WARNING: Autocommit may close using result set
> JAVA ERROR: java.lang.ArrayIndexOutOfBoundsException: 1
> java.lang.ArrayIndexOutOfBoundsException: 1
>         at org.apache.derby.client.am.PreparedStatement.setObjectX(PreparedStatement.java:1506)
>         at org.apache.derby.client.am.PreparedStatement.setObject(PreparedStatement.java:1458)
>         at org.apache.derby.impl.tools.ij.util.DisplayMulti(util.java:696)
>         at org.apache.derby.impl.tools.ij.utilMain.displayResult(utilMain.java:474)
>         at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:351)
>         at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:270)
>         at org.apache.derby.impl.tools.ij.Main.go(Main.java:215)
>         at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:181)
>         at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
>         at org.apache.derby.tools.ij.main(ij.java:71)

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


Mime
View raw message