You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Cesar Devera (JIRA)" <ji...@apache.org> on 2006/11/23 13:26:01 UTC

[jira] Created: (DERBY-2112) Nullpointer on executeBatchRequestX when preparedStatement has no parameters

Nullpointer on executeBatchRequestX when preparedStatement has no parameters
----------------------------------------------------------------------------

                 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). 
            Reporter: Cesar Devera


there is a problem when using batch statements without bind parameters (?), with ClientDriver (derbyclient.jar):

java.lang.NullPointerException
	at org.apache.derby.client.am.PreparedStatement.executeBatchRequestX(Unknown Source)
	at org.apache.derby.client.am.PreparedStatement.executeBatchX(Unknown Source)
	at org.apache.derby.client.am.PreparedStatement.executeBatch(Unknown Source)
	at 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:

	public static void main(String[] args) throws SQLException {
		
	    try {
	        Class.forName("org.apache.derby.jdbc.ClientDriver" );
	    } catch (Exception e) {
	        e.printStackTrace();
	        return;
	    }

	    Connection c = DriverManager.getConnection("jdbc:derby://localhost:1527/d:/derby_10/data/mydbtest", "app", "app");
	    
	    PreparedStatement ps = c.prepareStatement("update teste1 set valor = 8");
	    ps2.addBatch();
	    
	    int j[] = ps.executeBatch();
	    System.out.println(j[0]);
	    ps.close();
	    
	    c.close();
	}

this exception is thrown:

java.lang.NullPointerException
	at org.apache.derby.client.am.PreparedStatement.executeBatchRequestX(Unknown Source)
	at org.apache.derby.client.am.PreparedStatement.executeBatchX(Unknown Source)
	at org.apache.derby.client.am.PreparedStatement.executeBatch(Unknown Source)
	at 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:

			parameterMetaData_.clientParamtertype_ = (int[]) parameterTypeList.get(i);

to this:

			if (parameterMetaData_ != null) {
				parameterMetaData_.clientParamtertype_ = (int[]) parameterTypeList.get(i);
			}

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 / collateral 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:\DERBY_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ßrio Java:               acd025
Diret≤rio base do usußrio Java:     D:\Profiles\acd025
Diret≤rio do usußrio 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)
------------------------------------------------------





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

       

[jira] Updated: (DERBY-2112) Nullpointer on executeBatchRequestX when preparedStatement has no parameters

Posted by "Myrna van Lunteren (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2112?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Myrna van Lunteren updated DERBY-2112:
--------------------------------------

    Attachment: DERBY-2112_20070209.diff

Attaching a patch with the fix suggested by Cesar & which activates the test in jdbcapi/BatchUpdateTest.java for network server.
suites.All and derbyall ran cleanly for me too, but as I know nothing about this code, another check is probably good. 

Review please?

