[jira] Commented: (DERBY-4122) ClassCastException in SQLClob when running in soft upgrade mode (10.4.2.0 -> 10.5.1.0)

2009-04-06 Thread Knut Anders Hatlen (JIRA)

[ 
https://issues.apache.org/jira/browse/DERBY-4122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12696135#action_12696135
 ] 

Knut Anders Hatlen commented on DERBY-4122:
---

Thanks. Keeping the EOFException for consistency with the other methods in the 
class sounds OK to me.

> ClassCastException in SQLClob when running in soft upgrade mode (10.4.2.0 -> 
> 10.5.1.0)
> --
>
> Key: DERBY-4122
> URL: https://issues.apache.org/jira/browse/DERBY-4122
> Project: Derby
>  Issue Type: Bug
>  Components: Regression Test Failure
>Affects Versions: 10.5.1.0
> Environment: Windows Vista 64, Sun JDK 1.6.0_10, Junit 3.8.2
>Reporter: Suran Jayathilaka
>Assignee: Kristian Waagan
>Priority: Blocker
> Fix For: 10.5.1.1, 10.6.0.0
>
> Attachments: derby-4122-1a-incorrect_stream_positioning.diff, 
> derby-4122-2a-bc4btest.diff, derby-4122-3a-classcast_fix.diff, 
> derby-4122-3b-classcast_fix.diff, 
> derby-4122-4a-classcast_fix_mark_reset.diff, 
> derby-4122-4b-classcast_fix_mark_reset.diff, 
> derby-4122-4c-classcast_fix_mark_reset.diff
>
>
> This bug was found when doing soft upgrade testing from Derby version 
> 10.4.2.0 to 10.5.1.0 (RC1)
> Steps followed are as follows.
> 1. Run setEmbeddedCP.bat from version 10.4.2.0's bin folder
> 2. In a test folder run ij
> 3. create system/wombat database.
> ij> connect 'jdbc:derby:system/wombat;create=true';
> 4. exit ij
> 5. Copy the 10.5.1.0 derby jars (from lib folder) and the derbyTesting.jar 
> from 10.4.2.0 to the test folder and set classpath with them (including junit 
> and ORO)
> 6. Run suites.All 
>  java -Xmx512M -Xms512M -Dderby.tests.trace=true junit.textui.TestRunner 
> org.apache.derbyTesting.functionTests.suites.All
> Result:
> Tests run: 10479,  Failures: 56,  Errors: 34
> The exception stack trace from a failed test follows.
> -
> 3) 
> testClobInTriggerTable(org.apache.derbyTesting.functionTests.tests.lang.TriggerTest)java.sql.SQLException:
>  Java exception: 'org.apache.derby.iapi.types.ReaderToUTF8Stream cannot be 
> cast to org.apache.derby.iapi.types.Resetable: java.lang.ClassCastException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.javaException(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.execute(Unknown 
> Source)
>   at 
> org.apache.derbyTesting.functionTests.tests.lang.TriggerTest.testClobInTriggerTable(TriggerTest.java:529)
>   at 
> org.apache.derbyTesting.functionTests.tests.lang.TriggerTest.testClobInTriggerTable(TriggerTest.java:451)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>   at 
> org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:102)
>   at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>   at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
>   at junit.extensions.TestSetup.run(TestSetup.java:25)
>   at 
> org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
> Caused by: java.sql.SQLException: Java exception: 
> 'org.apache.derby.iapi.types.ReaderToUTF8Stream cannot be cast to 
> org.apache.derby.iapi.types.Resetable: java.lang.ClassCastException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown
>  Source)
>   ... 39 more
> Caused by: java.lang.ClassCastException: 
> org.apache.derby.iapi.types.ReaderToUTF8Stream cannot be cast to 
> org.apache.derby.iapi.types.Resetable
>   at org.apache.derby.iapi.types.SQLClob.rewindStream(Unknown Source)
>   at org.apache.derby.iapi.types.SQLClob.readExternal(Unknown Sour

[jira] Commented: (DERBY-4122) ClassCastException in SQLClob when running in soft upgrade mode (10.4.2.0 -> 10.5.1.0)

2009-04-05 Thread Knut Anders Hatlen (JIRA)

[ 
https://issues.apache.org/jira/browse/DERBY-4122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12695922#action_12695922
 ] 

Knut Anders Hatlen commented on DERBY-4122:
---

4b looks good to me. Two minor comments:

- SQLState.LANG_STREAM_MARK_UNSET_OR_EXCEEDED should be moved to MessageId, 
since it's not used in an SQLException

- I don't think EOFException should be thrown by reset() when the stream is 
closed, as stream closed does not mean that EOF has been reached. What about a 
plain IOException with the message from SQLState.LANG_STREAM_CLOSED?

> ClassCastException in SQLClob when running in soft upgrade mode (10.4.2.0 -> 
> 10.5.1.0)
> --
>
> Key: DERBY-4122
> URL: https://issues.apache.org/jira/browse/DERBY-4122
> Project: Derby
>  Issue Type: Bug
>  Components: Regression Test Failure
>Affects Versions: 10.5.1.0
> Environment: Windows Vista 64, Sun JDK 1.6.0_10, Junit 3.8.2
>Reporter: Suran Jayathilaka
>Assignee: Kristian Waagan
>Priority: Blocker
> Attachments: derby-4122-1a-incorrect_stream_positioning.diff, 
> derby-4122-2a-bc4btest.diff, derby-4122-3a-classcast_fix.diff, 
> derby-4122-3b-classcast_fix.diff, 
> derby-4122-4a-classcast_fix_mark_reset.diff, 
> derby-4122-4b-classcast_fix_mark_reset.diff
>
>
> This bug was found when doing soft upgrade testing from Derby version 
> 10.4.2.0 to 10.5.1.0 (RC1)
> Steps followed are as follows.
> 1. Run setEmbeddedCP.bat from version 10.4.2.0's bin folder
> 2. In a test folder run ij
> 3. create system/wombat database.
> ij> connect 'jdbc:derby:system/wombat;create=true';
> 4. exit ij
> 5. Copy the 10.5.1.0 derby jars (from lib folder) and the derbyTesting.jar 
> from 10.4.2.0 to the test folder and set classpath with them (including junit 
> and ORO)
> 6. Run suites.All 
>  java -Xmx512M -Xms512M -Dderby.tests.trace=true junit.textui.TestRunner 
> org.apache.derbyTesting.functionTests.suites.All
> Result:
> Tests run: 10479,  Failures: 56,  Errors: 34
> The exception stack trace from a failed test follows.
> -
> 3) 
> testClobInTriggerTable(org.apache.derbyTesting.functionTests.tests.lang.TriggerTest)java.sql.SQLException:
>  Java exception: 'org.apache.derby.iapi.types.ReaderToUTF8Stream cannot be 
> cast to org.apache.derby.iapi.types.Resetable: java.lang.ClassCastException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.javaException(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.execute(Unknown 
> Source)
>   at 
> org.apache.derbyTesting.functionTests.tests.lang.TriggerTest.testClobInTriggerTable(TriggerTest.java:529)
>   at 
> org.apache.derbyTesting.functionTests.tests.lang.TriggerTest.testClobInTriggerTable(TriggerTest.java:451)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>   at 
> org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:102)
>   at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>   at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
>   at junit.extensions.TestSetup.run(TestSetup.java:25)
>   at 
> org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
> Caused by: java.sql.SQLException: Java exception: 
> 'org.apache.derby.iapi.types.ReaderToUTF8Stream cannot be cast to 
> org.apache.derby.iapi.types.Resetable: java.lang.ClassCastException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown
>  Source)
>   ... 39 more
> Caused by: java.lang.ClassCastException: 
> org.apache.derby.iapi.types.ReaderToUTF8Stream cannot be cast to

