harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tim Ellison (JIRA)" <j...@apache.org>
Subject [jira] Assigned: (HARMONY-2405) [classlib][luni] java.io.ByteArrayInputStream wrongly sets protected pos and mark fields
Date Thu, 28 Dec 2006 13:59:23 GMT
     [ 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

        

Mime
View raw message