Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-6373

NPE in Statement.getWarnings()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 10.10.1.1
    • 10.10.2.0, 10.11.1.1
    • Network Client
    • None
    • JDK 7
    • Repro attached
    • Regression

    Description

      After executing a batch in a prepared statement, I call getWarnings() on that statement. A NPE is thrown.

      at org.apache.derby.client.am.SqlWarning.getSQLWarning(SqlWarning.java:117)
      at org.apache.derby.client.am.Statement.getWarnings(Statement.java:862)
      ...

      Addtional info:

      In a unit test, which worked for 10.8.2.2, a batch of 4 deletes were issued.
      They were expected to fail, as there were no matching rows. There was a SQLWarning chain in the statement, 4 deep, one for each row that failed
      with text:

      No row was found for FETCH, UPDATE or DELETE; or the result of a query is an empty table.

      However, each warning had 'nextException_' null. When attempting to chain on the exceptions when building the warning, a NPE is thrown.

      Perhaps something like changing line 105 of SqlWarning.java to

      if ( nextWarning_ != null && nextException_ != null )

      Of course perhaps there's always supposed to be a corresponding exception.

      Attachments

        1. d6373-1a.diff
          3 kB
          Knut Anders Hatlen
        2. D6373.java
          0.5 kB
          Knut Anders Hatlen

        Issue Links

          Activity

            People

              knutanders Knut Anders Hatlen
              glennmcg Glenn McGregor
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: