db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r374469 - /db/derby/code/trunk/java/client/org/apache/derby/client/am/ClobOutputStream.java
Date Thu, 02 Feb 2006 19:32:18 GMT
Author: kmarsden
Date: Thu Feb  2 11:32:16 2006
New Revision: 374469

URL: http://svn.apache.org/viewcvs?rev=374469&view=rev
Log:
DERBY-683 Use correct encoding for ClobOutputStream on client

Change to use US-ASCII instead of jvm default encoding


Modified:
    db/derby/code/trunk/java/client/org/apache/derby/client/am/ClobOutputStream.java

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/ClobOutputStream.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/am/ClobOutputStream.java?rev=374469&r1=374468&r2=374469&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/ClobOutputStream.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/ClobOutputStream.java Thu Feb
 2 11:32:16 2006
@@ -37,7 +37,9 @@
         byte[] newByte = new byte[1];
         newByte[0] = (byte)b;
         clob_.string_ = clob_.string_.substring(0, (int) offset_ - 1);
-        clob_.string_ = clob_.string_.concat(new String(newByte));
+        // Since this is an OutputStream returned by Clob.setAsciiStream 
+        // use Ascii encoding when creating the String from bytes
+        clob_.string_ = clob_.string_.concat(new String(newByte, "US-ASCII"));
         clob_.asciiStream_ = new java.io.StringBufferInputStream(clob_.string_);
         clob_.unicodeStream_ = new java.io.StringBufferInputStream(clob_.string_);
         clob_.characterStream_ = new java.io.StringReader(clob_.string_);
@@ -58,7 +60,9 @@
 
         byte[] newByte = new byte[len];
         System.arraycopy(b, off, newByte, 0, len);
-        String str = new String(newByte);
+        // Since this is an OutputStream returned by Clob.setAsciiStream 
+        // use Ascii encoding when creating the String from bytes
+        String str = new String(newByte, "US-ASCII");
         clob_.string_ = clob_.string_.substring(0, (int) offset_ - 1);
         clob_.string_ = clob_.string_.concat(str);
         clob_.asciiStream_ = new java.io.StringBufferInputStream(clob_.string_);



Mime
View raw message