You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Tony Wu (JIRA)" <ji...@apache.org> on 2007/07/04 15:18:05 UTC
[jira] Resolved: (HARMONY-4337) [classlib][luni] Compatibility:
InputStream.write(null, offset, len) exception throwing order differs on
Harmony and RI if offset is negative
[ https://issues.apache.org/jira/browse/HARMONY-4337?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tony Wu resolved HARMONY-4337.
------------------------------
Resolution: Fixed
Hi Elena,
I believe you mean InputStream.read :)
I've fixed it at r553194, please verify. Thanks.
> [classlib][luni] Compatibility: InputStream.write(null, offset, len) exception throwing order differs on Harmony and RI if offset is negative
> ---------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: HARMONY-4337
> URL: https://issues.apache.org/jira/browse/HARMONY-4337
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Reporter: Elena Sayapina
> Assignee: Tony Wu
> Priority: Minor
>
> InputStream.write(null, offset, len) exception throwing order differs on Harmony and RI if offset is negative
> This method throws ArrayIndexOutOfBoundsException on Harmony if byte array is null and offset is negative, but throw NullPointerException on RI.
> Please, consider the following code:
> import java.io.IOException;
> import java.io.InputStream;
> public class InputStreamTest {
> public static void main(String[] args) {
> byte[] array = null;
> try {
> InputStream out = new InputStreamImpl();
> out.read(array, -1, 1);
> } catch (NullPointerException e) {
> System.out.println("TEST OK: " + e);
> } catch (Exception e) {
> System.out.println("TEST: NullPointerException was expected but " +
> e.getClass().getName() + " was thrown");
> }
> }
> }
> class InputStreamImpl extends InputStream {
> public int read() throws IOException {
> return 0;
> }
> }
> Output on Harmony-r553113:
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors,
> as applicable.
> java version "1.5.0"
> pre-alpha : not complete or compatible
> svn = r553113, (Jul 4 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> TEST: NullPointerException was expected but java.lang.ArrayIndexOutOfBoundsException was thrown
> Output on RI:
> java version "1.5.0_11"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)
> Java HotSpot(TM) Client VM (build 1.5.0_11-b03, mixed mode)
> TEST OK: java.lang.NullPointerException
> Please, note that if byte array is null and length is negative NullPointerException is thrown on Harmony as on RI
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.