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] RI's bug of SerialBlob.position(byte[] pattern, long start)?
Date Thu, 14 Dec 2006 03:06:51 GMT
Cool. Since we all agreed to do exact search, I'll follow this way to
implement position(byte[] pattern, long pos)  in Harmony. :)

On 12/13/06, Oleg Khaschansky <oleg.v.khaschansky@gmail.com> wrote:
>
> > I wonder how Sun can release the code that is
> > completely broken? This is strange.
> Probably, SerialBlob.position(...) methods are not very popular.
> Simply noone noticed that they are broken. And noone needs to get a
> part of a BLOB into an array with getBytes, people tend to get the
> whole array and it works fine.
>
> On 12/13/06, Alexei Zakharov <alexei.zakharov@gmail.com> wrote:
> > It seems this is another RI's dark corner. The above tests look like
> > standard usage patterns for the position() method. Is there something
> > specific about them? I wonder how Sun can release the code that is
> > completely broken? This is strange.
> >
> > Regards,
> >
> > 2006/12/13, Oleg Khaschansky <oleg.v.khaschansky@gmail.com>:
> > > > BTW, what does the another version
> > > > of  position() method - position(Blob pattern, long start) - return
> in
> > > > these cases?
> > > I tried the following:
> > >        byte[] buf = { 1,3,9,1,1,3,2,2,4,2,3,9,3,3 };
> > >        SerialBlob blob = new SerialBlob(buf);
> > >
> > >        byte[]  pattern = new byte[] { 1,2,3 };
> > >        SerialBlob blob2 = new SerialBlob(pattern);
> > >        long pos = blob.position(blob2, 1);
> > >        System.out.println(pos);
> > > and, again, it returned 9. It seems like it does exactly the same as
> > > position(byte[] pattern, long start).
> > >
> > > Regarding its implementation, it's possible to simply get the byte
> > > array with pattern.getBytes(1, pattern.length()) and then use
> > > position(byte[] pattern, long start) with the obtained byte array.
> > >
> > > On 12/13/06, Alexei Zakharov <alexei.zakharov@gmail.com> wrote:
> > > > Looks like the RI bug to me also. BTW, what does the another version
> > > > of  position() method - position(Blob pattern, long start) - return
> in
> > > > these cases?
> > > >
> > > > Thanks,
> > > >
> > > > 2006/12/13, Tim Ellison <t.p.ellison@gmail.com>:
> > > > > Oleg Khaschansky wrote:
> > > > > > I am not a guru, but my understanding is that RI behavior is
> > > > > > errorneous. I'd say that from the client point of view BLOBs
are
> just
> > > > > > byte arrays. I suggest to do exact search instead of following
> RI.
> > > > >
> > > > > Same for me -- looks like the right answer but don't claim expert
> > > > > knowledge in the area.
> >
> >
> >
> > --
> > Alexei Zakharov,
> > Intel ESSD
> >
>



-- 
Best regards,
Andrew Zhang

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