Return-Path: Delivered-To: apmail-incubator-harmony-dev-archive@www.apache.org Received: (qmail 49728 invoked from network); 14 Aug 2006 16:14:15 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 14 Aug 2006 16:14:15 -0000 Received: (qmail 70663 invoked by uid 500); 14 Aug 2006 16:14:11 -0000 Delivered-To: apmail-incubator-harmony-dev-archive@incubator.apache.org Received: (qmail 70611 invoked by uid 500); 14 Aug 2006 16:14:11 -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 70600 invoked by uid 99); 14 Aug 2006 16:14:10 -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 09:14:10 -0700 X-ASF-Spam-Status: No, hits=1.4 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: 64.74.244.70 is neither permitted nor denied by domain of geir@pobox.com) Received: from [64.74.244.70] (HELO smtp.ivresearch.com) (64.74.244.70) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 14 Aug 2006 09:14:10 -0700 Received: (qmail 32029 invoked from network); 14 Aug 2006 16:13:46 -0000 Received: from ool-43560edb.dyn.optonline.net (HELO ?192.168.1.101?) (geir@67.86.14.219) by vdmx01.ivresearch.net with SMTP; 14 Aug 2006 16:13:46 -0000 Message-ID: <44E0A13A.20803@pobox.com> Date: Mon, 14 Aug 2006 12:13:46 -0400 From: Geir Magnusson Jr Reply-To: geir@pobox.com User-Agent: Thunderbird 1.5.0.5 (Windows/20060719) MIME-Version: 1.0 To: harmony-dev@incubator.apache.org Subject: Re: [DRLVM][JNI]GetByteArrayRegion differs from RI (was Re: Exceptions found while running servlet...) References: <11f7653a0608092244y74fd7187rbfdba08bec29bea5@mail.gmail.com> <44DAEBEA.9000806@gmail.com> <44DAEEF5.5040204@gmail.com> <44DAFF7A.2060204@gmail.com> <44DB1E27.6070808@gmail.com> <44DBED16.5030400@gmail.com> <208da7a50608110657r77cdbbcet3cc6b042bc9779a@mail.gmail.com> <12385bbd0608120255g4b377ac2pa38b06d937d9cc88@mail.gmail.com> In-Reply-To: <12385bbd0608120255g4b377ac2pa38b06d937d9cc88@mail.gmail.com> X-Enigmail-Version: 0.94.0.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Ivan Volosyuk wrote: > It looks like that it is possible to get zero bytes even at the very > end of array. IMHO the order of boundary checks makes sense here. This is an interesting problem. The JNI spec is clear that we should throw an exception when one of the indexes isn't valid, and start == size is arguably not valid, as Gregory points out. So I think the JNI impl is right for now (but I want to test w/ the JNI impl in RI....) As for classlibrary : I was testing with the RI vi java.io.OutputStream#write(buff[], offset, len), and the RI is clearly broken as it doesn't throw an NPE when [] is null. However, strictly speaking, 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. Therefore, I'll start a new thread re refining OutputStream to match those rules, and then go on to test the JNI impl of the RI. geir > -- > Ivan > > On 8/11/06, Gregory Shimansky wrote: >> 2006/8/11, Jimmy, Jing Lv : >> > >> > Hi, >> > >> > As discussed in the former thread, I find that a JNI of DRLVM >> > (GetByteArrayRegion) differs from RI in passing parameter >> > (byte[count],count,0). RI (and J9 VM) returns immediately but DRLVM >> > throws an ArrayIndexOutOfBoundsException. >> > IMHO, it is better to improve here, make it follow RI, as JNI is >> > also a part of API, and users may use it. So if no objections, shall I >> > or someone raise a JIRA for this? >> > >> > I don't know if Martin is urgent in using Harmony in Winstone >> > servlet engine (Martin, can you read this?), so shall I work around in >> > java code before we have conclusion? >> > >> > Any comments/suggestions from DRLVM guys? Thanks! >> > >> >> I didn't really understand the condition when vm throws AIOBE. Do you >> pass >> start parameter count for the array of count length? But in this case the >> start points to the element right after the array end. And spec [1] >> explicitly states that this function should throw AIOBE in this case. Is >> there something I don't understand? >> >> [1] >> http://java.sun.com/j2se/1.5.0/docs/guide/jni/spec/functions.html#wp6212 >> >> -- >> Gregory Shimansky, Intel Middleware Products Division >> >> > > --------------------------------------------------------------------- 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