Derby
  1. Derby
  2. DERBY-3898

Blob.setBytes differs between embedded and client driver when the specified length is invalid

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 10.3.3.0, 10.4.2.0, 10.5.1.1, 10.6.1.0
    • Fix Version/s: 10.7.1.1
    • Component/s: JDBC
    • Labels:
    • Urgency:
      Normal
    • Issue & fix info:
      Newcomer
    • Bug behavior facts:
      Embedded/Client difference

      Description

      Blob.setBytes behaves differently with the embedded driver and the client driver.
      Assume a 1 byte array and a specified length of 2: Blob.setBytes(1, new byte[]

      {0x69}

      , 0, 2)
      Embedded: IndexOutOfBoundsException (from java.io.RandomAccessFile.writeBytes or System.arraycopy)
      Client: succeeds, returns insertion count 1

      The behavior should be made consistent, but what is the correct behavior?

      From the Blob.setBytes JavaDoc:
      "Writes all or part of the given byte array to the BLOB value that this Blob object represents and returns the number of bytes written. Writing starts at position pos in the BLOB value; len bytes from the given byte array are written. The array of bytes will overwrite the existing bytes in the Blob object starting at the position pos. If the end of the Blob value is reached while writing the array of bytes, then the length of the Blob value will be increased to accomodate the extra bytes."

      1. Derby3898.java
        1 kB
        Kathey Marsden
      2. derby-3898-1.patch
        13 kB
        Yun Lee
      3. derby-3898-1.stat
        0.4 kB
        Yun Lee
      4. derby-3898-testcase.patch
        3 kB
        Yun Lee
      5. derby-3898-testcase.stat
        0.1 kB
        Yun Lee
      6. enable-javame.diff
        0.9 kB
        Knut Anders Hatlen
      7. overflow.diff
        2 kB
        Knut Anders Hatlen

        Issue Links

          Activity

          Kristian Waagan created issue -
          Kristian Waagan made changes -
          Field Original Value New Value
          Link This issue is part of DERBY-310 [ DERBY-310 ]
          Kathey Marsden made changes -
          Attachment Derby3898.java [ 12393105 ]
          Myrna van Lunteren made changes -
          Affects Version/s 10.5.1.1 [ 12313771 ]
          Affects Version/s 10.5.0.0 [ 12313010 ]
          Kristian Waagan made changes -
          Affects Version/s 10.6.0.0 [ 12313727 ]
          Urgency Urgent
          Issue & fix info [Newcomer]
          Kathey Marsden made changes -
          Urgency Urgent Normal
          Kristian Waagan made changes -
          Labels BLOB
          Yun Lee made changes -
          Assignee Yun Lee [ yunlee ]
          Yun Lee made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          Yun Lee made changes -
          Attachment derby-3898-testcase.stat [ 12449082 ]
          Attachment derby-3898-testcase.patch [ 12449083 ]
          Yun Lee made changes -
          Issue & fix info [Newcomer] [Newcomer, Patch Available]
          Yun Lee made changes -
          Attachment derby-3898-1.stat [ 12451515 ]
          Attachment derby-3898-1.patch [ 12451516 ]
          Myrna van Lunteren made changes -
          Fix Version/s 10.7.0.0 [ 12314971 ]
          Issue & fix info [Newcomer, Patch Available] [Newcomer]
          Myrna van Lunteren made changes -
          Status In Progress [ 3 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Knut Anders Hatlen made changes -
          Attachment overflow.diff [ 12452270 ]
          Knut Anders Hatlen made changes -
          Issue & fix info [Newcomer] [Newcomer, Patch Available]
          Knut Anders Hatlen made changes -
          Attachment enable-javame.diff [ 12452273 ]
          Knut Anders Hatlen made changes -
          Issue & fix info [Newcomer, Patch Available] [Newcomer]
          Myrna van Lunteren made changes -
          Link This issue is part of DERBY-4609 [ DERBY-4609 ]
          Kristian Waagan made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Rick Hillegas made changes -
          Fix Version/s 10.7.1.1 [ 12315564 ]
          Fix Version/s 10.7.1.0 [ 12314971 ]
          Gavin made changes -
          Workflow jira [ 12443350 ] Default workflow, editable Closed status [ 12799769 ]

            People

            • Assignee:
              Yun Lee
              Reporter:
              Kristian Waagan
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development