[ http://issues.apache.org/jira/browse/DERBY-683?page=all ]

Deepa Remesh updated DERBY-683:
-------------------------------

    Attachment: derby-683.diff
                clob.java

Attaching a patch 'derby-683.diff'. 

The write methods in ClobOutputStream were using default encoding when 
constructing a String from bytes. ClobOutputStream is the output stream 
returned by call to Clob.setAsciiStream. This is meant to be a stream to which 
ascii encoded characters can be written. So the writes to this stream should 
not be using default encoding.  This patch changes the write methods to use 
String constructors with ascii encoding. 

Currently, I have a repro to test this. I am working on adding a test to the 
harness. This requires some changes to the test harness and I would like to 
submit this as a separate patch. To test this using the repro, run the 
following command on Windows with Sun JDK1.5:

java -Dfile.encoding=UTF-16 -Doutput.encoding=Cp1252 clob

With this patch, I have run derbyall on Windows with Sun JDK 1.4.2. No 
failures. It would be good if someone can look at this patch and commit the 
code changes if they are okay. I will submit the harness changes and a test in 
a separate patch.

> Use correct encoding for ClobOutputStream on client
> ---------------------------------------------------
>
>          Key: DERBY-683
>          URL: http://issues.apache.org/jira/browse/DERBY-683
>      Project: Derby
>         Type: Bug
>   Components: Network Client
>     Versions: 10.1.1.1, 10.1.1.0
>  Environment: all
>     Reporter: Sunitha Kambhampati
>     Assignee: Deepa Remesh
>      Fix For: 10.2.0.0
>  Attachments: ascii.txt, clob.java, derby-683.diff
>
> In client, there is code in ClobOutputStream which uses this api - new 
> String(byte[]).   Per the java api 
> http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html#String(byte[]) 
> ,this will construct a string by decoding the array of bytes using the 
> platform's default character set. 
> org.apache.derby.client.am.ClobOutputStream is used for Clob.setAsciiStream 
> and the write methods  use the String(byte[]) which is incorrect because it 
> will use the default platform encoding. Per the jdbcapi , this should use 
> ascii encoding. 
> In areas related to Clobs, also check for other places where  String(byte[]) 
> is used,as it may not be the desired behavior. 
> Dan pointed this problem here : 
> http://issues.apache.org/jira/browse/DERBY-463?page=comments#action_12356742

-- 
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

Reply via email to