Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 42622 invoked from network); 27 Dec 2005 18:20:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 27 Dec 2005 18:20:02 -0000 Received: (qmail 16214 invoked by uid 500); 27 Dec 2005 18:20:02 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 15961 invoked by uid 500); 27 Dec 2005 18:20:00 -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 15950 invoked by uid 99); 27 Dec 2005 18:20:00 -0000 X-ASF-Spam-Status: No, hits=1.3 required=10.0 tests=SPF_FAIL X-Spam-Check-By: apache.org Received: from [192.87.106.226] (HELO ajax.apache.org) (192.87.106.226) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Dec 2005 10:19:58 -0800 Received: from ajax.apache.org (ajax.apache.org [127.0.0.1]) by ajax.apache.org (Postfix) with ESMTP id E7739DE for ; Tue, 27 Dec 2005 19:19:36 +0100 (CET) Message-ID: <9103574.1135707576946.JavaMail.jira@ajax.apache.org> Date: Tue, 27 Dec 2005 19:19:36 +0100 (CET) From: "Daniel John Debrunner (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Commented: (DERBY-680) In ij, executing a prepared statement with numeric/decimal parameter fails with NullPointerException in J2ME/CDC/FP In-Reply-To: <1225493132.1131041087350.JavaMail.jira@ajax.apache.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/DERBY-680?page=comments#action_12361280 ] Daniel John Debrunner commented on DERBY-680: --------------------------------------------- I'm looking at reviewing & committing this patch. > In ij, executing a prepared statement with numeric/decimal parameter fails with NullPointerException in J2ME/CDC/FP > ------------------------------------------------------------------------------------------------------------------- > > Key: DERBY-680 > URL: http://issues.apache.org/jira/browse/DERBY-680 > Project: Derby > Type: Bug > Components: Tools > Versions: 10.2.0.0 > Environment: j9_foundation VM in IBM WCTME 5.7 > Reporter: Deepa Remesh > Assignee: Deepa Remesh > Attachments: derby-680.diff, derby-680.status > > NPE is thrown in ij when executing prepared statement which > - has numeric/decimal parameters > - does not return any result set > Repro for this problem is the test lang/cast.sql. This test currently fails in CDC/FP. > The following lines in the test throw NPE: > execute q10 using 'values 123456.78'; > execute q11 using 'values 123456.78'; > where q10 is "prepare q10 as 'insert into t1 (num) values cast(? as numeric(18))';" > and q11 is "prepare q11 as 'insert into t1 (dc) values cast(? as decimal(18))';" > The stack trace for failure is: > java.lang.NullPointerException > at org.apache.derby.impl.tools.ij.util.DisplayMulti(util.java:666) > at org.apache.derby.impl.tools.ij.utilMain.displayResult(utilMain.java:398) > at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:290) > at org.apache.derby.impl.tools.ij.Main.go(Main.java:203) > at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:169) > at org.apache.derby.impl.tools.ij.Main.main(Main.java:75) > at org.apache.derby.tools.ij.main(ij.java:56) > This happens in the following code. Since the above prepared statements do not return result sets, call to getMetaData() will return null. But in the code, no check is done to see if getMetaData() returns null before calling getColumnType. > ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- > // In J2ME there is no object that represents > // a DECIMAL value. By default use String to > // pass values around, but for integral types > // first convert to a integral type from the DECIMAL > // because strings like 3.4 are not convertible to > // an integral type. > switch (ps.getMetaData().getColumnType(c)) > { > case Types.BIGINT: > ps.setLong(c, rs.getLong(c)); > break; > case Types.INTEGER: > case Types.SMALLINT: > case Types.TINYINT: > ps.setInt(c, rs.getInt(c)); > break; > default: > ps.setString(c,rs.getString(c)); > break; > } > ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -- 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