[jira] Commented: (DERBY-4122) ClassCastException in SQLClob when running in soft upgrade mode (10.4.2.0 -> 10.5.1.0)

2009-04-02 Thread Kristian Waagan (JIRA)

[ 
https://issues.apache.org/jira/browse/DERBY-4122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12694932#action_12694932
 ] 

Kristian Waagan commented on DERBY-4122:


Knut, I'm working on a new patch. The following items (taken from your 
comments) will be addressed:
 o remove BUFSIZE (and adjust code where required)
 o remove shrink logic
 o move and/or add more comments about the magic number 6
 o copy optimization
 o NPE possibility in root cause determination code
 o rewrite if in SQLClob
 
Then some comments on some of the other items:
> Do we need to separate between MARK_UNSET and EXCEEDED_MARK_LIMIT?
No, only for more specific error reporting, I think.

> In readExternal() we now subtract the header length from the byte length 
> before we pass it to super.readExternal(). As far as I can see, this is a 
> code path taken in normal operation too, not only in soft upgrade. Was this a 
> bug that was possible to see when not running with a soft upgraded db? 
No, it should not happen in a fresh 10.5 database. It can happen in soft and 
hard upgrade.
The reason why it doesn't happen in a fresh database, is that all lengths are 
stored as character counts.

> Both SQLClob and ReaderToUTF8Stream have code where they use Math.max(0, x-y) 
> to prevent that an argument goes negative. I'm not sure I see why the 
> arguments will go negative, and isn't there a chance that we're hiding real 
> bugs this way?
The argument in SQLClob will go negative when the stored length in the byte 
header is 0. Since the header length is still two in this case, we get 0 - 2 = 
-2. There is a slight chance we may hide a bug with this, but the bug will be 
revealed when we actually try to read the value. In principle, what we're 
saying here is that if the length we obtained from the header is negative, 
assume it is unknown.
I can try to rewrite the check so that it is easier to understand, and add some 
comments.

In ReaderToUTF8Stream, the variable blen will be -1 the first time we fill the 
buffer. Again, I'll rewrite or/and add a comment to make it easier to read the 
code.

> ClassCastException in SQLClob when running in soft upgrade mode (10.4.2.0 -> 
> 10.5.1.0)
> --
>
> Key: DERBY-4122
> URL: https://issues.apache.org/jira/browse/DERBY-4122
> Project: Derby
>  Issue Type: Bug
>  Components: Regression Test Failure
>Affects Versions: 10.5.1.0
> Environment: Windows Vista 64, Sun JDK 1.6.0_10, Junit 3.8.2
>Reporter: Suran Jayathilaka
>Assignee: Kristian Waagan
>Priority: Blocker
> Attachments: derby-4122-1a-incorrect_stream_positioning.diff, 
> derby-4122-2a-bc4btest.diff, derby-4122-3a-classcast_fix.diff, 
> derby-4122-3b-classcast_fix.diff, derby-4122-4a-classcast_fix_mark_reset.diff
>
>
> This bug was found when doing soft upgrade testing from Derby version 
> 10.4.2.0 to 10.5.1.0 (RC1)
> Steps followed are as follows.
> 1. Run setEmbeddedCP.bat from version 10.4.2.0's bin folder
> 2. In a test folder run ij
> 3. create system/wombat database.
> ij> connect 'jdbc:derby:system/wombat;create=true';
> 4. exit ij
> 5. Copy the 10.5.1.0 derby jars (from lib folder) and the derbyTesting.jar 
> from 10.4.2.0 to the test folder and set classpath with them (including junit 
> and ORO)
> 6. Run suites.All 
>  java -Xmx512M -Xms512M -Dderby.tests.trace=true junit.textui.TestRunner 
> org.apache.derbyTesting.functionTests.suites.All
> Result:
> Tests run: 10479,  Failures: 56,  Errors: 34
> The exception stack trace from a failed test follows.
> -
> 3) 
> testClobInTriggerTable(org.apache.derbyTesting.functionTests.tests.lang.TriggerTest)java.sql.SQLException:
>  Java exception: 'org.apache.derby.iapi.types.ReaderToUTF8Stream cannot be 
> cast to org.apache.derby.iapi.types.Resetable: java.lang.ClassCastException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.javaException(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

[jira] Commented: (DERBY-4122) ClassCastException in SQLClob when running in soft upgrade mode (10.4.2.0 -> 10.5.1.0)

2009-04-02 Thread Knut Anders Hatlen (JIRA)

[ 
https://issues.apache.org/jira/browse/DERBY-4122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12694918#action_12694918
 ] 

Knut Anders Hatlen commented on DERBY-4122:
---

SQLClob.java:

The approach seems fine to me. Some more detailed comments:

- Won't the code below throw NPE if ioe.getCause() returns null?
Initializing rootCause to ioe would be safer, I think, and still do the right 
thing.

+Throwable rootCause = ioe.getCause();
+while (rootCause.getCause() != null) {
+rootCause = rootCause.getCause();
+}

- Perhaps we should remove the instanceof check in the code below and remove 
the else branch? I think the ClassCastException we would get then is more 
informative than "Unable to reset stream" (and it saves us one translation :)

+} else if (stream instanceof Resetable) {
+// We have a store stream.
+rewindStream(hdrInfo.headerLength());
+} else {
+throw new IOException("Unable to reset stream");
+}

- In readExternal() we now subtract the header length from the byte length 
before we pass it to super.readExternal(). As far as I can see, this is a code 
path taken in normal operation too, not only in soft upgrade. Was this a bug 
that was possible to see when not running with a soft upgraded db?

- Both SQLClob and ReaderToUTF8Stream have code where they use Math.max(0, x-y) 
to prevent that an argument goes negative. I'm not sure I see why the arguments 
will go negative, and isn't there a chance that we're hiding real bugs this 
way? It would be good if there at least was a comment stating which conditions 
that may make the result negative, so that it is easier to see that it is OK to 
use 0 in those cases.

> ClassCastException in SQLClob when running in soft upgrade mode (10.4.2.0 -> 
> 10.5.1.0)
> --
>
> Key: DERBY-4122
> URL: https://issues.apache.org/jira/browse/DERBY-4122
> Project: Derby
>  Issue Type: Bug
>  Components: Regression Test Failure
>Affects Versions: 10.5.1.0
> Environment: Windows Vista 64, Sun JDK 1.6.0_10, Junit 3.8.2
>Reporter: Suran Jayathilaka
>Assignee: Kristian Waagan
>Priority: Blocker
> Attachments: derby-4122-1a-incorrect_stream_positioning.diff, 
> derby-4122-2a-bc4btest.diff, derby-4122-3a-classcast_fix.diff, 
> derby-4122-3b-classcast_fix.diff, derby-4122-4a-classcast_fix_mark_reset.diff
>
>
> This bug was found when doing soft upgrade testing from Derby version 
> 10.4.2.0 to 10.5.1.0 (RC1)
> Steps followed are as follows.
> 1. Run setEmbeddedCP.bat from version 10.4.2.0's bin folder
> 2. In a test folder run ij
> 3. create system/wombat database.
> ij> connect 'jdbc:derby:system/wombat;create=true';
> 4. exit ij
> 5. Copy the 10.5.1.0 derby jars (from lib folder) and the derbyTesting.jar 
> from 10.4.2.0 to the test folder and set classpath with them (including junit 
> and ORO)
> 6. Run suites.All 
>  java -Xmx512M -Xms512M -Dderby.tests.trace=true junit.textui.TestRunner 
> org.apache.derbyTesting.functionTests.suites.All
> Result:
> Tests run: 10479,  Failures: 56,  Errors: 34
> The exception stack trace from a failed test follows.
> -
> 3) 
> testClobInTriggerTable(org.apache.derbyTesting.functionTests.tests.lang.TriggerTest)java.sql.SQLException:
>  Java exception: 'org.apache.derby.iapi.types.ReaderToUTF8Stream cannot be 
> cast to org.apache.derby.iapi.types.Resetable: java.lang.ClassCastException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.javaException(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.execute(Unknown 
> Source)
>   at 
> org.apache.derbyTesting.functionTests.tests.lang.TriggerTest.testClobInTriggerTable(TriggerTest.java:529)
>   at 
> org.apache.derbyTesting.functionTests.tests.lang.TriggerTe

[jira] Commented: (DERBY-4122) ClassCastException in SQLClob when running in soft upgrade mode (10.4.2.0 -> 10.5.1.0)

2009-04-02 Thread Knut Anders Hatlen (JIRA)

[ 
https://issues.apache.org/jira/browse/DERBY-4122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12694908#action_12694908
 ] 

Knut Anders Hatlen commented on DERBY-4122:
---

I agree that it sounds better to remove the bytesPeekedAt code since we are 
able to control which streams are passed in and can make sure that they 
implement one of the reset interfaces.

I haven't reviewed the full patch yet, only the ReaderToUTF8Stream part. Here 
are my comments:

- Since the buffer is not of constant size, I think we should remove the 
BUFSIZE constant so that no one incorrectly uses it instead of buffer.length. 
In fact, I think the available() method will return the wrong result now 
because it uses BUFSIZE.

- Do we need to separate between MARK_UNSET and EXCEEDED_MARK_LIMIT? Seems like 
we can get away with using MARK_UNSET in both cases and get slightly simpler 
code, and one less error message to internationalize (the message for the new 
IOException should be internationalized, shouldn't it?)

- I think I would have removed the shrink logic in fillBuffer(). It's probably 
going to end up as code that's never called, so I don't think the benefit 
(potentially release memory earlier if mark() is called with a really large 
argument) justifies the extra code.

- Should there be a comment and/or constant for the magic number 6 in 
fillBuffer()? I see that there is a comment in the existing code, but it is 
further down, so I scratched my head for a while trying to understand it before 
I got to that comment.

- One potential optimization (not needed in the first increment, but it's so 
simple that it's probably worth adding it later): When we allocate a new 
buffer, we could check if buffer.length <= (readAheadLimit + 6), and if it is, 
we can just reuse the old buffer. If oldBuf and buffer point to the same array, 
the call to arraycopy() will just shift the bytes to the left and free space at 
the right side of the array.

> ClassCastException in SQLClob when running in soft upgrade mode (10.4.2.0 -> 
> 10.5.1.0)
> --
>
> Key: DERBY-4122
> URL: https://issues.apache.org/jira/browse/DERBY-4122
> Project: Derby
>  Issue Type: Bug
>  Components: Regression Test Failure
>Affects Versions: 10.5.1.0
> Environment: Windows Vista 64, Sun JDK 1.6.0_10, Junit 3.8.2
>Reporter: Suran Jayathilaka
>Assignee: Kristian Waagan
>Priority: Blocker
> Attachments: derby-4122-1a-incorrect_stream_positioning.diff, 
> derby-4122-2a-bc4btest.diff, derby-4122-3a-classcast_fix.diff, 
> derby-4122-3b-classcast_fix.diff, derby-4122-4a-classcast_fix_mark_reset.diff
>
>
> This bug was found when doing soft upgrade testing from Derby version 
> 10.4.2.0 to 10.5.1.0 (RC1)
> Steps followed are as follows.
> 1. Run setEmbeddedCP.bat from version 10.4.2.0's bin folder
> 2. In a test folder run ij
> 3. create system/wombat database.
> ij> connect 'jdbc:derby:system/wombat;create=true';
> 4. exit ij
> 5. Copy the 10.5.1.0 derby jars (from lib folder) and the derbyTesting.jar 
> from 10.4.2.0 to the test folder and set classpath with them (including junit 
> and ORO)
> 6. Run suites.All 
>  java -Xmx512M -Xms512M -Dderby.tests.trace=true junit.textui.TestRunner 
> org.apache.derbyTesting.functionTests.suites.All
> Result:
> Tests run: 10479,  Failures: 56,  Errors: 34
> The exception stack trace from a failed test follows.
> -
> 3) 
> testClobInTriggerTable(org.apache.derbyTesting.functionTests.tests.lang.TriggerTest)java.sql.SQLException:
>  Java exception: 'org.apache.derby.iapi.types.ReaderToUTF8Stream cannot be 
> cast to org.apache.derby.iapi.types.Resetable: java.lang.ClassCastException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.javaException(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.execute(Unknown 
> Source)
>   at 
> org.apache.derbyTesting.functionTests.tests.lang.T

[jira] Commented: (DERBY-4122) ClassCastException in SQLClob when running in soft upgrade mode (10.4.2.0 -> 10.5.1.0)

2009-04-01 Thread Knut Anders Hatlen (JIRA)

[ 
https://issues.apache.org/jira/browse/DERBY-4122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12694475#action_12694475
 ] 

Knut Anders Hatlen commented on DERBY-4122:
---

Is it possible to implement mark()/reset()/markSupported() in 
ReaderToUTF8Stream? Then we could use stream.mark(MAX_STREAM_HEADER_LENGTH) 
before the read operation and stream.reset() + 
InputStreamUtil.skipFully(stream, hdrInfo.headerLenght()) after on. We would 
still need separate code for the Resetable case, though, but we wouldn't need 
to check for exact class match, checks for InputStream.markSupported() and 
instanceof Resetable would do.

> ClassCastException in SQLClob when running in soft upgrade mode (10.4.2.0 -> 
> 10.5.1.0)
> --
>
> Key: DERBY-4122
> URL: https://issues.apache.org/jira/browse/DERBY-4122
> Project: Derby
>  Issue Type: Bug
>  Components: Regression Test Failure
>Affects Versions: 10.5.1.0
> Environment: Windows Vista 64, Sun JDK 1.6.0_10, Junit 3.8.2
>Reporter: Suran Jayathilaka
>Assignee: Kristian Waagan
>Priority: Blocker
> Attachments: derby-4122-1a-incorrect_stream_positioning.diff, 
> derby-4122-2a-bc4btest.diff, derby-4122-3a-classcast_fix.diff, 
> derby-4122-3b-classcast_fix.diff
>
>
> This bug was found when doing soft upgrade testing from Derby version 
> 10.4.2.0 to 10.5.1.0 (RC1)
> Steps followed are as follows.
> 1. Run setEmbeddedCP.bat from version 10.4.2.0's bin folder
> 2. In a test folder run ij
> 3. create system/wombat database.
> ij> connect 'jdbc:derby:system/wombat;create=true';
> 4. exit ij
> 5. Copy the 10.5.1.0 derby jars (from lib folder) and the derbyTesting.jar 
> from 10.4.2.0 to the test folder and set classpath with them (including junit 
> and ORO)
> 6. Run suites.All 
>  java -Xmx512M -Xms512M -Dderby.tests.trace=true junit.textui.TestRunner 
> org.apache.derbyTesting.functionTests.suites.All
> Result:
> Tests run: 10479,  Failures: 56,  Errors: 34
> The exception stack trace from a failed test follows.
> -
> 3) 
> testClobInTriggerTable(org.apache.derbyTesting.functionTests.tests.lang.TriggerTest)java.sql.SQLException:
>  Java exception: 'org.apache.derby.iapi.types.ReaderToUTF8Stream cannot be 
> cast to org.apache.derby.iapi.types.Resetable: java.lang.ClassCastException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.javaException(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.execute(Unknown 
> Source)
>   at 
> org.apache.derbyTesting.functionTests.tests.lang.TriggerTest.testClobInTriggerTable(TriggerTest.java:529)
>   at 
> org.apache.derbyTesting.functionTests.tests.lang.TriggerTest.testClobInTriggerTable(TriggerTest.java:451)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>   at 
> org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:102)
>   at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>   at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
>   at junit.extensions.TestSetup.run(TestSetup.java:25)
>   at 
> org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
> Caused by: java.sql.SQLException: Java exception: 
> 'org.apache.derby.iapi.types.ReaderToUTF8Stream cannot be cast to 
> org.apache.derby.iapi.types.Resetable: java.lang.ClassCastException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown
>  Source)
>   ... 39 more
> Caused by: java.lang.ClassCastException: 
> org.apache.derby.iapi.types.ReaderToUTF8Stream cannot be cast to 
> org.apache.derby.iapi.typ

[jira] Commented: (DERBY-4122) ClassCastException in SQLClob when running in soft upgrade mode (10.4.2.0 -> 10.5.1.0)

2009-04-01 Thread Kristian Waagan (JIRA)

[ 
https://issues.apache.org/jira/browse/DERBY-4122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12694446#action_12694446
 ] 

Kristian Waagan commented on DERBY-4122:


> I'm not sure I understand. The patch solved the ClassCastException by
> checking stream instanceof ReaderToUTF8Stream. Where does the
> FormatIdInputStream come into the picture? 

The instanceof ReaderToUTF8Stream happens in SQLClob.readExternal.
>From SQLChar.getString():
"""
} else if (stream != null) {

// data stored as a stream
try {

if (stream instanceof FormatIdInputStream) {
readExternal((FormatIdInputStream) stream);
} else {
readExternal(new FormatIdInputStream(stream));
}
stream = null;

// at this point the value is only in the char[]
// so call again to convert to a String
return getString();

} catch (IOException ioe) {
"""

In the code above, the variable 'stream' will be a FormatIdInputStream if it
comes from store, and ReaderToUTF8Stream if the value hasn't been
inserted into the store (i.e. we're working on this value from within a trigger,
or a VALUES clause).
At this point, doing the more general check 'stream instanceof Resetable' is 
valid.

And again, the reason why this was discovered during (soft) upgrade testing, is 
that
in a fresh 10.5 database you won't have to reset / rewind the stream.

> ClassCastException in SQLClob when running in soft upgrade mode (10.4.2.0 -> 
> 10.5.1.0)
> --
>
> Key: DERBY-4122
> URL: https://issues.apache.org/jira/browse/DERBY-4122
> Project: Derby
>  Issue Type: Bug
>  Components: Regression Test Failure
>Affects Versions: 10.5.1.0
> Environment: Windows Vista 64, Sun JDK 1.6.0_10, Junit 3.8.2
>Reporter: Suran Jayathilaka
>Assignee: Kristian Waagan
>Priority: Blocker
> Attachments: derby-4122-1a-incorrect_stream_positioning.diff, 
> derby-4122-2a-bc4btest.diff, derby-4122-3a-classcast_fix.diff, 
> derby-4122-3b-classcast_fix.diff
>
>
> This bug was found when doing soft upgrade testing from Derby version 
> 10.4.2.0 to 10.5.1.0 (RC1)
> Steps followed are as follows.
> 1. Run setEmbeddedCP.bat from version 10.4.2.0's bin folder
> 2. In a test folder run ij
> 3. create system/wombat database.
> ij> connect 'jdbc:derby:system/wombat;create=true';
> 4. exit ij
> 5. Copy the 10.5.1.0 derby jars (from lib folder) and the derbyTesting.jar 
> from 10.4.2.0 to the test folder and set classpath with them (including junit 
> and ORO)
> 6. Run suites.All 
>  java -Xmx512M -Xms512M -Dderby.tests.trace=true junit.textui.TestRunner 
> org.apache.derbyTesting.functionTests.suites.All
> Result:
> Tests run: 10479,  Failures: 56,  Errors: 34
> The exception stack trace from a failed test follows.
> -
> 3) 
> testClobInTriggerTable(org.apache.derbyTesting.functionTests.tests.lang.TriggerTest)java.sql.SQLException:
>  Java exception: 'org.apache.derby.iapi.types.ReaderToUTF8Stream cannot be 
> cast to org.apache.derby.iapi.types.Resetable: java.lang.ClassCastException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.javaException(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.execute(Unknown 
> Source)
>   at 
> org.apache.derbyTesting.functionTests.tests.lang.TriggerTest.testClobInTriggerTable(TriggerTest.java:529)
>   at 
> org.apache.derbyTesting.functionTests.tests.lang.TriggerTest.testClobInTriggerTable(TriggerTest.java:451)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 

[jira] Commented: (DERBY-4122) ClassCastException in SQLClob when running in soft upgrade mode (10.4.2.0 -> 10.5.1.0)

2009-04-01 Thread Knut Anders Hatlen (JIRA)

[ 
https://issues.apache.org/jira/browse/DERBY-4122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12694436#action_12694436
 ] 

Knut Anders Hatlen commented on DERBY-4122:
---

> 1) How to best determine if a stream is resetable or not.
>
> The problem in 1 is that no matter if the source stream is resetable
> or not, we wrap it in a FormatIdInputStream. This class implements
> the Resetable interface, and a test for instanceof Resetable will
> fail with the reported ClassCastException.

