Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6462470

java.lang.NullPointerException from query object update procedure

    XMLWordPrintable

    Details

    • Subcomponent:
    • Introduced In Build:
      b95
    • Introduced In Version:
      6
    • Resolved In Build:
      b98
    • CPU:
      x86
    • OS:
      linux_2.6
    • Verification:
      Verified

      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.apache.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.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
              at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
              at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
              at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
              at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)
              at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source)
              at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)
              at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source)
              at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source)
              at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown Source)
              at org.apache.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)

        Attachments

          Activity

            People

            Assignee:
            kssaxena Kshitiz Saxena (Inactive)
            Reporter:
            bjohnsen Bernt Marius Johnsen
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: