Thanks for the review on this patch.
I've incorporated all the suggestions and increased the amount of test logic as far as comparing the original exception with the serialized one.
As part of the test logic in SqlExceptionTest.java, I'm now also using a batch to execute several batch elements and hence generate a few chained / nested exceptions.
I've tested under 1.3, 1.4, 1.5 & 1.6 Java runtime environments as well as under DerbyNetClient and DerbyNet frameworks as well as well as no framework.
I have tested and called getMessage() several times for each of the serialized exceptions generated from the BatchUpdateException and I'm not getting the behavior you described - I get the exact same message than the original exception with no added string. The comparison of both the original and the serialized exceptions is thoroughly tested in BaseJDBCTestCase.java:assertSQLExceptionEquals() and that includes any chained exceptions.
Hence, I'm not sure how you got into the case you described and I would appreciate if you could post the logic for the test you ran as well as your java and platform environment.
In the meantime, I have attached the new changes.