harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r598681 - in /harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/io/StreamTokenizer.java test/api/common/tests/api/java/io/StreamTokenizerTest.java
Date Tue, 27 Nov 2007 16:14:58 GMT
Author: tellison
Date: Tue Nov 27 08:14:54 2007
New Revision: 598681

URL: http://svn.apache.org/viewvc?rev=598681&view=rev
Log:
Fix for HARMONY-4070 ([classlib][luni] Compatibility: StreamTokenizer.toString() returns different
values on Harmony and RI if current token is a special character like '*', ',' '-', '}', '&')

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/StreamTokenizer.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/StreamTokenizerTest.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/StreamTokenizer.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/StreamTokenizer.java?rev=598681&r1=598680&r2=598681&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/StreamTokenizer.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/StreamTokenizer.java
Tue Nov 27 08:14:54 2007
@@ -607,8 +607,13 @@
                 result.append(sval);
                 break;
             default:
-                result.append(sval);
-                break;
+                if (tokenTypes[ttype] == TOKEN_QUOTE) {
+                    result.append(sval);
+                } else {
+                    result.append('\'');
+                    result.append((char) ttype);
+                    result.append('\'');
+                }
         }
         result.append("], line "); //$NON-NLS-1$
         result.append(lineNumber);

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/StreamTokenizerTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/StreamTokenizerTest.java?rev=598681&r1=598680&r2=598681&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/StreamTokenizerTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/StreamTokenizerTest.java
Tue Nov 27 08:14:54 2007
@@ -17,6 +17,7 @@
 
 package tests.api.java.io;
 
+import java.io.ByteArrayInputStream;
 import java.io.CharArrayReader;
 import java.io.IOException;
 import java.io.PipedInputStream;
@@ -382,6 +383,14 @@
 		assertTrue("toString failed." + st.toString(),
 			   st.toString().equals(
 						"Token[ABC], line 1"));
+
+		// Regression test for HARMONY-4070
+        byte[] data = new byte[] { (byte) '-' };
+        StreamTokenizer tokenizer = new StreamTokenizer(
+                new ByteArrayInputStream(data));
+        tokenizer.nextToken();
+        String result = tokenizer.toString();
+        assertEquals("Token['-'], line 1", result);
 	}
 
 	/**



Mime
View raw message