I'm not sure I understand. The patch solved the ClassCastException by
checking stream instanceof ReaderToUTF8Stream. Where does the
FormatIdInputStream come into the picture?

> 2) Is it okay to materialize small Clobs in SQLClob.setObject?
>And what should the threshold for a small Clob be?

That sounds OK to me. When we get the Clobs from store, isn't the
limit about 32K? Perhaps that could be used as a starting point.

Nit: SQLChar.EMPTY could be replaced by ReuseFactory.getZeroLenByteArray().

> ClassCastException in SQLClob when running in soft upgrade mode (10.4.2.0 -> 
> 10.5.1.0)
> --
>
> Key: DERBY-4122
> URL: https://issues.apache.org/jira/browse/DERBY-4122
> Project: Derby
>  Issue Type: Bug
>  Components: Regression Test Failure
>Affects Versions: 10.5.1.0
> Environment: Windows Vista 64, Sun JDK 1.6.0_10, Junit 3.8.2
>Reporter: Suran Jayathilaka
>Assignee: Kristian Waagan
>Priority: Blocker
> Attachments: derby-4122-1a-incorrect_stream_positioning.diff, 
> derby-4122-2a-bc4btest.diff, derby-4122-3a-classcast_fix.diff, 
> derby-4122-3b-classcast_fix.diff
>
>
> This bug was found when doing soft upgrade testing from Derby version 
> 10.4.2.0 to 10.5.1.0 (RC1)
> Steps followed are as follows.
> 1. Run setEmbeddedCP.bat from version 10.4.2.0's bin folder
> 2. In a test folder run ij
> 3. create system/wombat database.
> ij> connect 'jdbc:derby:system/wombat;create=true';
> 4. exit ij
> 5. Copy the 10.5.1.0 derby jars (from lib folder) and the derbyTesting.jar 
> from 10.4.2.0 to the test folder and set classpath with them (including junit 
> and ORO)
> 6. Run suites.All 
>  java -Xmx512M -Xms512M -Dderby.tests.trace=true junit.textui.TestRunner 
> org.apache.derbyTesting.functionTests.suites.All
> Result:
> Tests run: 10479,  Failures: 56,  Errors: 34
> The exception stack trace from a failed test follows.
> -
> 3) 
> testClobInTriggerTable(org.apache.derbyTesting.functionTests.tests.lang.TriggerTest)java.sql.SQLException:
>  Java exception: 'org.apache.derby.iapi.types.ReaderToUTF8Stream cannot be 
> cast to org.apache.derby.iapi.types.Resetable: java.lang.ClassCastException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.javaException(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.execute(Unknown 
> Source)
>   at 
> org.apache.derbyTesting.functionTests.tests.lang.TriggerTest.testClobInTriggerTable(TriggerTest.java:529)
>   at 
> org.apache.derbyTesting.functionTests.tests.lang.TriggerTest.testClobInTriggerTable(TriggerTest.java:451)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>   at 
> org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:102)
>   at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>   at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
>   at junit.extensions.TestSetup.run(TestSetup.java:25)
>   at 
> org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
> Caused by: java.sql.SQLException: Java exception: 
> 'org.apache.derby.iapi.types.ReaderToUTF8Stream cannot be cast to 
> org.apache.derby.iapi.types.Resetable: java.lang.ClassCastExcepti

