db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (DERBY-5236) Client driver silently truncates strings that exceed 32KB
Date Tue, 17 May 2011 16:07:47 GMT

     [ https://issues.apache.org/jira/browse/DERBY-5236?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Knut Anders Hatlen updated DERBY-5236:
--------------------------------------

    Attachment: repro.diff

The attached patch adds a regression test case for the bug. The test case isn't enabled in
any suites yet. Committed revision 1104365.

The test case passes with the embedded driver, and fails like this with the client driver:

There was 1 failure:
1) testLongColumn(org.apache.derbyTesting.functionTests.tests.jdbcapi.Derby5236Test)junit.framework.AssertionFailedError:
Column value mismatch @ column '1', row 1:
    Expected: >丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐(...)<
    Found:    >丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐丐(...)<
	at org.apache.derbyTesting.junit.JDBC.assertRowInResultSet(JDBC.java:1213)
	at org.apache.derbyTesting.junit.JDBC.assertRowInResultSet(JDBC.java:1125)
	at org.apache.derbyTesting.junit.JDBC.assertFullResultSetMinion(JDBC.java:1012)
	at org.apache.derbyTesting.junit.JDBC.assertFullResultSet(JDBC.java:935)
	at org.apache.derbyTesting.junit.JDBC.assertFullResultSet(JDBC.java:892)
	at org.apache.derbyTesting.junit.JDBC.assertFullResultSet(JDBC.java:850)
	at org.apache.derbyTesting.junit.JDBC.assertSingleValueResultSet(JDBC.java:835)
	at org.apache.derbyTesting.functionTests.tests.jdbcapi.Derby5236Test.testLongColumn(Derby5236Test.java:57)
	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:112)
	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 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)

> Client driver silently truncates strings that exceed 32KB
> ---------------------------------------------------------
>
>                 Key: DERBY-5236
>                 URL: https://issues.apache.org/jira/browse/DERBY-5236
>             Project: Derby
>          Issue Type: Bug
>          Components: Network Client
>    Affects Versions: 10.8.1.2
>            Reporter: Knut Anders Hatlen
>         Attachments: repro.diff
>
>
> Can be seen with this JUnit test case that retrieves a VARCHAR value with 20000 characters.
With the client driver, the string is truncated to 10900 characters (32700 bytes when encoded
in UTF-8).
>     public void testLongColumn() throws SQLException {
>         PreparedStatement ps = prepareStatement(
>                 "values cast(? as varchar(20000))");
>         char[] chars = new char[20000];
>         Arrays.fill(chars, '\u4e10');
>         String str = new String(chars);
>         ps.setString(1, str);
>         JDBC.assertSingleValueResultSet(ps.executeQuery(), str);
>     }

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message