> Nullpointer on executeBatchRequestX when preparedStatement has no parameters
> ----------------------------------------------------------------------------
>
>                 Key: DERBY-2112
>                 URL: https://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). 
>            Reporter: Cesar Devera
>         Attachments: DERBY-2112_20070209.diff, Derby2112ReproNPE.java
>
>
> there is a problem when using batch statements without bind parameters (?), with ClientDriver (derbyclient.jar):
> java.lang.NullPointerException
> 	at org.apache.derby.client.am.PreparedStatement.executeBatchRequestX(Unknown Source)
> 	at org.apache.derby.client.am.PreparedStatement.executeBatchX(Unknown Source)
> 	at org.apache.derby.client.am.PreparedStatement.executeBatch(Unknown Source)
> 	at 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:
> 	public static void main(String[] args) throws SQLException {
> 		
> 	    try {
> 	        Class.forName("org.apache.derby.jdbc.ClientDriver" );
> 	    } catch (Exception e) {
> 	        e.printStackTrace();
> 	        return;
> 	    }
> 	    Connection c = DriverManager.getConnection("jdbc:derby://localhost:1527/d:/derby_10/data/mydbtest", "app", "app");
> 	    
> 	    PreparedStatement ps = c.prepareStatement("update teste1 set valor = 8");
> 	    ps2.addBatch();
> 	    
> 	    int j[] = ps.executeBatch();
> 	    System.out.println(j[0]);
> 	    ps.close();
> 	    
> 	    c.close();
> 	}
> this exception is thrown:
> java.lang.NullPointerException
> 	at org.apache.derby.client.am.PreparedStatement.executeBatchRequestX(Unknown Source)
> 	at org.apache.derby.client.am.PreparedStatement.executeBatchX(Unknown Source)
> 	at org.apache.derby.client.am.PreparedStatement.executeBatch(Unknown Source)
> 	at 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:
> 			parameterMetaData_.clientParamtertype_ = (int[]) parameterTypeList.get(i);
> to this:
> 			if (parameterMetaData_ != null) {
> 				parameterMetaData_.clientParamtertype_ = (int[]) parameterTypeList.get(i);
> 			}
> 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 / collateral 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:\DERBY_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ßrio Java:               acd025
> Diret?rio base do usußrio Java:     D:\Profiles\acd025
> Diret?rio do usußrio 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)
> ------------------------------------------------------

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


[jira] Assigned: (DERBY-2112) Nullpointer on executeBatchRequestX when preparedStatement has no parameters

Posted by "Myrna van Lunteren (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2112?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Myrna van Lunteren reassigned DERBY-2112:
-----------------------------------------

    Assignee: Myrna van Lunteren

> Nullpointer on executeBatchRequestX when preparedStatement has no parameters
> ----------------------------------------------------------------------------
>
>                 Key: DERBY-2112
>                 URL: https://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). 
>            Reporter: Cesar Devera
>         Assigned To: Myrna van Lunteren
>         Attachments: DERBY-2112_20070209.diff, Derby2112ReproNPE.java
>
>
> there is a problem when using batch statements without bind parameters (?), with ClientDriver (derbyclient.jar):
> java.lang.NullPointerException
> 	at org.apache.derby.client.am.PreparedStatement.executeBatchRequestX(Unknown Source)
> 	at org.apache.derby.client.am.PreparedStatement.executeBatchX(Unknown Source)
> 	at org.apache.derby.client.am.PreparedStatement.executeBatch(Unknown Source)
> 	at 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:
> 	public static void main(String[] args) throws SQLException {
> 		
> 	    try {
> 	        Class.forName("org.apache.derby.jdbc.ClientDriver" );
> 	    } catch (Exception e) {
> 	        e.printStackTrace();
> 	        return;
> 	    }
> 	    Connection c = DriverManager.getConnection("jdbc:derby://localhost:1527/d:/derby_10/data/mydbtest", "app", "app");
> 	    
> 	    PreparedStatement ps = c.prepareStatement("update teste1 set valor = 8");
> 	    ps2.addBatch();
> 	    
> 	    int j[] = ps.executeBatch();
> 	    System.out.println(j[0]);
> 	    ps.close();
> 	    
> 	    c.close();
> 	}
> this exception is thrown:
> java.lang.NullPointerException
> 	at org.apache.derby.client.am.PreparedStatement.executeBatchRequestX(Unknown Source)
> 	at org.apache.derby.client.am.PreparedStatement.executeBatchX(Unknown Source)
> 	at org.apache.derby.client.am.PreparedStatement.executeBatch(Unknown Source)
> 	at 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:
> 			parameterMetaData_.clientParamtertype_ = (int[]) parameterTypeList.get(i);
> to this:
> 			if (parameterMetaData_ != null) {
> 				parameterMetaData_.clientParamtertype_ = (int[]) parameterTypeList.get(i);
> 			}
> 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 / collateral 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:\DERBY_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ßrio Java:               acd025
> Diret?rio base do usußrio Java:     D:\Profiles\acd025
> Diret?rio do usußrio 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)
> ------------------------------------------------------

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


