Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6462470
Votes 0
Synopsis java.lang.NullPointerException from query object update procedure
Category jdbc:eod
Reported Against
Release Fixed mustang(b98)
State 11-Closed, Verified, bug
Priority: 2-High
Related Bugs
Submit Date 22-AUG-2006
Description
The following code (Run with Java DB 10.2.1.0 beta):

import java.sql.*;

public class EODExceptionBug
{
    interface PersonQ extends BaseQuery {
        @java.sql.Update(sql="create table tab (i integer)")
            int createTable();
    }
    
    static public void main(String []args) 
        throws Exception
    {
	String driver = "org. customer .derby.jdbc.EmbeddedDriver";
	String url = "jdbc:derby:/tmp/eodbug;create=true";
        
        Connection conn = DriverManager.getConnection(url);
        
        PersonQ pq = conn.createQueryObject(PersonQ.class);

        System.out.println("First create");
        pq.createTable();
        System.out.println("Second create");
        try {
            pq.createTable();
        } catch (SQLRuntimeException e) {
            System.out.println("Should end up here, but don't");
        }
    }
}


Gives the following response:
First create
Second create
java.sql.SQLException: Table/View 'TAB' already exists in Schema 'APP'.
        at org. customer .derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
        at org. customer .derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
        at org. customer .derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
        at org. customer .derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
        at org. customer .derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)
        at org. customer .derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source)
        at org. customer .derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)
        at org. customer .derby.impl.jdbc.ConnectionChild.handleException(Unknown Source)
        at org. customer .derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source)
        at org. customer .derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown Source)
        at org. customer .derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown Source)
        at com.sun.sql.QueryObjectGeneratorImpl.getUpdateImpl(QueryObjectGeneratorImpl.java:543)
        at com.sun.sql.QueryObjectGeneratorImpl.access$200(QueryObjectGeneratorImpl.java:24)
        at com.sun.sql.QueryObjectGeneratorImpl$3.run(QueryObjectGeneratorImpl.java:244)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.sql.QueryObjectGeneratorImpl.invoke(QueryObjectGeneratorImpl.java:239)
        at $Proxy0.createTable(Unknown Source)
        at EODExceptionBug.main(EODExceptionBug.java:24)
Caused by: java.sql.SQLException: Table/View 'TAB' already exists in Schema 'APP'.
        ... 18 more
Exception in thread "main" java.lang.NullPointerException
        at $Proxy0.createTable(Unknown Source)
        at EODExceptionBug.main(EODExceptionBug.java:24)
Posted Date : 2006-08-22 12:19:21.0
Work Around
N/A
Evaluation
The exceptions were caught and there stack trace were being printed instead of throwing those exceptions further.
Posted Date : 2006-08-25 12:35:04.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang