harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lian...@apache.org
Subject svn commit: r487184 - in /harmony/enhanced/classlib/trunk/modules/nio_char/src: main/java/java/nio/charset/CharsetDecoder.java test/java/tests/api/java/nio/charset/CharsetDecoderTest.java
Date Thu, 14 Dec 2006 12:02:43 GMT
Author: liangyx
Date: Thu Dec 14 04:02:41 2006
New Revision: 487184

URL: http://svn.apache.org/viewvc?view=rev&rev=487184
Log:
When ICU repports a malformed-input result, the input buffer's position is incremented

Modified:
    harmony/enhanced/classlib/trunk/modules/nio_char/src/main/java/java/nio/charset/CharsetDecoder.java
    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/main/java/java/nio/charset/CharsetDecoder.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/nio_char/src/main/java/java/nio/charset/CharsetDecoder.java?view=diff&rev=487184&r1=487183&r2=487184
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/nio_char/src/main/java/java/nio/charset/CharsetDecoder.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/nio_char/src/main/java/java/nio/charset/CharsetDecoder.java
Thu Dec 14 04:02:41 2006
@@ -388,6 +388,7 @@
                 int remaining = in.remaining();
                 if (endOfInput && remaining > 0) {
                     result = CoderResult.malformedForLength(remaining);
+                    in.position(in.position() + result.length());
                 } else {
                     status = endOfInput ? END : ONGOING;
                     return result;
@@ -411,7 +412,9 @@
                 if (action != CodingErrorAction.IGNORE)
                     return result;
             }
-            in.position(in.position() + result.length());
+            if (!result.isMalformed()) {
+                in.position(in.position() + result.length());
+            }
         }
     }
 

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?view=diff&rev=487184&r1=487183&r2=487184
==============================================================================
--- 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
Thu Dec 14 04:02:41 2006
@@ -717,7 +717,7 @@
 			String result = new String(input);
 			if (result.startsWith("malform")) {
 				// reset the cursor to the error position
-				in.position(inPosition);
+				in.position(inPosition + "malform".length());
 				// set the error length
 				return CoderResult.malformedForLength("malform".length());
 			} else if (result.startsWith("unmap")) {



Mime
View raw message