[jira] Updated: (DERBY-2112) Nullpointer on executeBatchRequestX when preparedStatement has no parameters

Posted by "Myrna van Lunteren (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2112?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Myrna van Lunteren updated DERBY-2112:
--------------------------------------

    Derby Info: [Patch Available]

> Nullpointer on executeBatchRequestX when preparedStatement has no parameters
> ----------------------------------------------------------------------------
>
>                 Key: DERBY-2112
>                 URL: https://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). 
>            Reporter: Cesar Devera
>         Attachments: DERBY-2112_20070209.diff, Derby2112ReproNPE.java
>
>
> there is a problem when using batch statements without bind parameters (?), with ClientDriver (derbyclient.jar):
> java.lang.NullPointerException
> 	at org.apache.derby.client.am.PreparedStatement.executeBatchRequestX(Unknown Source)
> 	at org.apache.derby.client.am.PreparedStatement.executeBatchX(Unknown Source)
> 	at org.apache.derby.client.am.PreparedStatement.executeBatch(Unknown Source)
> 	at 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:
> 	public static void main(String[] args) throws SQLException {
> 		
> 	    try {
> 	        Class.forName("org.apache.derby.jdbc.ClientDriver" );
> 	    } catch (Exception e) {
> 	        e.printStackTrace();
> 	        return;
> 	    }
> 	    Connection c = DriverManager.getConnection("jdbc:derby://localhost:1527/d:/derby_10/data/mydbtest", "app", "app");
> 	    
> 	    PreparedStatement ps = c.prepareStatement("update teste1 set valor = 8");
> 	    ps2.addBatch();
> 	    
> 	    int j[] = ps.executeBatch();
> 	    System.out.println(j[0]);
> 	    ps.close();
> 	    
> 	    c.close();
> 	}
> this exception is thrown:
> java.lang.NullPointerException
> 	at org.apache.derby.client.am.PreparedStatement.executeBatchRequestX(Unknown Source)
> 	at org.apache.derby.client.am.PreparedStatement.executeBatchX(Unknown Source)
> 	at org.apache.derby.client.am.PreparedStatement.executeBatch(Unknown Source)
> 	at 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:
> 			parameterMetaData_.clientParamtertype_ = (int[]) parameterTypeList.get(i);
> to this:
> 			if (parameterMetaData_ != null) {
> 				parameterMetaData_.clientParamtertype_ = (int[]) parameterTypeList.get(i);
> 			}
> 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 / collateral 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:\DERBY_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ßrio Java:               acd025
> Diret?rio base do usußrio Java:     D:\Profiles\acd025
> Diret?rio do usußrio 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)
> ------------------------------------------------------

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


[jira] Commented: (DERBY-2112) Nullpointer on executeBatchRequestX when preparedStatement has no parameters

Posted by "Myrna van Lunteren (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2112?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12470367 ] 

Myrna van Lunteren commented on DERBY-2112:
-------------------------------------------

Updated stack trace (with trunk at revision 502319), from running an attempt to convert test batchUpdate.java to junit. So, a test already exists, it's just not getting executed with network server currently.
---------------------------------
java.lang.NullPointerException
	at org.apache.derby.client.am.PreparedStatement.executeBatchRequestX(PreparedStatement.java:2264)
	at org.apache.derby.client.am.PreparedStatement.executeBatchX(PreparedStatement.java:2193)
	at org.apache.derby.client.am.PreparedStatement.executeBatch(PreparedStatement.java:1629)
	at org.apache.derbyTesting.functionTests.tests.jdbcapi.BatchUpdateTest.runNoParametersPreparedBatch(BatchUpdateTest.java:1000)
	at org.apache.derbyTesting.functionTests.tests.jdbcapi.BatchUpdateTest.testPreparedStatementBatchUpdatePositive(BatchUpdateTest.java:190)
---------------------------------

