db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject svn commit: r292414 - /db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java
Date Thu, 29 Sep 2005 11:05:54 GMT
Author: tmnk
Date: Thu Sep 29 04:05:49 2005
New Revision: 292414

URL: http://svn.apache.org/viewcvs?rev=292414&view=rev
Log:
DERBY-525 - getAsciiStreamshould replace non-ASCII characters with 0x3f, '?' to match embedded
- Patch by Tomohito Nakayama (tomonaka@basil.ocn.ne.jp)

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

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java?rev=292414&r1=292413&r2=292414&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java Thu Sep 29 04:05:49
2005
@@ -879,13 +879,10 @@
         checkGetterPreconditions(column);
         java.io.InputStream result = null;
         if (wasNonNullSensitiveUpdate(column)) {
-            try {
-                result = new java.io.ByteArrayInputStream
-                        (((String) agent_.crossConverters_.setObject(java.sql.Types.CHAR,
-                                updatedColumns_[column - 1])).getBytes("US-ASCII"));
-            } catch (java.io.UnsupportedEncodingException e) {
-                throw new SqlException(agent_.logWriter_, e, e.getMessage());
-            }
+		
+		result = new java.io.ByteArrayInputStream
+			(convertToAsciiByteArray((String) agent_.crossConverters_.setObject(java.sql.Types.CHAR,
+											    updatedColumns_[column - 1])));
         } else {
             result = isNull(column) ? null : cursor_.getAsciiStream(column);
         }
@@ -3882,4 +3879,23 @@
             }
         }
     }
+
+	
+	private static byte[] convertToAsciiByteArray(String original){
+
+		byte[] result = new byte[original.length()];
+
+		for(int i = 0;
+		    i < original.length();
+		    i ++){
+			
+			if(original.charAt(i) <= 0x00ff)
+				result[i] = (byte) original.charAt(i);
+			else
+				result[i] = 0x003f;
+		}
+
+		return result;
+
+	}
 }



Mime
View raw message