[jira] Commented: (DERBY-4122) ClassCastException in SQLClob when running in soft upgrade mode (10.4.2.0 -> 10.5.1.0)

2009-04-01 Thread Kristian Waagan (JIRA)

[ 
https://issues.apache.org/jira/browse/DERBY-4122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12694429#action_12694429
 ] 

Kristian Waagan commented on DERBY-4122:


Backported patches 1a and 2a to 10.5 with revision 760820.

> ClassCastException in SQLClob when running in soft upgrade mode (10.4.2.0 -> 
> 10.5.1.0)
> --
>
> Key: DERBY-4122
> URL: https://issues.apache.org/jira/browse/DERBY-4122
> Project: Derby
>  Issue Type: Bug
>  Components: Regression Test Failure
>Affects Versions: 10.5.1.0
> Environment: Windows Vista 64, Sun JDK 1.6.0_10, Junit 3.8.2
>Reporter: Suran Jayathilaka
>Assignee: Kristian Waagan
>Priority: Blocker
> Attachments: derby-4122-1a-incorrect_stream_positioning.diff, 
> derby-4122-2a-bc4btest.diff, derby-4122-3a-classcast_fix.diff, 
> derby-4122-3b-classcast_fix.diff
>
>
> This bug was found when doing soft upgrade testing from Derby version 
> 10.4.2.0 to 10.5.1.0 (RC1)
> Steps followed are as follows.
> 1. Run setEmbeddedCP.bat from version 10.4.2.0's bin folder
> 2. In a test folder run ij
> 3. create system/wombat database.
> ij> connect 'jdbc:derby:system/wombat;create=true';
> 4. exit ij
> 5. Copy the 10.5.1.0 derby jars (from lib folder) and the derbyTesting.jar 
> from 10.4.2.0 to the test folder and set classpath with them (including junit 
> and ORO)
> 6. Run suites.All 
>  java -Xmx512M -Xms512M -Dderby.tests.trace=true junit.textui.TestRunner 
> org.apache.derbyTesting.functionTests.suites.All
> Result:
> Tests run: 10479,  Failures: 56,  Errors: 34
> The exception stack trace from a failed test follows.
> -
> 3) 
> testClobInTriggerTable(org.apache.derbyTesting.functionTests.tests.lang.TriggerTest)java.sql.SQLException:
>  Java exception: 'org.apache.derby.iapi.types.ReaderToUTF8Stream cannot be 
> cast to org.apache.derby.iapi.types.Resetable: java.lang.ClassCastException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.javaException(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.execute(Unknown 
> Source)
>   at 
> org.apache.derbyTesting.functionTests.tests.lang.TriggerTest.testClobInTriggerTable(TriggerTest.java:529)
>   at 
> org.apache.derbyTesting.functionTests.tests.lang.TriggerTest.testClobInTriggerTable(TriggerTest.java:451)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>   at 
> org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:102)
>   at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>   at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
>   at junit.extensions.TestSetup.run(TestSetup.java:25)
>   at 
> org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
> Caused by: java.sql.SQLException: Java exception: 
> 'org.apache.derby.iapi.types.ReaderToUTF8Stream cannot be cast to 
> org.apache.derby.iapi.types.Resetable: java.lang.ClassCastException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown
>  Source)
>   ... 39 more
> Caused by: java.lang.ClassCastException: 
> org.apache.derby.iapi.types.ReaderToUTF8Stream cannot be cast to 
> org.apache.derby.iapi.types.Resetable
>   at org.apache.derby.iapi.types.SQLClob.rewindStream(Unknown Source)
>   at org.apache.derby.iapi.types.SQLClob.readExternal(Unknown Source)
>   at org.apache.derby.iapi.types.SQLChar.getString(Unknown Source)
>   at org.apache.derby.iapi.types.SQLChar.loadStream(Unknown Source)
>   at 
> org.apache.derby.impl.sql.execute.UpdateResultSet.objectifyStream(Unknown

[jira] Commented: (DERBY-4122) ClassCastException in SQLClob when running in soft upgrade mode (10.4.2.0 -> 10.5.1.0)

2009-03-31 Thread Kristian Waagan (JIRA)

[ 
https://issues.apache.org/jira/browse/DERBY-4122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12694146#action_12694146
 ] 

Kristian Waagan commented on DERBY-4122:


In patch 3b, there are some issues that need to be resolved:
 1) How to best determine if a stream is resetable or not.
 2) Is it okay to materialize small Clobs in SQLClob.setObject?
And what should the threshold for a small Clob be?

The problem in 1 is that no matter if the source stream is resetable or not, we 
wrap it in a FormatIdInputStream. This class implements the Resetable 
interface, and a test for instanceof Resetable will fail with the reported 
ClassCastException.
Some options from the top of my head (I'll spend more time investigating, but 
would appreciate comments);
 a) Introduce yet another class (a "non-resetable-FormatIdInputStream")
 b) Add the method isResetable to the Resetable interface (kind of 
contradicting...)
 c) Try to reset / rewind, catch ClassCastException and fallback to passing 
along the "bytes peeked at".
 d) Add instance variable in SQLChar, which allows us to do the instanceof 
check before we wrap the stream in a FormatIdInputStream.
 e) Your suggestion?

Note that I haven't had time to throughly investigate this yet, so I may have 
missed something that's simpler and easier to implement.

A few comments on some of the options I mentioned so far:
 a) This adds to the overhead, but the fact that this problem arises suggests 
there is a design problem in the current implementation. It is not clear to me  
what kind of changes this approach requires.
 c) Probably doable, but this makes exception catching part of the "flow 
control" for Clobs written with the old header format.
 d) Adds more state to a central data type, which has to be maintained. I think 
the maintenance costs should be modest, but I haven't investigated that. It may 
be possible to add this information to the CharacterStreamDescriptor-object, 
but again I don't know how this will play out.

That said, the current patch already works...
Feedback appreciated!

