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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]>:
> > 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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]>:
> > > 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