harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "spark shen (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-3880) [classlib][luni] Compatibility: StreamTokenizer.toString() returns different values on Harmony and RI if current token is a string constant
Date Tue, 22 May 2007 03:45:16 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-3880?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12497688
] 

spark shen commented on HARMONY-3880:
-------------------------------------

IMO, this bug could be viewed as a non-bug difference behavior.

According to spec:
quote>>

Returns the string representation of the current stream token and the line number it occurs
on.

The precise string returned is unspecified, although the following example can be considered
typical:

    Token['a'], line 10

quote<<

Will harmony's output break any real applications?
Anyway, I provided a patch, in case it is needed

> [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: StreamTokenier_HY3880.patch, 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.


Mime
View raw message