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 Fri, 09 Sep 2011 09:25:09 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: d5236-4a-client-compatibility.diff

Attaching a new patch that disables the server-side fix when talking to old clients, since
those clients may get a StringIndexOutOfBoundsException if they receive longer strings, and
also because they don't know exactly how to handle java.sql.DataTruncation warnings.

I've manually verified that old clients (tested 10.1.2.1 and 10.8.1.2) receive shorter strings
(just like they did before this issue) instead of failing with a StringIndexOutOfBoundsException
for these longer strings. Running the full regression test suite now.

The fix is only disabled on releases prior to 10.8.2, on the assumption that the fix gets
into the upcoming 10.8.2 release. If it doesn't we'll have to change that logic on trunk.

> 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
>            Assignee: Knut Anders Hatlen
>         Attachments: d5236-1a-client-fetch-complete.diff, d5236-2a-longer-strings.diff,
d5236-3a-warning.diff, d5236-4a-client-compatibility.diff, repro.diff, write-full-string.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