Return-Path: Delivered-To: apmail-incubator-harmony-dev-archive@www.apache.org Received: (qmail 47081 invoked from network); 15 Aug 2006 02:42:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 15 Aug 2006 02:42:03 -0000 Received: (qmail 37824 invoked by uid 500); 15 Aug 2006 02:41:56 -0000 Delivered-To: apmail-incubator-harmony-dev-archive@incubator.apache.org Received: (qmail 37772 invoked by uid 500); 15 Aug 2006 02:41:56 -0000 Mailing-List: contact harmony-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: harmony-dev@incubator.apache.org Delivered-To: mailing list harmony-dev@incubator.apache.org Received: (qmail 37761 invoked by uid 99); 15 Aug 2006 02:41:56 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Aug 2006 19:41:56 -0700 X-ASF-Spam-Status: No, hits=1.9 required=10.0 tests=DNS_FROM_RFC_ABUSE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: 202.81.18.154 is neither permitted nor denied by domain of firepure@gmail.com) Received: from [202.81.18.154] (HELO ausmtp05.au.ibm.com) (202.81.18.154) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Aug 2006 19:41:55 -0700 Received: from sd0208e0.au.ibm.com (d23rh904.au.ibm.com [202.81.18.202]) by ausmtp05.au.ibm.com (8.13.6/8.13.6) with ESMTP id k7F2i4XF7438388 for ; Tue, 15 Aug 2006 12:44:04 +1000 Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.250.244]) by sd0208e0.au.ibm.com (8.13.6/8.13.6/NCO v8.1.1) with ESMTP id k7F2idfj196664 for ; Tue, 15 Aug 2006 12:44:49 +1000 Received: from d23av03.au.ibm.com (loopback [127.0.0.1]) by d23av03.au.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id k7F2fFRO001980 for ; Tue, 15 Aug 2006 12:41:15 +1000 Received: from d23m0011.cn.ibm.com (d23m0011.cn.ibm.com [9.181.32.74]) by d23av03.au.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id k7F2f3ju001588 for ; Tue, 15 Aug 2006 12:41:15 +1000 Received: from [9.181.107.166] ([9.181.107.166]) by d23m0011.cn.ibm.com (Lotus Domino Release 6.5.5HF262) with ESMTP id 2006081510402222-8236 ; Tue, 15 Aug 2006 10:40:22 +0800 Message-ID: <44E133CC.70309@gmail.com> Date: Tue, 15 Aug 2006 10:39:08 +0800 From: "Jimmy, Jing Lv" User-Agent: Thunderbird 1.5.0.5 (Windows/20060719) MIME-Version: 1.0 To: harmony-dev@incubator.apache.org Subject: Re: [classlib][luni] Problem with java.io.OutputStream References: <44E0A1B9.2060005@pobox.com> In-Reply-To: <44E0A1B9.2060005@pobox.com> X-MIMETrack: Itemize by SMTP Server on D23M0011/23/M/IBM(Release 6.5.5HF262 | April 5, 2006) at 15/08/2006 10:40:31, Serialize by Router on D23M0011/23/M/IBM(Release 6.5.5HF262 | April 5, 2006) at 15/08/2006 10:42:32, Serialize complete at 15/08/2006 10:42:32 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=ISO-8859-1; format=flowed X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Geir Magnusson Jr wrote: > When looking at HARMONY-1156, it became clear that our > java.io.OutputStream isn't right. > > I'd like to make the following changes : > > Follow the spec so that an IndexOOBE is thrown when : > > a) offset is negative or > b) len is negative or > c) off + len > buff.length > > So in the case of > > write( byte[count], count, 0); > > for any value of count >= 0, then none of the conditions are true, and > it should simply [quickly] return. > > Now, the spec says that if the array is null, then a NPE should be > thrown, but this doesn't happen in the RI when len = 0. > > This seems to be a reasonable thing to do, and therefore I think that we > should match the RI here, and not the spec. > > Comments? > Hi Geir, Sorry I don't catch well here. I write a test[1], extends OutputStream and try passing a null byte and len = 0, RI and Harmony both throw NPE(windows XP sp2, RI 1.5.06, the lastest Harmony,J9/DRLVM). And HARMONY-1156 only asks if given "write( byte[count], count, 0);" the write operation quickly returns. And we see it is better to fix in JNI, am I right? In fact, IMHO we are NOT breaking spec in return quickly as spec does not tell clear what "indexes in the region is not valid"? :) [1] public void test_OutputStream () throws IOException { try { new MockOutputStream().write(null, 0, 0); fail("should throw NPE"); } catch (NullPointerException e) { // expected } } class MockOutputStream extends OutputStream { public void write(int oneByte) throws IOException { throw new NotYetImplementedException(); } } > geir > > > --------------------------------------------------------------------- > Terms of use : http://incubator.apache.org/harmony/mailing.html > To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org > For additional commands, e-mail: harmony-dev-help@incubator.apache.org > > -- Best Regards! Jimmy, Jing Lv China Software Development Lab, IBM --------------------------------------------------------------------- Terms of use : http://incubator.apache.org/harmony/mailing.html To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org For additional commands, e-mail: harmony-dev-help@incubator.apache.org