Return-Path: Delivered-To: apmail-harmony-dev-archive@www.apache.org Received: (qmail 2406 invoked from network); 15 Dec 2006 12:58:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 15 Dec 2006 12:58:29 -0000 Received: (qmail 5498 invoked by uid 500); 15 Dec 2006 12:47:05 -0000 Delivered-To: apmail-harmony-dev-archive@harmony.apache.org Received: (qmail 5199 invoked by uid 500); 15 Dec 2006 12:47:03 -0000 Mailing-List: contact dev-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 dev@harmony.apache.org Received: (qmail 4448 invoked by uid 99); 15 Dec 2006 12:47:00 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Dec 2006 04:46:57 -0800 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of zhanghuangzhu@gmail.com designates 64.233.182.184 as permitted sender) Received: from [64.233.182.184] (HELO nf-out-0910.google.com) (64.233.182.184) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Dec 2006 22:26:12 -0800 Received: by nf-out-0910.google.com with SMTP id a4so1101333nfc for ; Thu, 14 Dec 2006 22:25:50 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=SxkKVmPxRY8EPHzA5689/Xq3GDnWp2YrKwoBlX0OaaH39MNhbJwNso3zvElu/YIWilRsNpyxDmupNU3WK16A3QzTtiYmOp2fJSPhDpXb0KXsIG5mnS3J9uk38keLfQTjxLgfuHabWswSerq/M5tTM+QI0xjS4mS7elCjBnc3Xy4= Received: by 10.82.111.8 with SMTP id j8mr65079buc.1166163949861; Thu, 14 Dec 2006 22:25:49 -0800 (PST) Received: by 10.82.115.8 with HTTP; Thu, 14 Dec 2006 22:25:49 -0800 (PST) Message-ID: <4d0b24970612142225h8bb74b2l952d33984321940f@mail.gmail.com> Date: Fri, 15 Dec 2006 14:25:49 +0800 From: "Andrew Zhang" To: dev@harmony.apache.org Subject: Re: [classlib][sql] A RI's bug of SerialBlob.getBytes(long position, int length)? In-Reply-To: <2c9597b90612140509m5bdda478hfc6cd85ab250fe88@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_35668_20530931.1166163949834" References: <4d0b24970612110347y65fa62f3n51b13eca0c4bd3d1@mail.gmail.com> <4d0b24970612130701hed88583l7ea76f1f00203e10@mail.gmail.com> <2c9597b90612140130y6eddb4d4ha678257f717c7b49@mail.gmail.com> <4d0b24970612140501t4a7dab5cp7611dfbbf8893ebd@mail.gmail.com> <2c9597b90612140509m5bdda478hfc6cd85ab250fe88@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_35668_20530931.1166163949834 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline I've filed a non-bug-differences-from-RI JIRA Harmony-2725 for this issue. A patch including the test case was also uploaded. Thanks! On 12/14/06, Alexei Zakharov wrote: > > BTW, the problem is reproducible on the recently released 6.0 JRE too. > The same "less that 1". > > Regards, > > 2006/12/14, Andrew Zhang : > > On 12/14/06, Alexei Zakharov wrote: > > > > > > That one? If you are talking about the problem mentioned in your > > > initial message > > > > > > Sorry... we've agreed that the behaviour of SerialBlob.position(byte[], > > long) is a bug in another thread. Yes, "This one" means the initial > message > > -- getByte(long, int) method. But seldom people reponsed this thread to > > regard it as a bug. :) > > > > > > public void testGetBytesJI1() throws Exception { > > > > > byte[] buf = { 1, 2, 3, 4, 5, 6, 7, 8 }; > > > > > SerialBlob serialBlob = new SerialBlob(buf); > > > > > byte [] data = serialBlob.getBytes(2, 1); > > > > > assertEquals(1, data.length); > > > > > assertEquals(2, data[0]); > > > > > } > > > > > throws SerialException with message "Invalid arguments: position > > > cannot be > > > > > less that 1". > > > > > > then +1 from me for following the spec since I don't understand RI's > > > behavior at all. Please note that even the exception message itself > > > contains typos :) > > > > > > LOL, I just noticed "less that 1"... > > > > Regards, > > > > > > 2006/12/13, Andrew Zhang : > > > > Hey guys, > > > > > > > > How about this one? It seems a bug of RI too. > > > > > > > > Any comments? Thanks! > > > > > > > > On 12/11/06, Andrew Zhang wrote: > > > > > > > > > > Hi folks, > > > > > SerialBlob spec points out that getBytes(long position, int > length) > > > should > > > > > throw SerialException if the given starting position is out of > bounds. > > > But > > > > > RI also throws SerialException when the position is in the bound > of > > > the > > > > > array in some other cases. Consider following code: > > > > > > > > > > public void testGetBytesJI1() throws Exception { > > > > > byte[] buf = { 1, 2, 3, 4, 5, 6, 7, 8 }; > > > > > SerialBlob serialBlob = new SerialBlob(buf); > > > > > byte [] data = serialBlob.getBytes(2, 1); > > > > > assertEquals(1, data.length); > > > > > assertEquals(2, data[0]); > > > > > } > > > > > > > > > > IMO, the starting position 2 and the length 1 are both valid. But > RI > > > > > throws SerialException with message "Invalid arguments: position > > > cannot be > > > > > less that 1". Is it a bug of RI? Or did I missing something? Any > > > > > suggestions? Thanks in advance! > > > > -- > Alexei Zakharov, > Intel ESSD > -- Best regards, Andrew Zhang ------=_Part_35668_20530931.1166163949834--