> Nullpointer on executeBatchRequestX when preparedStatement has no parameters
> ----------------------------------------------------------------------------
>
>                 Key: DERBY-2112
>                 URL: https://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). 
>            Reporter: Cesar Devera
>         Attachments: Derby2112ReproNPE.java
>
>
> there is a problem when using batch statements without bind parameters (?), with ClientDriver (derbyclient.jar):
> java.lang.NullPointerException
> 	at org.apache.derby.client.am.PreparedStatement.executeBatchRequestX(Unknown Source)
> 	at org.apache.derby.client.am.PreparedStatement.executeBatchX(Unknown Source)
> 	at org.apache.derby.client.am.PreparedStatement.executeBatch(Unknown Source)
> 	at 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:
> 	public static void main(String[] args) throws SQLException {
> 		
> 	    try {
> 	        Class.forName("org.apache.derby.jdbc.ClientDriver" );
> 	    } catch (Exception e) {
> 	        e.printStackTrace();
> 	        return;
> 	    }
> 	    Connection c = DriverManager.getConnection("jdbc:derby://localhost:1527/d:/derby_10/data/mydbtest", "app", "app");
> 	    
> 	    PreparedStatement ps = c.prepareStatement("update teste1 set valor = 8");
> 	    ps2.addBatch();
> 	    
> 	    int j[] = ps.executeBatch();
> 	    System.out.println(j[0]);
> 	    ps.close();
> 	    
> 	    c.close();
> 	}
> this exception is thrown:
> java.lang.NullPointerException
> 	at org.apache.derby.client.am.PreparedStatement.executeBatchRequestX(Unknown Source)
> 	at org.apache.derby.client.am.PreparedStatement.executeBatchX(Unknown Source)
> 	at org.apache.derby.client.am.PreparedStatement.executeBatch(Unknown Source)
> 	at 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:
> 			parameterMetaData_.clientParamtertype_ = (int[]) parameterTypeList.get(i);
> to this:
> 			if (parameterMetaData_ != null) {
> 				parameterMetaData_.clientParamtertype_ = (int[]) parameterTypeList.get(i);
> 			}
> 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 / collateral 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:\DERBY_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ßrio Java:               acd025
> Diret?rio base do usußrio Java:     D:\Profiles\acd025
> Diret?rio do usußrio 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)
> ------------------------------------------------------

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


[jira] Updated: (DERBY-2112) Nullpointer on executeBatchRequestX when preparedStatement has no parameters

Posted by "Kristian Waagan (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-2112?page=all ]

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 failures. I think a patch including a test case for this bug should be created.

> Nullpointer on executeBatchRequestX when preparedStatement has no parameters
> ----------------------------------------------------------------------------
>
>                 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). 
>            Reporter: Cesar Devera
>         Attachments: Derby2112ReproNPE.java
>
>
> there is a problem when using batch statements without bind parameters (?), with ClientDriver (derbyclient.jar):
> java.lang.NullPointerException
> 	at org.apache.derby.client.am.PreparedStatement.executeBatchRequestX(Unknown Source)
> 	at org.apache.derby.client.am.PreparedStatement.executeBatchX(Unknown Source)
> 	at org.apache.derby.client.am.PreparedStatement.executeBatch(Unknown Source)
> 	at 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:
> 	public static void main(String[] args) throws SQLException {
> 		
> 	    try {
> 	        Class.forName("org.apache.derby.jdbc.ClientDriver" );
> 	    } catch (Exception e) {
> 	        e.printStackTrace();
> 	        return;
> 	    }
> 	    Connection c = DriverManager.getConnection("jdbc:derby://localhost:1527/d:/derby_10/data/mydbtest", "app", "app");
> 	    
> 	    PreparedStatement ps = c.prepareStatement("update teste1 set valor = 8");
> 	    ps2.addBatch();
> 	    
> 	    int j[] = ps.executeBatch();
> 	    System.out.println(j[0]);
> 	    ps.close();
> 	    
> 	    c.close();
> 	}
> this exception is thrown:
> java.lang.NullPointerException
> 	at org.apache.derby.client.am.PreparedStatement.executeBatchRequestX(Unknown Source)
> 	at org.apache.derby.client.am.PreparedStatement.executeBatchX(Unknown Source)
> 	at org.apache.derby.client.am.PreparedStatement.executeBatch(Unknown Source)
> 	at 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:
> 			parameterMetaData_.clientParamtertype_ = (int[]) parameterTypeList.get(i);
> to this:
> 			if (parameterMetaData_ != null) {
> 				parameterMetaData_.clientParamtertype_ = (int[]) parameterTypeList.get(i);
> 			}
> 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 / collateral 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:\DERBY_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ßrio Java:               acd025
> Diret?rio base do usußrio Java:     D:\Profiles\acd025
> Diret?rio do usußrio 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)
> ------------------------------------------------------

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

       

