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

svn commit: r763861 - /harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Scanner.java

Author: qiuxx
Date: Fri Apr 10 03:18:14 2009
New Revision: 763861

URL: http://svn.apache.org/viewvc?rev=763861&view=rev
Log:
Apply for HARMONY-6086,([luni] java.util.Scanner nextLine and hasNextLine testcase would fail)

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Scanner.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Scanner.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Scanner.java?rev=763861&r1=763860&r2=763861&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Scanner.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Scanner.java Fri Apr 10 03:18:14 2009
@@ -818,9 +818,11 @@
         boolean hasNextLine = false;
         while (true) {
             if (matcher.find()) {
-                matchSuccessful = true;
-                hasNextLine = true;
-                break;
+                if (inputExhausted || matcher.end() != bufferLength) {
+                    matchSuccessful = true;
+                    hasNextLine = true;
+                    break;
+                }
             } else {
                 if (inputExhausted) {
                     matchSuccessful = false;
@@ -1392,10 +1394,12 @@
         String result = null;
         while (true) {
             if (matcher.find()) {
-                matchSuccessful = true;
-                findStartIndex = matcher.end();
-                result = matcher.group();
-                break;
+                if (inputExhausted || matcher.end() != bufferLength) {
+                    matchSuccessful = true;
+                    findStartIndex = matcher.end();
+                    result = matcher.group();
+                    break;
+                }
             } else {
                 if (inputExhausted) {
                     matchSuccessful = false;