db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kathey Marsden <kmarsdende...@sbcglobal.net>
Subject Re: NullPointerException caused by query
Date Fri, 13 Jul 2007 16:29:56 GMT
Kasper, Kay wrote:
>
> Hi,
>
>  
>
> i got an NullPointerException using the test care from below.
>
I can reproduce this and get the stack trace below.  Can you please file 
a Jira issue:
http://db.apache.org/derby/DerbyBugGuidelines.html

ERROR 38000: The exception 'java.lang.NullPointerException' was thrown 
while evaluating an expression.
java.sql.SQLException: The exception 'java.lang.NullPointerException' 
was thrown while evaluating an expression.
        at 
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
        at 
org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:88)
        at org.apache.derby.impl.jdbc.Util.seeNextException(Util.java:224)
        at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:398)
        at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
        at 
org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:1572)
        at 
org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
        at 
org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1293)
        at 
org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:596)
        at 
org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:528)
        at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:330)
        at 
org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:522)
        at 
org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:364)
        at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:262)
        at org.apache.derby.impl.tools.ij.Main.go(Main.java:215)
        at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:181)
        at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
        at org.apache.derby.tools.ij.main(ij.java:71)
Caused by: java.sql.SQLException: Java exception: ': 
java.lang.NullPointerException'.
        at 
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
        at 
org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:88)
        at org.apache.derby.impl.jdbc.Util.javaException(Util.java:245)
        at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
        ... 15 more
Caused by: java.lang.NullPointerException
        at org.apache.derby.iapi.types.SQLChar.equals(SQLChar.java:1433)
        at 
org.apache.derby.exe.ac601a400fx0113xc068x7fb8x0000001a17802.e4(Unknown 
Source)
        at 
org.apache.derby.impl.services.reflect.DirectCall.invoke(ReflectGeneratedClass.java:147)
        at 
org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRowCore(ProjectRestrictResultSet.java:267)
        at 
org.apache.derby.impl.sql.execute.NestedLoopJoinResultSet.getNextRowCore(NestedLoopJoinResultSet.java:116)
        at 
org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRowCore(ProjectRestrictResultSet.java:255)
        at 
org.apache.derby.impl.sql.execute.NormalizeResultSet.getNextRowCore(NormalizeResultSet.java:186)
        at 
org.apache.derby.impl.sql.execute.DMLWriteResultSet.getNextRowCore(DMLWriteResultSet.java:125)
        at 
org.apache.derby.impl.sql.execute.InsertResultSet.open(InsertResultSet.java:496)
        at 
org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:370)
        at 
org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1203)
        ... 10 more
ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
java.sql.SQLException: Java exception: ': java.lang.NullPointerException'.
        at 
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
        at 
org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:88)
        at org.apache.derby.impl.jdbc.Util.javaException(Util.java:245)
        at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:403)
        at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:398)
        at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:346)
        at 
org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:1572)
        at 
org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:81)
        at 
org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1293)
        at 
org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:596)
        at 
org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:528)
        at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:330)
        at 
org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:522)
        at 
org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:364)
        at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:262)
        at org.apache.derby.impl.tools.ij.Main.go(Main.java:215)
        at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:181)
        at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
        at org.apache.derby.tools.ij.main(ij.java:71)
Caused by: java.lang.NullPointerException
        at org.apache.derby.iapi.types.SQLChar.equals(SQLChar.java:1433)
        at 
org.apache.derby.exe.ac601a400fx0113xc068x7fb8x0000001a17802.e4(Unknown 
Source)
        at 
org.apache.derby.impl.services.reflect.DirectCall.invoke(ReflectGeneratedClass.java:147)
        at 
org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRowCore(ProjectRestrictResultSet.java:267)
        at 
org.apache.derby.impl.sql.execute.NestedLoopJoinResultSet.getNextRowCore(NestedLoopJoinResultSet.java:116)
        at 
org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.getNextRowCore(ProjectRestrictResultSet.java:255)
        at 
org.apache.derby.impl.sql.execute.NormalizeResultSet.getNextRowCore(NormalizeResultSet.java:186)
        at 
org.apache.derby.impl.sql.execute.DMLWriteResultSet.getNextRowCore(DMLWriteResultSet.java:125)
        at 
org.apache.derby.impl.sql.execute.InsertResultSet.open(InsertResultSet.java:496)
        at 
org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:370)
        at 
org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1203)
        ... 10 more
ij>


