harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zhouke...@apache.org
Subject svn commit: r803780 - in /harmony/enhanced/classlib/trunk/modules/sql/src: main/java/org/apache/harmony/sql/internal/rowset/CachedRowSetImpl.java test/java/org/apache/harmony/sql/tests/internal/rowset/CachedRowSetStreamTest.java
Date Thu, 13 Aug 2009 05:44:59 GMT
Author: zhoukevin
Date: Thu Aug 13 05:44:58 2009
New Revision: 803780

URL: http://svn.apache.org/viewvc?rev=803780&view=rev
Log:
Fix failures of testGetAsciiStream_Longvarchar, testGetAsciiStream_varchar, testGetUnicodeStream,
testUpdateAsciiStream and testSetAsciiStream of CachedRowSetStreamTest for zOS

Modified:
    harmony/enhanced/classlib/trunk/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/CachedRowSetImpl.java
    harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/CachedRowSetStreamTest.java

Modified: harmony/enhanced/classlib/trunk/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/CachedRowSetImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/CachedRowSetImpl.java?rev=803780&r1=803779&r2=803780&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/CachedRowSetImpl.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/CachedRowSetImpl.java
Thu Aug 13 05:44:58 2009
@@ -2442,7 +2442,11 @@
             throw ex;
         }
 
-        updateString(columnIndex, new String(byteArray));
+        try {
+            updateString(columnIndex, new String(byteArray, "ISO-8859-1")); //$NON-NLS-1$
+        } catch (java.io.UnsupportedEncodingException e) {
+            throw new RuntimeException(e.getMessage());
+        }
     }
 
     public void updateAsciiStream(String columnName, InputStream x, int length)

Modified: harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/CachedRowSetStreamTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/CachedRowSetStreamTest.java?rev=803780&r1=803779&r2=803780&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/CachedRowSetStreamTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/CachedRowSetStreamTest.java
Thu Aug 13 05:44:58 2009
@@ -241,7 +241,7 @@
             out.write(i);
         }
 
-        byte[] expected = value.getBytes();
+        byte[] expected = value.getBytes("ISO8859-1");
 
         byte[] actual = out.toByteArray();
 
@@ -281,7 +281,7 @@
             out.write(i);
         }
 
-        byte[] expected = value.getBytes();
+        byte[] expected = value.getBytes("ISO8859-1");
 
         byte[] actual = out.toByteArray();
 
@@ -348,7 +348,7 @@
             out.write(i);
         }
 
-        byte[] expected = "test".getBytes();
+        byte[] expected = "test".getBytes("ISO8859-1");
         byte[] actual = out.toByteArray();
 
         assertEquals(expected.length, actual.length);
@@ -779,30 +779,27 @@
         }
 
         String value = new String("\u548c\u8c10");
-        in = new ByteArrayInputStream(value.getBytes());
+        in = new ByteArrayInputStream(value.getBytes("ISO-8859-1"));
         crset.updateAsciiStream(2, in, in.available());
 
         obj = crset.getObject(2);
         assertTrue(obj instanceof String);
-        assertEquals(new String(value.getBytes()), obj);
 
-        byte[] bytes = ((String) obj).getBytes();
-        byte[] expected = value.getBytes();
+        byte[] bytes = ((String) obj).getBytes("ISO-8859-1");
+        byte[] expected = value.getBytes("ISO-8859-1");
         assertEquals(expected.length, bytes.length);
         for (int i = 0; i < bytes.length; i++) {
             assertEquals(expected[i], bytes[i]);
         }
 
         value = new String("\u548d\u8c1a");
-        in = new ByteArrayInputStream(value.getBytes());
+        in = new ByteArrayInputStream(value.getBytes("ISO-8859-1"));
         crset.updateAsciiStream(3, in, in.available());
 
         obj = crset.getObject(3);
         assertTrue(obj instanceof String);
-        assertEquals(new String(value.getBytes()), obj);
-
-        bytes = ((String) obj).getBytes();
-        expected = value.getBytes();
+        bytes = ((String) obj).getBytes("ISO-8859-1");
+        expected = value.getBytes("ISO-8859-1");
         assertEquals(expected.length, bytes.length);
         for (int i = 0; i < bytes.length; i++) {
             assertEquals(expected[i], bytes[i]);
@@ -1207,8 +1204,8 @@
         crset.setCommand("update STREAM set LONGVARCHAR_T=? where ID= ?");
 
         String value = "It's    is a very very very long long long story";
-        crset.setAsciiStream(1, new ByteArrayInputStream(value.getBytes()),
-                value.getBytes().length);
+        byte[] bytes = value.getBytes("ISO-8859-1");
+        crset.setAsciiStream(1, new ByteArrayInputStream(bytes), bytes.length);
         crset.setInt(2, 1);
 
         if ("true".equals(System.getProperty("Testing Harmony"))) {



Mime
View raw message