You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by kr...@apache.org on 2010/04/28 14:45:22 UTC
svn commit: r938972 -
/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/StreamingColumnTest.java
Author: kristwaa
Date: Wed Apr 28 12:45:21 2010
New Revision: 938972
URL: http://svn.apache.org/viewvc?rev=938972&view=rev
Log:
DERBY-4531: Client setCharacterStream closes its Reader argument stream in finalizer
Added a work-around for the issue where the SQLState differs depending on
whether the finalizer has been run or not.
Can be removed when DERBY-4531 has been fixed properly.
Patch file: derby-4531-1a-test_workaround.diff
Modified:
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/StreamingColumnTest.java
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/StreamingColumnTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/StreamingColumnTest.java?rev=938972&r1=938971&r2=938972&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/StreamingColumnTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/StreamingColumnTest.java Wed Apr 28 12:45:21 2010
@@ -1553,6 +1553,14 @@ public class StreamingColumnTest extends
try {
ps.setInt(1, 11);
rowCount += ps.executeUpdate();
+ // The check below is just to detect a change in behavior for the
+ // client driver (this succeeds with the embedded driver due to
+ // a different implementation). With the client driver the source
+ // stream is read twice, whereas the embedded driver will "cache"
+ // the stream content and can thus use it for a second insert.
+ if (usingDerbyNetClient()) {
+ fail("Expected second executeUpdate with client driver to fail");
+ }
} catch (SQLException sqle) {
if (usingDerbyNetClient()) {
// DERBY-4315. This SQLState is wrong for client.
@@ -1562,9 +1570,15 @@ public class StreamingColumnTest extends
// Remove special case when DERBY-4315
// is fixed or at least throw XJ001 and
// avoid bad data insert.
- assertSQLState("XN017", sqle);
- // rollback the bad insert.
- rollback();
+
+ // DERBY-4531: Depending on whether the finalizer has been run
+ // or not, the SQLState will differ.
+ // Don't care about this here, accept both.
+ String expectedState = "XN017";
+ if (sqle.getSQLState().equals("XN014")) {
+ expectedState = "XN014";
+ }
+ assertSQLState(expectedState, sqle);
} else {
println("UNEXPECTED EXCEPTION - streams cannot be "
+ "re-used but in case of varchar, stream is materialized the"