[classlib][luni] Compatibility: StreamTokenizer.toString() returns different values on Harmony
and RI if current token is a string constant
-------------------------------------------------------------------------------------------------------------------------------------------
Key: HARMONY-3880
URL: https://issues.apache.org/jira/browse/HARMONY-3880
Project: Harmony
Issue Type: Bug
Components: Classlib
Reporter: Elena Sayapina
Priority: Trivial
Attachments: tokenizerTest.java
StreamTokenizer.toString() returns different values on Harmony and RI if current token is
a string constant:
Harmony returns string delimit character,
RI returns a string constant without string delimit characters.
Please, consider the following code:
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.StreamTokenizer;
public class tokenizerTest {
public static void main(String[] args) throws IOException {
byte[] data = new byte[] {(byte) '"',
(byte)
'H',
(byte) 'e',
(byte) 'l',
(byte) 'l',
(byte) 'o',
(byte) '"'};
StreamTokenizer tokenizer = new StreamTokenizer(new ByteArrayInputStream(data));
try {
tokenizer.nextToken();
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("sval: " + tokenizer.sval.toString());
String result = tokenizer.toString();
System.out.println("tokenizer.toString(): " + result);
if(result.equals("Token[Hello], line 1")) System.out.println("TEST PASSED");
else System.out.println("TEST FAILED");
}
}
Output on Harmony-r538431:
Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors,
as applicable.
java version "1.5.0"
pre-alpha : not complete or compatible
svn = r538431, (May 16 2007), Windows/ia32/msvc 1310, release build
http://incubator.apache.org/harmony
sval: Hello
tokenizer.toString(): Token['"'], line 1
TEST FAILED
Output on HotSpot:
java version "1.5.0_11"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)
Java HotSpot(TM) Client VM (build 1.5.0_11-b03, mixed mode)
sval: Hello
tokenizer.toString(): Token[Hello], line 1
TEST PASSED
Please, use attached tokenizerTest.java for the test reproducing.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
|