You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Elena Sayapina (JIRA)" <ji...@apache.org> on 2007/07/06 07:50:04 UTC

[jira] Created: (HARMONY-4357) [classlib][luni] Compatibility: CharArrayReader.reset() behavior differs on Harmony and RI if the stream hasn't been marked

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


[jira] Assigned: (HARMONY-4357) [classlib][luni] Compatibility: CharArrayReader.reset() behavior differs on Harmony and RI if the stream hasn't been marked

Posted by "Tony Wu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4357?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tony Wu reassigned HARMONY-4357:
--------------------------------

    Assignee: Tony Wu

> [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
>            Assignee: Tony Wu
>            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.


[jira] Resolved: (HARMONY-4357) [classlib][luni] Compatibility: CharArrayReader.reset() behavior differs on Harmony and RI if the stream hasn't been marked

Posted by "Tony Wu (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4357?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tony Wu resolved HARMONY-4357.
------------------------------

    Resolution: Fixed

Hi Elena,

Fixed at r553757, please check if it fixed as you expected. Thanks.

> [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
>            Assignee: Tony Wu
>            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.


[jira] Closed: (HARMONY-4357) [classlib][luni] Compatibility: CharArrayReader.reset() behavior differs on Harmony and RI if the stream hasn't been marked

Posted by "Elena Sayapina (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4357?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Elena Sayapina closed HARMONY-4357.
-----------------------------------


Thank you, Tony.
Verified using Harmony-r554868-msvc-release.


> [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
>            Assignee: Tony Wu
>            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.