Derby
  1. Derby
  2. DERBY-5951

Missing method exception raised when using Clobs with territory based collation

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 10.10.1.1
    • Fix Version/s: 10.8.3.0, 10.9.2.2, 10.10.1.1
    • Component/s: SQL
    • Labels:
      None
    • Urgency:
      Normal
    • Issue & fix info:
      Repro attached

      Description

      When using territory-based collation with Clobs, Derby raises an error trying to invoke a missing method. The following script shows this problem:

      connect 'jdbc:derby:memory:db;create=true;collation=TERRITORY_BASED';

      create function makeClob( contents varchar( 32672 ) ) returns clob
      language java parameter style java no sql deterministic
      external name 'org.apache.derbyTesting.functionTests.tests.lang.UserDefinedAggregatesTest.makeClob';

      create table clobTable( a clob );

      – fails with a java.lang.NoSuchMethodError exception
      insert into clobTable( a ) values ( makeClob( 'a' ) );

      connect 'jdbc:derby:memory:db1;create=true';

      create function makeClob( contents varchar( 32672 ) ) returns clob
      language java parameter style java no sql deterministic
      external name 'org.apache.derbyTesting.functionTests.tests.lang.UserDefinedAggregatesTest.makeClob';

      create table clobTable( a clob );

      – succeeds
      insert into clobTable( a ) values ( makeClob( 'a' ) );

      Here is the error:

      ERROR 38000: The exception 'java.lang.NoSuchMethodError: org.apache.derby.iapi.types.DataValueFactory.getClobDataValue(Ljava/sql/Clob;Lorg/apache/derby/iapi/types/StringDataValue;I)Lorg/apache/derby/iapi/types/StringDataValue;' was thrown while evaluating an expression.
      ERROR XJ001: Java exception: 'org.apache.derby.iapi.types.DataValueFactory.getClobDataValue(Ljava/sql/Clob;Lorg/apache/derby/iapi/types/StringDataValue;I)Lorg/apache/derby/iapi/types/StringDataValue;: java.lang.NoSuchMethodError'.

      ...and here is the stack trace:

      Tue Oct 16 08:27:23 PDT 2012 Thread[main,5,main] (XID = 172), (SESSIONID = 1), (DATABASE = memory:db), (DRDAID = null), Failed Statement is: – fails with a java.lang.NoSuchMethodError exception
      insert into clobTable( a ) values ( makeClob( 'a' ) )
      ERROR 38000: The exception 'java.lang.NoSuchMethodError: org.apache.derby.iapi.types.DataValueFactory.getClobDataValue(Ljava/sql/Clob;Lorg/apache/derby/iapi/types/StringDataValue;I)Lorg/apache/derby/iapi/types/StringDataValue;' was thrown while evaluating an expression.
      at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
      at org.apache.derby.iapi.error.StandardException.unexpectedUserException(Unknown Source)
      at org.apache.derby.impl.services.reflect.DirectCall.invoke(Unknown Source)
      at org.apache.derby.impl.sql.execute.RowResultSet.getNextRowCore(Unknown Source)
      at org.apache.derby.impl.sql.execute.DMLWriteResultSet.getNextRowCore(Unknown Source)
      at org.apache.derby.impl.sql.execute.InsertResultSet.open(Unknown Source)
      at org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(Unknown Source)
      at org.apache.derby.impl.sql.GenericPreparedStatement.execute(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.execute(Unknown Source)
      at org.apache.derby.impl.tools.ij.ij.executeImmediate(Unknown Source)
      at org.apache.derby.impl.tools.ij.utilMain.doCatch(Unknown Source)
      at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(Unknown Source)
      at org.apache.derby.impl.tools.ij.utilMain.go(Unknown Source)
      at org.apache.derby.impl.tools.ij.Main.go(Unknown Source)
      at org.apache.derby.impl.tools.ij.Main.mainCore(Unknown Source)
      at org.apache.derby.impl.tools.ij.Main.main(Unknown Source)
      at org.apache.derby.tools.ij.main(Unknown Source)
      Caused by: java.lang.NoSuchMethodError: org.apache.derby.iapi.types.DataValueFactory.getClobDataValue(Ljava/sql/Clob;Lorg/apache/derby/iapi/types/StringDataValue;I)Lorg/apache/derby/iapi/types/StringDataValue;
      at org.apache.derby.exe.ace50d80a4x013ax6a2fxb54bx00000467ed600.e0(Unknown Source)
      ... 17 more

      1. enable-test.diff
        10 kB
        Knut Anders Hatlen
      2. derby-5951-01-aa-addMissingMethod.diff
        6 kB
        Rick Hillegas

        Activity

        Hide
        Rick Hillegas added a comment -

        Attaching derby-5951-01-aa-addMissingMethod.diff. This patches adds the missing method. I am running regression tests now.

        Touches the following files:

        --------------

        M java/engine/org/apache/derby/iapi/types/CollatorSQLClob.java
        M java/engine/org/apache/derby/iapi/types/DataValueFactoryImpl.java
        M java/engine/org/apache/derby/iapi/types/DataValueFactory.java

        Add the missing method.

        --------------

        M java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest.java

        Add test case for this bug.

        Show
        Rick Hillegas added a comment - Attaching derby-5951-01-aa-addMissingMethod.diff. This patches adds the missing method. I am running regression tests now. Touches the following files: -------------- M java/engine/org/apache/derby/iapi/types/CollatorSQLClob.java M java/engine/org/apache/derby/iapi/types/DataValueFactoryImpl.java M java/engine/org/apache/derby/iapi/types/DataValueFactory.java Add the missing method. -------------- M java/testing/org/apache/derbyTesting/functionTests/tests/lang/CollationTest.java Add test case for this bug.
        Hide
        Rick Hillegas added a comment -

        Tests passed cleanly for me on derby-5951-01-aa-addMissingMethod.diff. Committed at subversion revision 1398914.

        Show
        Rick Hillegas added a comment - Tests passed cleanly for me on derby-5951-01-aa-addMissingMethod.diff. Committed at subversion revision 1398914.
        Hide
        Rick Hillegas added a comment -

        Ported 1398914 to 10.9 branch at subversion 1398923 and to 10.8 branch at subversion 1398930. I will leave this issue open for a while in case someone wants to port this fix to older branches.

        Show
        Rick Hillegas added a comment - Ported 1398914 to 10.9 branch at subversion 1398923 and to 10.8 branch at subversion 1398930. I will leave this issue open for a while in case someone wants to port this fix to older branches.
        Hide
        Knut Anders Hatlen added a comment -

        The test case for this issue does not run as part of any of the test suites. The attached patch (enable-test.diff) enables it and fixes some typos to make it pass (the table name was misspelled in some SQL statements).

        Committed to trunk, revision 1430735.

        Show
        Knut Anders Hatlen added a comment - The test case for this issue does not run as part of any of the test suites. The attached patch (enable-test.diff) enables it and fixes some typos to make it pass (the table name was misspelled in some SQL statements). Committed to trunk, revision 1430735.

          People

          • Assignee:
            Rick Hillegas
            Reporter:
            Rick Hillegas
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development