harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Artem Aliev (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-2407) java.io.BufferedInputStream(null,9) returns another internal buffer that RI
Date Mon, 04 Dec 2006 11:44:24 GMT
java.io.BufferedInputStream(null,9) returns another internal buffer that RI
---------------------------------------------------------------------------

                 Key: HARMONY-2407
                 URL: http://issues.apache.org/jira/browse/HARMONY-2407
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Artem Aliev
            Priority: Minor


Compatibility issue.
According to the specification "protected volatile byte[] buf - The internal
buffer array where the data is stored. When necessary, it may be replaced by
another array of a different size".
Harmony returns for BufferedInputStream(InputStream in, int size) buf==null if
in==null. RI returns non-null buf with length==size. 

Test for reproducing:
import junit.framework.TestCase;
import java.io.*;

public class test extends TestCase {      
    public void test1 () { 
        try {            
           testBufferedInputStream obj=new testBufferedInputStream(null,9); 
           assertEquals(9,testBufferedInputStream.buf.length);
        } catch (IOException e) {
            fail("Unexpected IOException");
        }
    }       
}
class testBufferedInputStream extends BufferedInputStream   {
   static byte[] buf; 
   testBufferedInputStream(InputStream is, int size) throws IOException {
      super(is, size);
      buf=super.buf; 
   }    
}

Output on Sun 1.5:
==================
.
Time: 0

OK (1 test)

Output on Harmony:
==================
.E
Time: 0.015
There was 1 error:
1) test1(test)java.lang.NullPointerException
        at test.test1(test.java:8)
        at java.lang.reflect.VMReflection.invokeMethod(Native Method)


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