Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 41045 invoked from network); 4 Jul 2007 13:18:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Jul 2007 13:18:29 -0000 Received: (qmail 25710 invoked by uid 500); 4 Jul 2007 13:18:30 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 25683 invoked by uid 500); 4 Jul 2007 13:18:30 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 25495 invoked by uid 99); 4 Jul 2007 13:18:29 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Jul 2007 06:18:29 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Jul 2007 06:18:25 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 5EBD44297D0 for ; Wed, 4 Jul 2007 06:18:05 -0700 (PDT) Message-ID: <17745926.1183555085385.JavaMail.jira@brutus> Date: Wed, 4 Jul 2007 06:18:05 -0700 (PDT) From: "Tony Wu (JIRA)" To: commits@harmony.apache.org Subject: [jira] Resolved: (HARMONY-4337) [classlib][luni] Compatibility: InputStream.write(null, offset, len) exception throwing order differs on Harmony and RI if offset is negative In-Reply-To: <18961515.1183551004760.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ 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.