Uploaded image for project: 'Harmony'
  1. Harmony
  2. HARMONY-2723

[classlib][sql] RI returns positive value when SerialBlob.position (byte[] pattern, long start) can't find the pattern.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • None
    • None
    • None

    Description

      RI's behaviour of SerialBlob.postion(byte[] pattern, long start) looks strange. Consider following code:
      private void testPosition_BytePattern()
      throws SerialException, SQLException {

      byte[] buf =

      { 1, 2, 3, 4, 5, 6, 7, 8 }

      ;
      SerialBlob blob = new SerialBlob(buf);

      byte[] pattern = new byte[]

      { 2, 4 }

      ;
      long pos = blob.position(pattern, 1);
      System.out.println("pos = " + pos);
      // FIXME: RI's bug?
      assertEquals(-1, pos);

      }

      RI's output:
      pos = 3
      Harmony's output:
      pos = -1

      As discussed in the mailing list, we'd regard it as a bug of RI. And the implementation of Harmony looks reasonable. Thanks!

      Best regards,
      Andrew

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              zhanghuangzhu Zhang Huang Zhu
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: