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] Closed: (HARMONY-2405) [classlib][luni] java.io.ByteArrayInputStream wrongly sets protected pos and mark fields
Date Tue, 24 Apr 2007 15:47:17 GMT

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


Mime
View raw message