>  
>
> I'm working with Derby 10.2.2.
>
>  
>
> The problem seems to be caused by the expression f.fkt_name in the 
> exists-query.
>
>  
>
> I hope that helps to fix the problem.
>
>  
>
> Kay Kasper
>
>  
>
>  
>
>  
>
> error message ----------------------------------
>
>  
>
> Error: java.sql.SQLException: Bei der Auswertung eines Ausdrucks wurde 
> die Ausnahme 'java.lang.NullPointerException' ausgelöst. SQLSTATE: 
> XJ001: Java-Ausnahme: ': java.lang.NullPointerException'., SQL State: 
> 38000, Error Code: -1
>
> Error occured in:
>
> insert into rechte_programm (rp_id, rp_r_id, rp_name, rp_mod_name, 
> rp_typ, rp_erstellt_um, rp_erstellt_von, rp_geaendert_um, 
> rp_geaendert_von) (select 0 + r.r_id + 1, r.r_id, 'Funktion ' || 
> f.fkt_name, f.fkt_mod_name, 'FKT', CURRENT_TIMESTAMP, 'SystemBU', 
> CURRENT_TIMESTAMP, 'SystemBU' from funktionalitaeten f, rechte r where 
> not exists (select 'X' from rechte_programm rp where rp.rp_r_id = 
> r.r_id and rp.rp_name = 'Funktion ' || f.fkt_name))
>
>  
>
> test case ---------------------------------------
>
>  
>
> CREATE TABLE  RECHTE
>
> (
>
>  R_ID  BIGINT NOT NULL,
>
>  RZ_BEZ_TXT_ID  BIGINT NOT NULL
>
> )
>
> ;
>
> CREATE TABLE  RECHTE_PROGRAMM
>
> (
>
>  RP_ID  BIGINT NOT NULL,
>
>  RP_R_ID  BIGINT NOT NULL,
>
>  RP_NAME  VARCHAR (200) NOT NULL,
>
>  RP_MOD_NAME  VARCHAR (2) NOT NULL,
>
>  RP_TYP  VARCHAR (3) NOT NULL,
>
>  RP_ERSTELLT_UM  TIMESTAMP  NOT NULL,
>
>  RP_ERSTELLT_VON  VARCHAR (20) NOT NULL,
>
>  RP_GEAENDERT_UM  TIMESTAMP  NOT NULL,
>
>  RP_GEAENDERT_VON  VARCHAR (20) NOT NULL
>
> )
>
> ;
>
> CREATE TABLE  FUNKTIONALITAETEN
>
> (
>
>  FKT_NAME  VARCHAR (300) NOT NULL,
>
>  FKT_MOD_NAME  VARCHAR (2) NOT NULL,
>
>  FKT_BEZ_TXT_ID  BIGINT NOT NULL,
>
>  FKT_BESCHR_TXT_ID  BIGINT
>
> )
>
> ;
>
> ALTER TABLE  RECHTE
>
> ADD CONSTRAINT  PK_RECHTE  PRIMARY KEY
>
> (
>
>  R_ID
>
> )
>
> ;
>
> ALTER TABLE  RECHTE
>
> ADD CONSTRAINT  RECHTE_UK1  UNIQUE
>
> (
>
>  RZ_BEZ_TXT_ID
>
> )
>
> ;
>
> ALTER TABLE  RECHTE_PROGRAMM
>
> ADD CONSTRAINT  PK_RECHTE_PROGRAMM  PRIMARY KEY
>
> (
>
>  RP_ID
>
> )
>
> ;
>
> ALTER TABLE  RECHTE_PROGRAMM
>
> ADD CONSTRAINT  RECHTE_PROGRAMM_UK1  UNIQUE
>
> (
>
>  RP_R_ID ,
>
>  RP_NAME ,
>
>  RP_TYP
>
> )
>
> ;
>
> ALTER TABLE  FUNKTIONALITAETEN
>
> ADD CONSTRAINT  FUNKTIONALITAETEN_PK1  PRIMARY KEY
>
> (
>
>  FKT_NAME
>
> )
>
> ;
>
> ALTER TABLE  RECHTE_PROGRAMM
>
> ADD CONSTRAINT  RECHTE_PROGRAMM_RECHTE_FK1  FOREIGN KEY
>
> (
>
>  RP_R_ID
>
> )
>
> REFERENCES  RECHTE
>
> (
>
>  R_ID
>
> )
>
> ;
>
> insert into rechte (r_id, rz_bez_txt_id) values (0,4)
>
> ;
>
> insert into funktionalitaeten (fkt_name, fkt_mod_name, fkt_bez_txt_id, 
> fkt_beschr_txt_id) values ('wauplus.forms.admin.CALENDAR','DF',2000,2018)
>
> ;
>
> insert into rechte_programm (rp_id, rp_r_id, rp_name, rp_mod_name, 
> rp_typ, rp_erstellt_um, rp_erstellt_von, rp_geaendert_um, 
> rp_geaendert_von) (select 0 + r.r_id + 1, r.r_id, 'Funktion ' || 
> f.fkt_name, f.fkt_mod_name, 'FKT', CURRENT_TIMESTAMP, 'SystemBU', 
> CURRENT_TIMESTAMP, 'SystemBU' from funktionalitaeten f, rechte r where 
> not exists (select 'X' from rechte_programm rp where rp.rp_r_id = 
> r.r_id and rp.rp_name = 'Funktion ' || f.fkt_name))
>
> ;
>
> drop table rechte_programm
>
> ;
>
> drop table funktionalitaeten
>
> ;
>
> drop table rechte
>
> ;
>
>
>
>
> ckc ag
> Sitz:
> Industriestr. 10
> 38110 Braunschweig 	Telefon 05307 / 80 20 0
> Telefax 05307 / 80 20 444 	http://www.ckc.de
> Amtsgericht Braunschweig
> HRB 5405
> 	Vorstand:
> H.-G. Christian Krentel
> (Vorsitzender) 	Aufsichtsrat:
> Dr. Heinz-Werner Weinrich
> (Vorsitzender)
> Hans Bodenstein
> Dr. Rita Schulz
>
>
>
>



Mime
View raw message