> ClassCastException in SQLClob when running in soft upgrade mode (10.4.2.0 -> 
> 10.5.1.0)
> --
>
> Key: DERBY-4122
> URL: https://issues.apache.org/jira/browse/DERBY-4122
> Project: Derby
>  Issue Type: Bug
>  Components: Regression Test Failure
>Affects Versions: 10.5.1.0
> Environment: Windows Vista 64, Sun JDK 1.6.0_10, Junit 3.8.2
>Reporter: Suran Jayathilaka
>Assignee: Kristian Waagan
>Priority: Blocker
> Attachments: derby-4122-1a-incorrect_stream_positioning.diff, 
> derby-4122-2a-bc4btest.diff, derby-4122-3a-classcast_fix.diff, 
> derby-4122-3b-classcast_fix.diff
>
>
> This bug was found when doing soft upgrade testing from Derby version 
> 10.4.2.0 to 10.5.1.0 (RC1)
> Steps followed are as follows.
> 1. Run setEmbeddedCP.bat from version 10.4.2.0's bin folder
> 2. In a test folder run ij
> 3. create system/wombat database.
> ij> connect 'jdbc:derby:system/wombat;create=true';
> 4. exit ij
> 5. Copy the 10.5.1.0 derby jars (from lib folder) and the derbyTesting.jar 
> from 10.4.2.0 to the test folder and set classpath with them (including junit 
> and ORO)
> 6. Run suites.All 
>  java -Xmx512M -Xms512M -Dderby.tests.trace=true junit.textui.TestRunner 
> org.apache.derbyTesting.functionTests.suites.All
> Result:
> Tests run: 10479,  Failures: 56,  Errors: 34
> The exception stack trace from a failed test follows.
> -
> 3) 
> testClobInTriggerTable(org.apache.derbyTesting.functionTests.tests.lang.TriggerTest)java.sql.SQLException:
>  Java exception: 'org.apache.derby.iapi.types.ReaderToUTF8Stream cannot be 
> cast to org.apache.derby.iapi.types.Resetable: java.lang.ClassCastException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.javaException(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.execute(Unknown 
> Sou

[jira] Commented: (DERBY-4122) ClassCastException in SQLClob when running in soft upgrade mode (10.4.2.0 -> 10.5.1.0)

2009-03-28 Thread Kristian Waagan (JIRA)

[ 
https://issues.apache.org/jira/browse/DERBY-4122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12693495#action_12693495
 ] 

Kristian Waagan commented on DERBY-4122:


derbyall and suites.All ran without failures (with freshly created test 
databases, not in soft upgrade mode).

> ClassCastException in SQLClob when running in soft upgrade mode (10.4.2.0 -> 
> 10.5.1.0)
> --
>
> Key: DERBY-4122
> URL: https://issues.apache.org/jira/browse/DERBY-4122
> Project: Derby
>  Issue Type: Bug
>  Components: Regression Test Failure
>Affects Versions: 10.5.1.0
> Environment: Windows Vista 64, Sun JDK 1.6.0_10, Junit 3.8.2
>Reporter: Suran Jayathilaka
>Assignee: Kristian Waagan
>Priority: Blocker
> Attachments: derby-4122-1a-incorrect_stream_positioning.diff, 
> derby-4122-2a-bc4btest.diff, derby-4122-3a-classcast_fix.diff
>
>
> This bug was found when doing soft upgrade testing from Derby version 
> 10.4.2.0 to 10.5.1.0 (RC1)
> Steps followed are as follows.
> 1. Run setEmbeddedCP.bat from version 10.4.2.0's bin folder
> 2. In a test folder run ij
> 3. create system/wombat database.
> ij> connect 'jdbc:derby:system/wombat;create=true';
> 4. exit ij
> 5. Copy the 10.5.1.0 derby jars (from lib folder) and the derbyTesting.jar 
> from 10.4.2.0 to the test folder and set classpath with them (including junit 
> and ORO)
> 6. Run suites.All 
>  java -Xmx512M -Xms512M -Dderby.tests.trace=true junit.textui.TestRunner 
> org.apache.derbyTesting.functionTests.suites.All
> Result:
> Tests run: 10479,  Failures: 56,  Errors: 34
> The exception stack trace from a failed test follows.
> -
> 3) 
> testClobInTriggerTable(org.apache.derbyTesting.functionTests.tests.lang.TriggerTest)java.sql.SQLException:
>  Java exception: 'org.apache.derby.iapi.types.ReaderToUTF8Stream cannot be 
> cast to org.apache.derby.iapi.types.Resetable: java.lang.ClassCastException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.javaException(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.execute(Unknown 
> Source)
>   at 
> org.apache.derbyTesting.functionTests.tests.lang.TriggerTest.testClobInTriggerTable(TriggerTest.java:529)
>   at 
> org.apache.derbyTesting.functionTests.tests.lang.TriggerTest.testClobInTriggerTable(TriggerTest.java:451)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>   at 
> org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:102)
>   at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>   at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
>   at junit.extensions.TestSetup.run(TestSetup.java:25)
>   at 
> org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
> Caused by: java.sql.SQLException: Java exception: 
> 'org.apache.derby.iapi.types.ReaderToUTF8Stream cannot be cast to 
> org.apache.derby.iapi.types.Resetable: java.lang.ClassCastException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown
>  Source)
>   ... 39 more
> Caused by: java.lang.ClassCastException: 
> org.apache.derby.iapi.types.ReaderToUTF8Stream cannot be cast to 
> org.apache.derby.iapi.types.Resetable
>   at org.apache.derby.iapi.types.SQLClob.rewindStream(Unknown Source)
>   at org.apache.derby.iapi.types.SQLClob.readExternal(Unknown Source)
>   at org.apache.derby.iapi.types.SQLChar.getString(Unknown Source)
>   at org.apache.derby.iapi.types.SQLChar.loadStream(Unknown Source)
>   at 
> org.apache.derby.impl.sql.execute.UpdateResultSet.objectif

[jira] Commented: (DERBY-4122) ClassCastException in SQLClob when running in soft upgrade mode (10.4.2.0 -> 10.5.1.0)

2009-03-27 Thread Kristian Waagan (JIRA)

[ 
https://issues.apache.org/jira/browse/DERBY-4122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12689923#action_12689923
 ] 

Kristian Waagan commented on DERBY-4122:


BTW, derbyall and suites.All passed.

