harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Elena Sayapina (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-4357) [classlib][luni] Compatibility: CharArrayReader.reset() behavior differs on Harmony and RI if the stream hasn't been marked
Date Fri, 06 Jul 2007 05:50:04 GMT
[classlib][luni] Compatibility: CharArrayReader.reset() behavior differs on Harmony and RI
if the stream hasn't been marked
---------------------------------------------------------------------------------------------------------------------------

                 Key: HARMONY-4357
                 URL: https://issues.apache.org/jira/browse/HARMONY-4357
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Elena Sayapina
            Priority: Minor


CharArrayReader.reset() behavior differs on Harmony and RI if the stream hasn't been marked
If the stream was constructed to begin reading at a nonzero offset, Harmony reset the stream
to the very beginning while RI reset it to the initial offset.

Please, consider the following code:

import java.io.CharArrayReader;
import java.io.IOException;

public class CharReaderTest {

	static String str = "offsetHello world!";
	static char[] data = new char[str.length()];
	static int offsetLength = 6;
	static int length = data.length - offsetLength;
	
	public static void main(String[] args) throws IOException {
		for(int i=0; i<str.length(); i++) data[i] = str.charAt(i);
		CharArrayReader reader = new CharArrayReader(data, offsetLength, length);
		System.out.print("Before reset(): ");
		for (int i = 0; i < length; i++) System.out.print((char) reader.read());
		reader.reset();
		System.out.print("\nAfter reset(): ");
		for (int i = 0; i < length; i++) System.out.print((char) reader.read());	
	}
}

Output on Harmony-r553727:
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 = r553727, (Jul  6 2007), Windows/ia32/msvc 1310, release build
http://harmony.apache.org

Before reset(): Hello world!
After reset(): offsetHello

Output on RI:

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)

Before reset(): Hello world!
After reset(): Hello world!



-- 
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