[
https://issues.apache.org/jira/browse/DERBY-6373?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13797265#comment-13797265
]
Glenn McGregor commented on DERBY-6373:
---------------------------------------
All of the stack trace that's in derby code is present in the issue. The next
frame points at the spot in my code that invokes getWarnings on a
PreparedStatement.
A runnable unit test would take a fair bit of work to generate, as the actual
code would be hard to extract.
However, here's some pseudo-code
open connection
create preparedStatement --- DELETE FROM testJdbcAcct WHERE NAS_IP_Address = ?
AND NAS_Port = ? AND Acct_Session_Id = ?
loop
invoke ps.set on args
ps.addBatch
endloop
ps.executeBatch()
ps.getWarnings();
All of the deletes were intended to fail for this test.
> NPE in Statement.getWarnings()
> ------------------------------
>
> Key: DERBY-6373
> URL: https://issues.apache.org/jira/browse/DERBY-6373
> Project: Derby
> Issue Type: Bug
> Affects Versions: 10.10.1.1
> Environment: JDK 7
> Reporter: Glenn McGregor
> Priority: Minor
>
> 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.
--
This message was sent by Atlassian JIRA
(v6.1#6144)