> ClassCastException in SQLClob when running in soft upgrade mode (10.4.2.0 -> 
> 10.5.1.0)
> --
>
> Key: DERBY-4122
> URL: https://issues.apache.org/jira/browse/DERBY-4122
> Project: Derby
>  Issue Type: Bug
>  Components: Regression Test Failure
>Affects Versions: 10.5.1.0
> Environment: Windows Vista 64, Sun JDK 1.6.0_10, Junit 3.8.2
>Reporter: Suran Jayathilaka
>Assignee: Kristian Waagan
>Priority: Blocker
> Attachments: derby-4122-1a-incorrect_stream_positioning.diff, 
> derby-4122-2a-bc4btest.diff
>
>
> This bug was found when doing soft upgrade testing from Derby version 
> 10.4.2.0 to 10.5.1.0 (RC1)
> Steps followed are as follows.
> 1. Run setEmbeddedCP.bat from version 10.4.2.0's bin folder
> 2. In a test folder run ij
> 3. create system/wombat database.
> ij> connect 'jdbc:derby:system/wombat;create=true';
> 4. exit ij
> 5. Copy the 10.5.1.0 derby jars (from lib folder) and the derbyTesting.jar 
> from 10.4.2.0 to the test folder and set classpath with them (including junit 
> and ORO)
> 6. Run suites.All 
>  java -Xmx512M -Xms512M -Dderby.tests.trace=true junit.textui.TestRunner 
> org.apache.derbyTesting.functionTests.suites.All
> Result:
> Tests run: 10479,  Failures: 56,  Errors: 34
> The exception stack trace from a failed test follows.
> -
> 3) 
> testClobInTriggerTable(org.apache.derbyTesting.functionTests.tests.lang.TriggerTest)java.sql.SQLException:
>  Java exception: 'org.apache.derby.iapi.types.ReaderToUTF8Stream cannot be 
> cast to org.apache.derby.iapi.types.Resetable: java.lang.ClassCastException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.javaException(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.execute(Unknown 
> Source)
>   at 
> org.apache.derbyTesting.functionTests.tests.lang.TriggerTest.testClobInTriggerTable(TriggerTest.java:529)
>   at 
> org.apache.derbyTesting.functionTests.tests.lang.TriggerTest.testClobInTriggerTable(TriggerTest.java:451)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>   at 
> org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:102)
>   at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>   at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
>   at junit.extensions.TestSetup.run(TestSetup.java:25)
>   at 
> org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
> Caused by: java.sql.SQLException: Java exception: 
> 'org.apache.derby.iapi.types.ReaderToUTF8Stream cannot be cast to 
> org.apache.derby.iapi.types.Resetable: java.lang.ClassCastException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown
>  Source)
>   ... 39 more
> Caused by: java.lang.ClassCastException: 
> org.apache.derby.iapi.types.ReaderToUTF8Stream cannot be cast to 
> org.apache.derby.iapi.types.Resetable
>   at org.apache.derby.iapi.types.SQLClob.rewindStream(Unknown Source)
>   at org.apache.derby.iapi.types.SQLClob.readExternal(Unknown Source)
>   at org.apache.derby.iapi.types.SQLChar.getString(Unknown Source)
>   at org.apache.derby.iapi.types.SQLChar.loadStream(Unknown Source)
>   at 
> org.apache.derby.impl.sql.execute.UpdateResultSet.objectifyStream(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.UpdateResultSet.collectAffectedRo

[jira] Commented: (DERBY-4122) ClassCastException in SQLClob when running in soft upgrade mode (10.4.2.0 -> 10.5.1.0)

2009-03-27 Thread Kristian Waagan (JIRA)

[ 
https://issues.apache.org/jira/browse/DERBY-4122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12689922#action_12689922
 ] 

Kristian Waagan commented on DERBY-4122:


Sorry Kathey, I just committed the patches before I saw your comment.
Committed patch 1a to trunk with revision 759153, and patch 2a to trunk with 
revision 759155.

Regarding tests, I believe our existing tests cover the issue *if* they are run 
against a 10.4 database. I must admit, it is not clear to me what will be run 
and tested as part of our default upgrade tests. I need to look into this.

> ClassCastException in SQLClob when running in soft upgrade mode (10.4.2.0 -> 
> 10.5.1.0)
> --
>
> Key: DERBY-4122
> URL: https://issues.apache.org/jira/browse/DERBY-4122
> Project: Derby
>  Issue Type: Bug
>  Components: Regression Test Failure
>Affects Versions: 10.5.1.0
> Environment: Windows Vista 64, Sun JDK 1.6.0_10, Junit 3.8.2
>Reporter: Suran Jayathilaka
>Assignee: Kristian Waagan
>Priority: Blocker
> Attachments: derby-4122-1a-incorrect_stream_positioning.diff, 
> derby-4122-2a-bc4btest.diff
>
>
> This bug was found when doing soft upgrade testing from Derby version 
> 10.4.2.0 to 10.5.1.0 (RC1)
> Steps followed are as follows.
> 1. Run setEmbeddedCP.bat from version 10.4.2.0's bin folder
> 2. In a test folder run ij
> 3. create system/wombat database.
> ij> connect 'jdbc:derby:system/wombat;create=true';
> 4. exit ij
> 5. Copy the 10.5.1.0 derby jars (from lib folder) and the derbyTesting.jar 
> from 10.4.2.0 to the test folder and set classpath with them (including junit 
> and ORO)
> 6. Run suites.All 
>  java -Xmx512M -Xms512M -Dderby.tests.trace=true junit.textui.TestRunner 
> org.apache.derbyTesting.functionTests.suites.All
> Result:
> Tests run: 10479,  Failures: 56,  Errors: 34
> The exception stack trace from a failed test follows.
> -
> 3) 
> testClobInTriggerTable(org.apache.derbyTesting.functionTests.tests.lang.TriggerTest)java.sql.SQLException:
>  Java exception: 'org.apache.derby.iapi.types.ReaderToUTF8Stream cannot be 
> cast to org.apache.derby.iapi.types.Resetable: java.lang.ClassCastException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.javaException(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.execute(Unknown 
> Source)
>   at 
> org.apache.derbyTesting.functionTests.tests.lang.TriggerTest.testClobInTriggerTable(TriggerTest.java:529)
>   at 
> org.apache.derbyTesting.functionTests.tests.lang.TriggerTest.testClobInTriggerTable(TriggerTest.java:451)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>   at 
> org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:102)
>   at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>   at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
>   at junit.extensions.TestSetup.run(TestSetup.java:25)
>   at 
> org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
> Caused by: java.sql.SQLException: Java exception: 
> 'org.apache.derby.iapi.types.ReaderToUTF8Stream cannot be cast to 
> org.apache.derby.iapi.types.Resetable: java.lang.ClassCastException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown
>  Source)
>   ... 39 more
> Caused by: java.lang.ClassCastException: 
> org.apache.derby.iapi.types.ReaderToUTF8Stream cannot be cast to 
> org.apache.derby.iapi.types.Resetable
>   at org.apache.derby.iapi.types.SQLClob.rewindStream(Unknown Source)
>   at org.apache.derby.iapi.types.

[jira] Commented: (DERBY-4122) ClassCastException in SQLClob when running in soft upgrade mode (10.4.2.0 -> 10.5.1.0)

2009-03-27 Thread Kathey Marsden (JIRA)

[ 
https://issues.apache.org/jira/browse/DERBY-4122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12689916#action_12689916
 ] 

Kathey Marsden commented on DERBY-4122:
---

Regarsding patch 1a, It would be good to have a new upgrade test to test the 
fix and also to have a brief code comment to explain the fix and mention the 
JIRA number for reference.  Perhaps, since it is a different problem than the 
ClassCastException (or at least has a different fix), another Jira might be 
appropriate.

Since the test patch is not really related.  It would be good to have it as a 
separate commit.



> ClassCastException in SQLClob when running in soft upgrade mode (10.4.2.0 -> 
> 10.5.1.0)
> --
>
> Key: DERBY-4122
> URL: https://issues.apache.org/jira/browse/DERBY-4122
> Project: Derby
>  Issue Type: Bug
>  Components: Regression Test Failure
>Affects Versions: 10.5.1.0
> Environment: Windows Vista 64, Sun JDK 1.6.0_10, Junit 3.8.2
>Reporter: Suran Jayathilaka
>Assignee: Kristian Waagan
>Priority: Blocker
> Attachments: derby-4122-1a-incorrect_stream_positioning.diff, 
> derby-4122-2a-bc4btest.diff
>
>
> This bug was found when doing soft upgrade testing from Derby version 
> 10.4.2.0 to 10.5.1.0 (RC1)
> Steps followed are as follows.
> 1. Run setEmbeddedCP.bat from version 10.4.2.0's bin folder
> 2. In a test folder run ij
> 3. create system/wombat database.
> ij> connect 'jdbc:derby:system/wombat;create=true';
> 4. exit ij
> 5. Copy the 10.5.1.0 derby jars (from lib folder) and the derbyTesting.jar 
> from 10.4.2.0 to the test folder and set classpath with them (including junit 
> and ORO)
> 6. Run suites.All 
>  java -Xmx512M -Xms512M -Dderby.tests.trace=true junit.textui.TestRunner 
> org.apache.derbyTesting.functionTests.suites.All
> Result:
> Tests run: 10479,  Failures: 56,  Errors: 34
> The exception stack trace from a failed test follows.
> -
> 3) 
> testClobInTriggerTable(org.apache.derbyTesting.functionTests.tests.lang.TriggerTest)java.sql.SQLException:
>  Java exception: 'org.apache.derby.iapi.types.ReaderToUTF8Stream cannot be 
> cast to org.apache.derby.iapi.types.Resetable: java.lang.ClassCastException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.javaException(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.execute(Unknown 
> Source)
>   at 
> org.apache.derbyTesting.functionTests.tests.lang.TriggerTest.testClobInTriggerTable(TriggerTest.java:529)
>   at 
> org.apache.derbyTesting.functionTests.tests.lang.TriggerTest.testClobInTriggerTable(TriggerTest.java:451)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>   at 
> org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:102)
>   at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>   at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
>   at junit.extensions.TestSetup.run(TestSetup.java:25)
>   at 
> org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
> Caused by: java.sql.SQLException: Java exception: 
> 'org.apache.derby.iapi.types.ReaderToUTF8Stream cannot be cast to 
> org.apache.derby.iapi.types.Resetable: java.lang.ClassCastException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown
>  Source)
>   ... 39 more
> Caused by: java.lang.ClassCastException: 
> org.apache.derby.iapi.types.ReaderToUTF8Stream cannot be cast to 
> org.apache.derby.iapi.types.Resetable
>   at org.apache.derby.iapi.types.SQLClob.rewindStream(Unknown Source)
>   at org.apa

