Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-2618

EmbedClob.setAsciiStream does not handle non-ascii characters correctly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Invalid
    • 10.3.1.4
    • 10.3.1.4
    • JDBC
    • None

    Description

      If non-ascii characters are written to the Writer returned by EmbedClob.setAsciiStream, Derby fails with a 'java.io.UTFDataFormatException' when the CLOB value is read back.

      I'm filing this bug with 'Major' priority, as the bug does not manifest itself when entering data, just when you try to get it back. Except from filtering the data yourself before entering it, I don't think there is any workaround.

      Sample stack trace from a modified test:

      1) testClobAsciiWrite1ParamKRISTIWAA(org.apache.derbyTesting.functionTests.tests.jdbcapi.LobStreamsTest)java.sql.SQLException: Unable to set stream: 'java.io.UTFDataFormatException'.
      at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:95)
      at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:88)
      at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:94)
      at org.apache.derby.impl.jdbc.Util.setStreamFailure(Util.java:246)
      at org.apache.derby.impl.jdbc.EmbedClob.length(EmbedClob.java:190)
      at org.apache.derby.impl.jdbc.EmbedPreparedStatement.setClob(EmbedPreparedStatement.java:1441)
      at org.apache.derbyTesting.functionTests.tests.jdbcapi.LobStreamsTest.testClobAsciiWrite1ParamKRISTIWAA(LobStreamsTest.java:255)
      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:88)
      Caused by: java.sql.SQLException: Unable to set stream: 'java.io.UTFDataFormatException'.
      at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45)
      at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:135)
      at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
      ... 22 more

      Attachments

        1. derby2618_partial_v1.txt
          3 kB
          Daniel John Debrunner
        2. derby2618_partial_v2.txt
          6 kB
          Daniel John Debrunner
        3. derby2618_partial_v4.txt
          4 kB
          Daniel John Debrunner
        4. derby2618_partial_v5-ontopofv4.diff
          0.6 kB
          Kristian Waagan
        5. Derby2618BugsInClobAsciiStream.java
          6 kB
          Kristian Waagan
        6. derby-2618v3.diff
          7 kB
          Anurag Aggarwal

        Issue Links

          Activity

            People

              Unassigned Unassigned
              kristwaa Kristian Waagan
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: