db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sunitha Kambhampati (JIRA)" <derby-...@db.apache.org>
Subject [jira] Updated: (DERBY-900) Remove use of String(byte[]) and String(byte[], int, int) constructors in network client leading to non-portable behaviour
Date Wed, 12 Apr 2006 01:54:20 GMT
     [ http://issues.apache.org/jira/browse/DERBY-900?page=all ]

Sunitha Kambhampati updated DERBY-900:
--------------------------------------

    Attachment: derby900.diff.p1.txt
                derby900.stat.p1.txt

This patch (derby900.diff.p1.txt and derby900.stat.p1.txt ) is for the trunk, and  focuses
on fixing the usage of default string constructors in the client that can cause encoding problems.
  

I searched in Eclipse for the String(byte[]) and String(byte[],int,int)  constructors and
in the current codeline there is one such method in sqlca.java#bytes2String which is used
in about 7 places. 

Please note, there are some more encoding issues as Kathey points out in  http://issues.apache.org/jira/browse/DERBY-877#action_12364297
http://issues.apache.org/jira/browse/DERBY-951

I discussed with Kathey on IRC yesterday.
-- String.getBytes() is used in a number of places (DateTime,NetConnectionReply) which will
need to be fixed. 
-- Server always sends UTF8 encoding for the SQLCARD strings, hence the bytes2String method
needs to correctly use UTF8 encoding to decode the strings.

This fix
-- use UTF8 encoding in bytes2String.

Tests:
I have used the repro for DERBY-583 (Thanks Kathey) that uses lang/ConcurrentImplicitCreateSchema.java
that shows the problem. I have also added this test to run as part of the encodingTests in
trunk.

To repro on windows, 
java -Dframework=DerbyNetClient -DderbyTesting.encoding=UTF-16 org.apache.derbyTesting.functionTests.harness.RunTest
lang/ConcurrentImplicitCreateSchema.java

Results: 
without this fix, the exception sqlstate is all garbled up.
with this fix, the test should pass without any diff.

Ran derbyall with the patch on linux/ibm142 with no new failures ( insane jars)

I am continuing to look at the other encoding issues.   Please review/commit this patch if
it looks good. Thanks.  

> Remove use of String(byte[]) and String(byte[], int, int) constructors in network client
leading to non-portable behaviour
> --------------------------------------------------------------------------------------------------------------------------
>
>          Key: DERBY-900
>          URL: http://issues.apache.org/jira/browse/DERBY-900
>      Project: Derby
>         Type: Bug

>   Components: Network Client
>     Reporter: Daniel John Debrunner
>      Fix For: 10.2.0.0
>  Attachments: derby900.diff.p1.txt, derby900.stat.p1.txt
>
> These constructors use the Java default platform encoding to convert the bytes to a String,
this typically leads to bugs on platforms with different encodings.
> Replace with code using fixed conversion, or alternative mechanisms. 
> If the call is required its use should be commented as to why it is required.
> org.apache.derby.client.am.ClobOutputStream - some existing bug?
> org.apache.derby.client.am.DateTime - see DERBY-877
> org.apache.derby.client.am.sqlca
> I generated this list using the Java search in eclipse for references to the constructors
> String(byte[])
> String(byte[],int,int)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message