[jira] Closed: (DERBY-2112) Nullpointer on executeBatchRequestX when preparedStatement has no parameters

Posted by "Myrna van Lunteren (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2112?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Myrna van Lunteren closed DERBY-2112.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: 10.3.0.0
       Derby Info:   (was: [Patch Available])

I looked at the code again, and I believe this is really ok. So, I updated the BatchUpdateTest.java & committed with revision 505700. See: http://svn.apache.org/viewvc?view=rev&revision=505700.

> Nullpointer on executeBatchRequestX when preparedStatement has no parameters
> ----------------------------------------------------------------------------
>
>                 Key: DERBY-2112
>                 URL: https://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). 
>            Reporter: Cesar Devera
>         Assigned To: Myrna van Lunteren
>             Fix For: 10.3.0.0
>
>         Attachments: DERBY-2112_20070209.diff, Derby2112ReproNPE.java
>
>
> there is a problem when using batch statements without bind parameters (?), with ClientDriver (derbyclient.jar):
> java.lang.NullPointerException
> 	at org.apache.derby.client.am.PreparedStatement.executeBatchRequestX(Unknown Source)
> 	at org.apache.derby.client.am.PreparedStatement.executeBatchX(Unknown Source)
> 	at org.apache.derby.client.am.PreparedStatement.executeBatch(Unknown Source)
> 	at 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:
> 	public static void main(String[] args) throws SQLException {
> 		
> 	    try {
> 	        Class.forName("org.apache.derby.jdbc.ClientDriver" );
> 	    } catch (Exception e) {
> 	        e.printStackTrace();
> 	        return;
> 	    }
> 	    Connection c = DriverManager.getConnection("jdbc:derby://localhost:1527/d:/derby_10/data/mydbtest", "app", "app");
> 	    
> 	    PreparedStatement ps = c.prepareStatement("update teste1 set valor = 8");
> 	    ps2.addBatch();
> 	    
> 	    int j[] = ps.executeBatch();
> 	    System.out.println(j[0]);
> 	    ps.close();
> 	    
> 	    c.close();
> 	}
> this exception is thrown:
> java.lang.NullPointerException
> 	at org.apache.derby.client.am.PreparedStatement.executeBatchRequestX(Unknown Source)
> 	at org.apache.derby.client.am.PreparedStatement.executeBatchX(Unknown Source)
> 	at org.apache.derby.client.am.PreparedStatement.executeBatch(Unknown Source)
> 	at 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:
> 			parameterMetaData_.clientParamtertype_ = (int[]) parameterTypeList.get(i);
> to this:
> 			if (parameterMetaData_ != null) {
> 				parameterMetaData_.clientParamtertype_ = (int[]) parameterTypeList.get(i);
> 			}
> 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 / collateral 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:\DERBY_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ßrio Java:               acd025
> Diret?rio base do usußrio Java:     D:\Profiles\acd025
> Diret?rio do usußrio 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)
> ------------------------------------------------------

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