Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 56975 invoked from network); 24 Nov 2006 09:23:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 24 Nov 2006 09:23:26 -0000 Received: (qmail 1941 invoked by uid 500); 24 Nov 2006 09:23:36 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 1721 invoked by uid 500); 24 Nov 2006 09:23:34 -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 1712 invoked by uid 99); 24 Nov 2006 09:23:34 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Nov 2006 01:23:34 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= 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, 24 Nov 2006 01:23:24 -0800 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 0805C71429F for ; Fri, 24 Nov 2006 01:23:04 -0800 (PST) Message-ID: <2301890.1164360184029.JavaMail.jira@brutus> Date: Fri, 24 Nov 2006 01:23:04 -0800 (PST) From: "Kristian Waagan (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Updated: (DERBY-2112) Nullpointer on executeBatchRequestX when preparedStatement has no parameters In-Reply-To: <19715170.1164284761926.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org [ http://issues.apache.org/jira/browse/DERBY-2112?page=3Dall ] Kristian Waagan updated DERBY-2112: ----------------------------------- Attachment: Derby2112ReproNPE.java 'Derby2112ReproNPE.java' demonstrates the reported bug (basically took code= from the reporter of this issue). I also ran derbyall/suites.All with the proposed fix, and it ran without fa= ilures. I think a patch including a test case for this bug should be create= d. > Nullpointer on executeBatchRequestX when preparedStatement has no paramet= ers > -------------------------------------------------------------------------= --- > > Key: DERBY-2112 > URL: http://issues.apache.org/jira/browse/DERBY-2112 > Project: Derby > Issue Type: Bug > Components: Network Client > Affects Versions: 10.2.1.6 > Environment: Using java version 1.5.0_05 (sun).=20 > Reporter: Cesar Devera > Attachments: Derby2112ReproNPE.java > > > there is a problem when using batch statements without bind parameters (?= ), with ClientDriver (derbyclient.jar): > java.lang.NullPointerException > =09at org.apache.derby.client.am.PreparedStatement.executeBatchRequestX(U= nknown Source) > =09at org.apache.derby.client.am.PreparedStatement.executeBatchX(Unknown = Source) > =09at org.apache.derby.client.am.PreparedStatement.executeBatch(Unknown S= ource) > =09at teste.Teste9.main(Teste9.java:29) > test process to reproduce the bug: > create a database called mydbtest under $DERBY_HOME/data > create and populate a new table called teste1: > create table teste1 ( valor numeric ); > insert into teste1 values (1); > insert into teste1 values (2); > insert into teste1 values (3); > start derby network server. > run the following code: > =09public static void main(String[] args) throws SQLException { > =09=09 > =09 try { > =09 Class.forName("org.apache.derby.jdbc.ClientDriver" ); > =09 } catch (Exception e) { > =09 e.printStackTrace(); > =09 return; > =09 } > =09 Connection c =3D DriverManager.getConnection("jdbc:derby://localho= st:1527/d:/derby_10/data/mydbtest", "app", "app"); > =09 =20 > =09 PreparedStatement ps =3D c.prepareStatement("update teste1 set val= or =3D 8"); > =09 ps2.addBatch(); > =09 =20 > =09 int j[] =3D ps.executeBatch(); > =09 System.out.println(j[0]); > =09 ps.close(); > =09 =20 > =09 c.close(); > =09} > this exception is thrown: > java.lang.NullPointerException > =09at org.apache.derby.client.am.PreparedStatement.executeBatchRequestX(U= nknown Source) > =09at org.apache.derby.client.am.PreparedStatement.executeBatchX(Unknown = Source) > =09at org.apache.derby.client.am.PreparedStatement.executeBatch(Unknown S= ource) > =09at teste.Teste9.main(Teste9.java:29) > ------ > i've studied the source and got the bug on class org.apache.derby.client.= am.PreparedStatement line 2043. > then, i've changed that line from this: > =09=09=09parameterMetaData_.clientParamtertype_ =3D (int[]) parameterType= List.get(i); > to this: > =09=09=09if (parameterMetaData_ !=3D null) { > =09=09=09=09parameterMetaData_.clientParamtertype_ =3D (int[]) parameterT= ypeList.get(i); > =09=09=09} > after running the build and updating the derbyclient.jar, my application = worked fine, so this seems to solve the problem. > i didn't run the automatic build tests to check for other impacts / colla= teral effects. > follows org.apache.derby.tools.sysinfo output: > ------------------ Informacoes sobre Java ------------------ > Vers?o do Java: 1.4.2_08 > Fornecedor do Java: Sun Microsystems Inc. > Diret?rio base do Java: C:\j2sdk1.4.2_08\jre > Caminho de classes do Java: .;.;C:\PROGRA~1\JMF21~1.1E\lib\sound.= jar;C:\PROGRA~1\JMF21~1.1E\lib\jmf.jar;C:\PROGRA~1\J > MF21~1.1E\lib;%systemroot%\java\classes;.;D:\DERBY_10/lib/derby.jar;D:\DE= RBY_10/lib/derbynet.jar;D:\DERBY_10/lib/derbyclient. > jar;D:\DERBY_10/lib/derbytools.jar > Nome do Sistema Operacional: Windows XP > Arquitetura do Sistema Operacional: x86 > Vers?o do Sistema Operacional: 5.1 > Nome do usu=C3=9Frio Java: acd025 > Diret?rio base do usu=C3=9Frio Java: D:\Profiles\acd025 > Diret?rio do usu=C3=9Frio Java: D:\derby_10 > java.specification.name: Java Platform API Specification > java.specification.version: 1.4 > ---------------- Informa??es sobre o Derby ----------------- > JRE - JDBC: J2SE 1.4.2 - JDBC 3.0 > [D:\derby_10\lib\derby.jar] 10.2.1.6 - (452058) > [D:\derby_10\lib\derbytools.jar] 10.2.1.6 - (452058) > [D:\derby_10\lib\derbynet.jar] 10.2.1.6 - (452058) > [D:\derby_10\lib\derbyclient.jar] 10.2.1.6 - (452058) > ------------------------------------------------------ > ---------------- Informa??es sobre o Idioma ---------------- > Idioma atual : [portugu?s/Brasil [pt_BR]] > Encontrado suporte para o idioma: [de_DE] > vers?o: 10.2.1.6 - (452058) > Encontrado suporte para o idioma: [es] > vers?o: 10.2.1.6 - (452058) > Encontrado suporte para o idioma: [fr] > vers?o: 10.2.1.6 - (452058) > Encontrado suporte para o idioma: [it] > vers?o: 10.2.1.6 - (452058) > Encontrado suporte para o idioma: [ja_JP] > vers?o: 10.2.1.6 - (452058) > Encontrado suporte para o idioma: [ko_KR] > vers?o: 10.2.1.6 - (452058) > Encontrado suporte para o idioma: [pt_BR] > vers?o: 10.2.1.6 - (452058) > Encontrado suporte para o idioma: [zh_CN] > vers?o: 10.2.1.6 - (452058) > Encontrado suporte para o idioma: [zh_TW] > vers?o: 10.2.1.6 - (452058) > ------------------------------------------------------ --=20 This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: htt= p://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira