db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mamta A. Satoor (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-3046) setObj(int,Object,int) causes NPE if no parameter markers are present; should generate SQLException as for setObject(int,Object)
Date Fri, 19 Oct 2007 20:52:50 GMT

    [ https://issues.apache.org/jira/browse/DERBY-3046?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12536340
] 

Mamta A. Satoor commented on DERBY-3046:
----------------------------------------

Migrated change into 10.3 codeline with revision 586607. Will go ahead and close this issue,

> setObj(int,Object,int) causes NPE if no parameter markers are present; should generate
SQLException as for setObject(int,Object)
> --------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3046
>                 URL: https://issues.apache.org/jira/browse/DERBY-3046
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC, Network Client
>    Affects Versions: 10.3.1.4
>            Reporter: Sebb
>            Assignee: Mamta A. Satoor
>            Priority: Minor
>             Fix For: 10.3.1.5, 10.4.0.0
>
>
> Change WwdClientExample so that there are no parameters, e.g.
> psInsert = conn.prepareStatement("insert into WISH_LIST(WISH_ITEM) values ('?')");
> Now change 
>    psInsert.setString(1,answer);
> to
>   psInsert.setObject(1,answer);
> and the error is OK:
> SQLState:   XCL14
> Severity: 20000
> Message:  The column position '1' is out of range.  The number of columns for this ResultSet
is '0'.
> java.sql.SQLException: The column position '1' is out of range.  The number of columns
for this ResultSet is '0'.
> [...]
> However, using:
> psInsert.setObject(1,answer,java.sql.Types.VARCHAR);
> causes an NPE:
> java.lang.NullPointerException
>         at org.apache.derby.client.am.PreparedStatement.checkForValidParameterIndex(Unknown
Source)
>         at org.apache.derby.client.am.PreparedStatement.setObjectX(Unknown Source)
>         at org.apache.derby.client.am.PreparedStatement.setObject(Unknown Source)
>         at WwdClientExample.main(WwdClientExample.java:93)
> Surely it should behave the same as the previous method call - i.e. return an SQLException?

-- 
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