Return-Path: Delivered-To: apmail-harmony-dev-archive@www.apache.org Received: (qmail 13120 invoked from network); 14 Dec 2006 13:02:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 14 Dec 2006 13:02:06 -0000 Received: (qmail 23602 invoked by uid 500); 14 Dec 2006 13:02:11 -0000 Delivered-To: apmail-harmony-dev-archive@harmony.apache.org Received: (qmail 23573 invoked by uid 500); 14 Dec 2006 13:02:11 -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 23564 invoked by uid 99); 14 Dec 2006 13:02:11 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Dec 2006 05:02:11 -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.189 as permitted sender) Received: from [64.233.182.189] (HELO nf-out-0910.google.com) (64.233.182.189) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Dec 2006 05:02:01 -0800 Received: by nf-out-0910.google.com with SMTP id a4so876141nfc for ; Thu, 14 Dec 2006 05:01:40 -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=T6SCyr8TDZ3ryfTZox9vY/OxSHizhipetwqUzocw4k6vTxDrNSOv9xIUtsNtRm77GOVaklScsmdq3wDujcmeJacq79APUwFXrPItGCUwNpTaXmw9QjfEVO++P8XfrMqH621iuALn+GdhcaVFodYliHkUnqREaMeRUSVW8FFlYg8= Received: by 10.82.162.14 with SMTP id k14mr87352bue.1166101299525; Thu, 14 Dec 2006 05:01:39 -0800 (PST) Received: by 10.82.115.8 with HTTP; Thu, 14 Dec 2006 05:01:39 -0800 (PST) Message-ID: <4d0b24970612140501t4a7dab5cp7611dfbbf8893ebd@mail.gmail.com> Date: Thu, 14 Dec 2006 21:01:39 +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: <2c9597b90612140130y6eddb4d4ha678257f717c7b49@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_23320_3930667.1166101299452" References: <4d0b24970612110347y65fa62f3n51b13eca0c4bd3d1@mail.gmail.com> <4d0b24970612130701hed88583l7ea76f1f00203e10@mail.gmail.com> <2c9597b90612140130y6eddb4d4ha678257f717c7b49@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_23320_3930667.1166101299452 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline 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! > > > > > > -- > > > Best regards, > > > Andrew Zhang > > > > > > > > > > > -- > > Best regards, > > Andrew Zhang > > > > > > > -- > Alexei Zakharov, > Intel ESSD > -- Best regards, Andrew Zhang ------=_Part_23320_3930667.1166101299452--