Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 3789 invoked from network); 19 Oct 2007 20:53:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 19 Oct 2007 20:53:13 -0000 Received: (qmail 25473 invoked by uid 500); 19 Oct 2007 20:53:00 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 25417 invoked by uid 500); 19 Oct 2007 20:52:59 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 25406 invoked by uid 99); 19 Oct 2007 20:52:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 Oct 2007 13:52:59 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 Oct 2007 20:53:11 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 2CBA371422E for ; Fri, 19 Oct 2007 13:52:51 -0700 (PDT) Message-ID: <1761797.1192827171181.JavaMail.jira@brutus> Date: Fri, 19 Oct 2007 13:52:51 -0700 (PDT) From: "Mamta A. Satoor (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Resolved: (DERBY-3046) setObj(int,Object,int) causes NPE if no parameter markers are present; should generate SQLException as for setObject(int,Object) In-Reply-To: <17571907.1188922724912.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/DERBY-3046?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Mamta A. Satoor resolved DERBY-3046. ------------------------------------ Resolution: Fixed Fix Version/s: 10.4.0.0 10.3.1.5 > 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.