[jira] Commented: (DERBY-4122) ClassCastException in SQLClob when running in soft upgrade mode (10.4.2.0 -> 10.5.1.0)

2009-03-26 Thread Kristian Waagan (JIRA)

[ 
https://issues.apache.org/jira/browse/DERBY-4122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12689688#action_12689688
 ] 

Kristian Waagan commented on DERBY-4122:


I'm pretty sure DERBY-3907 introduced this bug. I'll have a look tomorrow.



> ClassCastException in SQLClob when running in soft upgrade mode (10.4.2.0 -> 
> 10.5.1.0)
> --
>
> Key: DERBY-4122
> URL: https://issues.apache.org/jira/browse/DERBY-4122
> Project: Derby
>  Issue Type: Bug
>  Components: Regression Test Failure
>Affects Versions: 10.5.1.0
> Environment: Windows Vista 64, Sun JDK 1.6.0_10, Junit 3.8.2
>Reporter: Suran Jayathilaka
>Priority: Blocker
>
> This bug was found when doing soft upgrade testing from Derby version 
> 10.4.2.0 to 10.5.1.0 (RC1)
> Steps followed are as follows.
> 1. Run setEmbeddedCP.bat from version 10.4.2.0's bin folder
> 2. In a test folder run ij
> 3. create system/wombat database.
> ij> connect 'jdbc:derby:system/wombat;create=true';
> 4. exit ij
> 5. Copy the 10.5.1.0 derby jars (from lib folder) and the derbyTesting.jar 
> from 10.4.2.0 to the test folder and set classpath with them (including junit 
> and ORO)
> 6. Run suites.All 
>  java -Xmx512M -Xms512M -Dderby.tests.trace=true junit.textui.TestRunner 
> org.apache.derbyTesting.functionTests.suites.All
> Result:
> Tests run: 10479,  Failures: 56,  Errors: 34
> The exception stack trace from a failed test follows.
> -
> 3) 
> testClobInTriggerTable(org.apache.derbyTesting.functionTests.tests.lang.TriggerTest)java.sql.SQLException:
>  Java exception: 'org.apache.derby.iapi.types.ReaderToUTF8Stream cannot be 
> cast to org.apache.derby.iapi.types.Resetable: java.lang.ClassCastException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown 
> Source)
>   at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
>   at org.apache.derby.impl.jdbc.Util.javaException(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.execute(Unknown 
> Source)
>   at 
> org.apache.derbyTesting.functionTests.tests.lang.TriggerTest.testClobInTriggerTable(TriggerTest.java:529)
>   at 
> org.apache.derbyTesting.functionTests.tests.lang.TriggerTest.testClobInTriggerTable(TriggerTest.java:451)
>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>   at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>   at 
> org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:102)
>   at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>   at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
>   at junit.extensions.TestSetup.run(TestSetup.java:25)
>   at 
> org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
> Caused by: java.sql.SQLException: Java exception: 
> 'org.apache.derby.iapi.types.ReaderToUTF8Stream cannot be cast to 
> org.apache.derby.iapi.types.Resetable: java.lang.ClassCastException'.
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>   at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown
>  Source)
>   ... 39 more
> Caused by: java.lang.ClassCastException: 
> org.apache.derby.iapi.types.ReaderToUTF8Stream cannot be cast to 
> org.apache.derby.iapi.types.Resetable
>   at org.apache.derby.iapi.types.SQLClob.rewindStream(Unknown Source)
>   at org.apache.derby.iapi.types.SQLClob.readExternal(Unknown Source)
>   at org.apache.derby.iapi.types.SQLChar.getString(Unknown Source)
>   at org.apache.derby.iapi.types.SQLChar.loadStream(Unknown Source)
>   at 
> org.apache.derby.impl.sql.execute.UpdateResultSet.objectifyStream(Unknown 
> Source)
>   at 
> org.apache.derby.impl.sql.execute.UpdateResultSet.collectAffectedRows(Unknown 
> Source)
>   at org.apache.derby.impl.sql.execute.UpdateResultSet.open(Unknown 
> Sourc

[jira] Commented: (DERBY-4122) ClassCastException in SQLClob when running in soft upgrade mode (10.4.2.0 -> 10.5.1.0)

2009-03-26 Thread Suran Jayathilaka (JIRA)

[ 
https://issues.apache.org/jira/browse/DERBY-4122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12689623#action_12689623
 ] 

Suran Jayathilaka commented on DERBY-4122:
--

This is the stack trace from another failed test in the same test run, which 
may be related to the same issue as above. Should be investigated and filed 
separately if this is caused by a different problem.

13) 
testTriggersWithClobColumn(org.apache.derbyTesting.functionTests.tests.jdbcapi.BlobClob4BlobTest)java.sql.SQLException:
 An IOException was thrown when reading a 'java.sql.String' from an InputStream.
at 
org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.seeNextException(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.EmbedStatement.execute(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown 
Source)
at 
org.apache.derbyTesting.functionTests.tests.jdbcapi.BlobClob4BlobTest.testTriggersWithClobColumn(BlobClob4BlobTest.java:397)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at 
org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:102)
at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
at junit.extensions.TestSetup.run(TestSetup.java:25)
at 
org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
at junit.extensions.TestSetup.run(TestSetup.java:25)
at 
org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
Caused by: java.sql.SQLException: An IOException was thrown when reading a 
'java.sql.String' from an InputStream.
at 
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
at 
org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown
 Source)
... 45 more
Caused by: java.sql.SQLException: Java exception: ': java.io.EOFException'.
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.newEmbedSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
Source)
... 42 more
Caused by: java.io.EOFException
at org.apache.derby.iapi.types.SQLChar.readExternal(Unknown Source)
at org.apache.derby.iapi.types.SQLClob.readExternal(Unknown Source)
at org.apache.derby.iapi.types.SQLChar.getString(Unknown Source)
at org.apache.derby.iapi.types.SQLChar.loadStream(Unknown Source)
at 
org.apache.derby.impl.sql.execute.DMLWriteResultSet.objectifyStreams(Unknown 
Source)
at 
org.apache.derby.impl.sql.execute.DMLWriteResultSet.getNextRowCore(Unknown 
Source)
at 
org.apache.derby.impl.sql.execute.UpdateResultSet.collectAffectedRows(Unknown 
Source)
at org.apache.derby.impl.sql.execute.UpdateResultSet.open(Unknown 
Source)
at 
org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown 
Source)
... 38 more

> ClassCastException in SQLClob when running in soft upgrade mode (10.4.2.0 -> 
> 10.5.1.0)
> --
>
> Key: DERBY-4122
> URL: https://issues.apache.org/jira/browse/DERBY-4122
> Project: Derby
>  Issue Type: Bug
>  Components: Regression Test Failure
>Affects Versions: 10.5.1.0
> Environment: Windows Vista 64, Sun JDK 1.6.0_10, Junit 3.8.2
>Reporter: Suran