Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-1516

Inconsistent behavior for getBytes and getSubString for embedded versus network

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 10.2.1.6
    • Component/s: JDBC
    • Labels:
      None

      Description

      org.apache.derby.client.am.Clob.getSubString(pos, length) and org.apache.derby.client.am.Blob.getBytes(pos, length) check the length for less than zero.

      if ((pos <= 0) || (length < 0)) {
      throw new SqlException(agent_.logWriter_, "Invalid position " + pos + " or length " + length);

      But org.apache.derby.impl.jdbc.EmbedClob(pos, length) and org.apache.derby.impl.jdbc.EmbedBlob(pos, length) check the length for less than or equal to zero.

      if (length <= 0)
      throw Util.generateCsSQLException(
      SQLState.BLOB_NONPOSITIVE_LENGTH, new Integer(length));

      The specification does not disallow length of zero, so zero length should be allowed. I believe that the implementation in org.apache.derby.client.am is correct, and the implementation in org.apache.derby.impl.jdbc is incorrect.

        Attachments

        1. DERBY-1516.patch
          52 kB
          Craig L Russell
        2. DERBY-1516.patch
          45 kB
          Craig L Russell
        3. DERBY-1516.patch
          51 kB
          Craig L Russell
        4. DERBY-1516.patch
          53 kB
          Craig L Russell
        5. DERBY-1516.patch
          6 kB
          Craig L Russell
        6. DERBY-1516.patch
          5 kB
          Craig L Russell
        7. DERBY-1516.patch
          1 kB
          Craig L Russell

          Issue Links

            Activity

              People

              • Assignee:
                clr Craig L Russell
                Reporter:
                clr Craig L Russell
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: