You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Alexei Zakharov (JIRA)" <ji...@apache.org> on 2006/12/07 16:44:43 UTC
[jira] Updated: (HARMONY-2405) [classlib][luni]
java.io.ByteArrayInputStream wrongly sets protected pos and mark fields
[ http://issues.apache.org/jira/browse/HARMONY-2405?page=all ]
Alexei Zakharov updated HARMONY-2405:
-------------------------------------
Summary: [classlib][luni] java.io.ByteArrayInputStream wrongly sets protected pos and mark fields (was: java.io.ByteArrayInputStream wrongly sets protected pos and mark fields)
adding [classlib][luni] to summary
> [classlib][luni] java.io.ByteArrayInputStream wrongly sets protected pos and mark fields
> ----------------------------------------------------------------------------------------
>
> Key: HARMONY-2405
> URL: http://issues.apache.org/jira/browse/HARMONY-2405
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Reporter: Artem Aliev
> Priority: Minor
>
> java.io.ByteArrayInputStream wrongly sets protected pos and mark fields.
> According to the specification
> "If no mark has been set, then the value of mark is the offset passed to the
> constructor".
> RI sets mark and pos fields == offset while Harmony sets it equal buf.length.
> Test for reproducing:
> import junit.framework.TestCase;
> import java.io.*;
> public class test extends TestCase {
> public void test1 () {
> try {
> testByteArrayInputStream obj=new testByteArrayInputStream(new
> byte[]{1,2},444,13);
> assertEquals(444, testByteArrayInputStream.pos);
> } catch (IOException e) {
> fail("Unexpected IOException");
> }
> }
> public void test2 () {
> try {
> testByteArrayInputStream obj=new testByteArrayInputStream(new
> byte[]{1,2},444,13);
> assertEquals(444, testByteArrayInputStream.mark);
> } catch (IOException e) {
> fail("Unexpected IOException");
> }
> }
> }
> class testByteArrayInputStream extends ByteArrayInputStream {
> public static byte[] buf;
> public static int mark, pos;
> testByteArrayInputStream(byte[] buf, int offset,int length) throws
> IOException {
> super(buf, offset,length);
> buf=super.buf;
> mark=super.mark;
> pos=super.pos;
> }
> }
> Output on Sun 1.5:
> ==================
> .
> Time: 0
> OK (2 test)
> Output on Harmony:
> ==================
> .F.F
> Time: 0.016
> There were 2 failures:
> 1) test1(test)junit.framework.AssertionFailedError: expected:<444> but was:<2>
> at test.test1(test.java:8)
> at java.lang.reflect.VMReflection.invokeMethod(Native Method)
> 2) test2(test)junit.framework.AssertionFailedError: expected:<444> but was:<2>
> at test.test2(test.java:16)
> at java.lang.reflect.VMReflection.invokeMethod(Native Method)
> FAILURES!!!
> Tests run: 2, Failures: 2, Errors: 0
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira