You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by od...@apache.org on 2009/05/18 19:07:20 UTC

svn commit: r776011 - /harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/tests/api/java/nio/charset/CharsetDecoderTest.java

Author: odeakin
Date: Mon May 18 17:07:20 2009
New Revision: 776011

URL: http://svn.apache.org/viewvc?rev=776011&view=rev
Log:
Ensure test data is not converted to the native character set when creating the String from the original byte array.

Modified:
    harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/tests/api/java/nio/charset/CharsetDecoderTest.java

Modified: harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/tests/api/java/nio/charset/CharsetDecoderTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/tests/api/java/nio/charset/CharsetDecoderTest.java?rev=776011&r1=776010&r2=776011&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/tests/api/java/nio/charset/CharsetDecoderTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/nio_char/src/test/java/tests/api/java/nio/charset/CharsetDecoderTest.java Mon May 18 17:07:20 2009
@@ -795,7 +795,12 @@
             int inPosition = in.position();
             byte[] input = new byte[in.remaining()];
             in.get(input);
-            String result = new String(input);
+            String result;
+            try {
+                result = new String(input, "UTF-8");
+            } catch (UnsupportedEncodingException e) {
+                throw new AssertionError(e);
+            }
             if (result.startsWith("malform")) {
                 // reset the cursor to the error position
                 in.position(inPosition);