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

[classlib][sql] SerialBlob.truncate(long length) should not change buffer length is the length parameter is invalid.

    XMLWordPrintableJSON

Details

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

    Description

      Hi, as discussed in dev mailing list, SerialBlob.truncate(long length) should not change buffer length is the length parameter is invalid. Following test shows the case:
      public void testTruncateJ() throws Exception {
      byte[] buf =

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

      ;
      SerialBlob serialBlob1 = new SerialBlob(buf);
      try

      { serialBlob1.truncate(-1); }

      catch (SerialException e)

      { System.out.println(e.getMessage()); }

      System.out.println(serialBlob1.length());
      }
      RI output is as follow:
      Invalid arguments: position cannot be less that 1
      -1
      The buffer length is changed to -1 while SerialException is thrown too. Keeping the length as the old value makes more sense. Harmony won't follow RI's behaviour for this case, and keep it as a non-different-bug from RI.

      Best regards,
      Andrew

      Attachments

        1. patch.diff
          0.7 kB
          Zhang Huang Zhu

        Activity

          People

            tellison Tim Ellison
            zhanghuangzhu Zhang Huang Zhu
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: