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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]>:
> On 12/14/06, Alexei Zakharov <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]>:
> > > Hey guys,
> > >
> > > How about this one? It seems a bug of RI too.
> > >
> > > Any comments? Thanks!
> > >
> > > On 12/11/06, Andrew Zhang <[EMAIL PROTECTED]> 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

Reply via email to