harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Zhang" <zhanghuang...@gmail.com>
Subject Re: [classlib][sql] SerialBlob.setBytes exception thrown compatibility issue
Date Wed, 27 Dec 2006 05:50:59 GMT
On 12/27/06, Alexei Zakharov <alexei.zakharov@gmail.com> wrote:
>
> > FYI. Harmony-2335, 2836 were filed for SerialBlob.setBytes methods.
>
> HARMONY-2335: "The DRLVM fails to start if -Djava.library.path specified"
> :)
> You probably mean 2835.


I'm wondering how I typed "3" instead of "8", although they're a bit
similar... :-)


> Regards,
>
> 2006/12/21, Andrew Zhang <zhanghuangzhu@gmail.com>:
> > FYI. Harmony-2335, 2836 were filed for SerialBlob.setBytes methods.
> >
> > On 12/19/06, Andrew Zhang <zhanghuangzhu@gmail.com> wrote:
> > >
> > > Hi guys,
> > >
> > > Any other opnions? If no one objects, I'll file a
> non-bug-difference-from
> > > RI JIRA for this issue. Thanks!
> > >
> > >
> > > On 12/18/06, Andrew Zhang <zhanghuangzhu@gmail.com> wrote:
> > > >
> > > > Hi guys,
> > > >
> > > > It's SerialBlob again. It's the third time to ask similar question
> about
> > > > SerialBlob class. :)
> > > > Let's take a look at the spec of setBytes(long pos,byte [] bytes,
> int
> > > > offset, int length).   Throws SerialException - if there is an error
> > > > accessing the BLOB value; if an invalid position is set; if an
> invalid
> > > > offset value is set; if number of bytes to be written is greater
> than the
> > > > SerialBlob length; or the combined values of the length and offset
> is
> > > > greater than the Blob buffer
> > > >
> > > > As my understanding, the tortuous words shows that setBytes should
> throw
> > > > SerialException if there's any array index outbound. But following
> code
> > > > shows that RI's behaviour looks weird:
> > > > public void testSetBytes() throws Exception {
> > > >         byte[] buf = { 1, 2, 3, 4, 5, 6, 7, 8 };
> > > >         byte[] theBytes = { 9, 9, 9 };
> > > >         SerialBlob serialBlob = new SerialBlob(buf);
> > > >         serialBlob.setBytes (7, theBytes); //
> > > > ArrayIndexOutOfBoundsException
> > > >         serialBlob.setBytes(7, theBytes, 0, 3); //
> > > > ArrayIndexOutOfBoundsException
> > > >         serialBlob.setBytes(7, theBytes, 0, 10); // SerialException
> > > >     }
> > > > Let's look at the spec again, what does "the combined values of the
> > > > length and offset is greater than the Blob buffer " mean? The
> previous
> > > > sentence already says "if number of bytes to be written (length) is
> greater
> > > > than the SerialBlob length(Blob buffer)".
> > > >
> > > > The spec of another similar method setBytes(long pos, byte[] bytes)
> > > > looks more interesting:
> > > > SerialException - if there is an error accessing the BLOB value; or
> if
> > > > an invalid position is set; if an invalid offset value is set
> > > > But who can tell me what does "if an invalid offset value is set"
> mean?
> > > > :-)
> > > >
> > > > The SerialBlob class looks scary to me.  What shall we do for
> setBytes?
> > > > Follow RI or always throw SerialException for invalid array index?
> > > > Personally I prefer to the latter one, and if it breaks any existing
> > > > application or fails TCK tests later, then let's fix it. Any
> > > > suggestions/comments? Thanks in advance!
>
>
>
> --
> Alexei Zakharov,
> Intel ESSD
>



-- 
Best regards,
Andrew Zhang

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message