You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by "Vladimir Ivanov (JIRA)" <ji...@apache.org> on 2006/02/13 10:30:43 UTC

[jira] Commented: (HARMONY-49) java.io.PushBackInputStream throws ArrayIndexOutOfBoundsException instead of IOException

    [ http://issues.apache.org/jira/browse/HARMONY-49?page=comments#action_12366166 ] 

Vladimir Ivanov commented on HARMONY-49:
----------------------------------------

At revision 377324 it is look OK. 

> java.io.PushBackInputStream throws ArrayIndexOutOfBoundsException instead of IOException
> ----------------------------------------------------------------------------------------
>
>          Key: HARMONY-49
>          URL: http://issues.apache.org/jira/browse/HARMONY-49
>      Project: Harmony
>         Type: Bug
>   Components: Classlib
>     Reporter: Vladimir Ivanov
>     Assignee: Tim Ellison
>     Priority: Minor

>
> java.io.PushBackInputStream throws ArrayIndexOutOfBoundsException if array length is not enough. Specification says it should be IOException.
> Code to reproduce:
> import java.io.*; 
>   
> public class test29 { 
>     public static void main(String args[]) { 
>         try { 
>           new PushbackInputStream( 
>                 new ByteArrayInputStream(new byte[] { 0 }), 2).unread(new byte[1], 0, 5); 
>         } catch (IOException e) { 
> 	        System.out.println("PASSED: "+ e); 
>         } catch (Throwable e) { 
> 	        System.out.println("FAILED: " + e); 
>         } 
>     } 
> }
> Steps to Reproduce: 
> 1. Build Harmony (check-out on 2006-01-25) j2se subset as described in README.txt. 
> 2. Compile test29.java using BEA 1.4 javac 
> > javac -d . test29.java 
> 3. Run java using compatible VM (J9) 
> > java -showversion test29
> Output:
> C:\tmp\tmp17>C:\jrockit-j2sdk1.4.2_04\bin\java.exe -showversion test29
> java version "1.4.2_04"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
> BEA WebLogic JRockit(TM) 1.4.2_04 JVM  (build ari-31788-20040616-1132-win-ia32, Native Threads, GC strategy: parallel)
> PASSED: java.io.IOException: Push back buffer is full
> C:\tmp\tmp17>C:\harmony\trunk\deploy\jre\bin\java -showversion test29
> java version 1.4.2 (subset)
> (c) Copyright 1991, 2005 The Apache Software Foundation or its licensors, as applicable.
> FAILED: java.lang.ArrayIndexOutOfBoundsException
> C:\tmp\tmp17>
> junit test:
> ------------------------ PushBackInputStreamTest.java ----------------------------------------------
> import java.io.*; 
> import junit.framework.*; 
>   
> public class PushBackInputStreamTest extends TestCase { 
>     public void testUnread() { 
>         try { 
>           new PushbackInputStream( 
>                 new ByteArrayInputStream(new byte[] { 0 }), 2).unread(new byte[1], 0, 5); 
>         } catch (IOException e) { 
>         } catch (Throwable e) { 
> 	        fail("unexpected exception: " + e); 
>         } 
>     } 
>    public static void main(String[] args) { 
>         junit.textui.TestRunner.run(PushBackInputStreamTest.class); 
>    } 
> }

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