Derby
  1. Derby
  2. DERBY-4122

ClassCastException in SQLClob when running in soft upgrade mode (10.4.2.0 -> 10.5.1.0)

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 10.5.1.1, 10.6.1.0
    • Component/s: Test
    • Labels:
      None
    • Environment:
      Windows Vista 64, Sun JDK 1.6.0_10, Junit 3.8.2
    • Urgency:
      Blocker
    • Bug behavior facts:
      Regression, Regression Test Failure

      Description

      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 Source)
      at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
      at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown Source)
      ... 32 more
      ------------------------------------------------------------------------------------------------------------------

      When looking at the SVN revisions for SQLClob with Kathey Marsden, we found the following statement in revision # 738408, related to DERBY-3907, which might be related to this issue.

      "NOTE: Databases created with this revision (or later) containing Clobs, cannot be accessed by earlier trunk revisions."
      Patch file: derby-3907-7a3-use_new_header_format.diff

      1. derby-4122-4c-classcast_fix_mark_reset.diff
        40 kB
        Kristian Waagan
      2. derby-4122-4b-classcast_fix_mark_reset.diff
        39 kB
        Kristian Waagan
      3. derby-4122-4a-classcast_fix_mark_reset.diff
        17 kB
        Kristian Waagan
      4. derby-4122-3b-classcast_fix.diff
        10 kB
        Kristian Waagan
      5. derby-4122-3a-classcast_fix.diff
        9 kB
        Kristian Waagan
      6. derby-4122-2a-bc4btest.diff
        0.8 kB
        Kristian Waagan
      7. derby-4122-1a-incorrect_stream_positioning.diff
        0.8 kB
        Kristian Waagan

        Issue Links

          Activity

          Suran Jayathilaka created issue -
          Kristian Waagan made changes -
          Field Original Value New Value
          Attachment derby-4122-1a-incorrect_stream_positioning.diff [ 12403803 ]
          Attachment derby-4122-2a-bc4btest.diff [ 12403804 ]
          Kristian Waagan made changes -
          Assignee Kristian Waagan [ kristwaa ]
          Kristian Waagan made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          Kristian Waagan made changes -
          Attachment derby-4122-3a-classcast_fix.diff [ 12403823 ]
          Kristian Waagan made changes -
          Attachment derby-4122-3b-classcast_fix.diff [ 12404147 ]
          Kristian Waagan made changes -
          Link This issue incorporates DERBY-4135 [ DERBY-4135 ]
          Kristian Waagan made changes -
          Kristian Waagan made changes -
          Derby Info [Regression] [Patch Available, Regression]
          Kristian Waagan made changes -
          Kristian Waagan made changes -
          Attachment derby-4122-4b-classcast_fix_mark_reset.diff [ 12404736 ]
          Kristian Waagan made changes -
          Attachment derby-4122-4b-classcast_fix_mark_reset.diff [ 12404736 ]
          Kristian Waagan made changes -
          Kristian Waagan made changes -
          Status In Progress [ 3 ] Resolved [ 5 ]
          Derby Info [Regression, Patch Available] [Regression]
          Fix Version/s 10.5.1.1 [ 12313771 ]
          Fix Version/s 10.6.0.0 [ 12313727 ]
          Resolution Fixed [ 1 ]
          Suran Jayathilaka made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Myrna van Lunteren made changes -
          Affects Version/s 10.5.1.0 [ 12313770 ]
          Dag H. Wanvik made changes -
          Component/s Regression Test Failure [ 12310664 ]
          Dag H. Wanvik made changes -
          Component/s Test [ 11413 ]
          Dag H. Wanvik made changes -
          Bug behavior facts [Regression Test Failure] [Regression]
          Dag H. Wanvik made changes -
          Bug behavior facts [Regression] [Regression Test Failure]
          Dag H. Wanvik made changes -
          Bug behavior facts [Regression Test Failure] [Regression, Regression Test Failure]
          Gavin made changes -
          Workflow jira [ 12457455 ] Default workflow, editable Closed status [ 12801661 ]

            People

            • Assignee:
              Kristian Waagan
              Reporter:
              Suran Jayathilaka
            • Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development