You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Artem Aliev (JIRA)" <ji...@apache.org> on 2006/12/04 12:35:21 UTC
[jira] Created: (HARMONY-2405) java.io.ByteArrayInputStream wrongly
sets protected pos and mark fields
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
[jira] Updated: (HARMONY-2405) [classlib][luni]
java.io.ByteArrayInputStream wrongly sets protected pos and mark fields
Posted by "Tony Wu (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-2405?page=all ]
Tony Wu updated HARMONY-2405:
-----------------------------
Attachment: harmony-2405.diff
spec discribes the behavior of this constructor explicitly. would you please try my patch. Thanks.
> [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
> Attachments: harmony-2405.diff
>
>
> 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
[jira] Assigned: (HARMONY-2405) [classlib][luni]
java.io.ByteArrayInputStream wrongly sets protected pos and mark fields
Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-2405?page=all ]
Tim Ellison reassigned HARMONY-2405:
------------------------------------
Assignee: Tim Ellison
> [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
> Assigned To: Tim Ellison
> Priority: Minor
> Attachments: harmony-2405.diff
>
>
> 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
[jira] Updated: (HARMONY-2405) [classlib][luni]
java.io.ByteArrayInputStream wrongly sets protected pos and mark fields
Posted by "Alexei Zakharov (JIRA)" <ji...@apache.org>.
[ 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
[jira] Resolved: (HARMONY-2405) [classlib][luni]
java.io.ByteArrayInputStream wrongly sets protected pos and mark fields
Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-2405?page=all ]
Tim Ellison resolved HARMONY-2405.
----------------------------------
Resolution: Fixed
Thanks Artem / Tony.
Patch applied to LUNI module at repo revision r490730.
Please check that the patch was applied as you expected.
> [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
> Assigned To: Tim Ellison
> Priority: Minor
> Attachments: harmony-2405.diff
>
>
> 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
[jira] Closed: (HARMONY-2405) [classlib][luni]
java.io.ByteArrayInputStream wrongly sets protected pos and mark fields
Posted by "Tim Ellison (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HARMONY-2405?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tim Ellison closed HARMONY-2405.
--------------------------------
No response, assuming ok.
> [classlib][luni] java.io.ByteArrayInputStream wrongly sets protected pos and mark fields
> ----------------------------------------------------------------------------------------
>
> Key: HARMONY-2405
> URL: https://issues.apache.org/jira/browse/HARMONY-2405
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Reporter: Artem Aliev
> Assigned To: Tim Ellison
> Priority: Minor
> Attachments: harmony-2405.diff
>
>
> 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.
-
You can reply to this email to add a comment to the issue online.