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

InputStream returned from Blob.getBinaryStream(long, long) terminates the stream by returning 0, should return -1

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.3.3.0, 10.4.2.0, 10.5.1.1
    • Fix Version/s: 10.3.3.1, 10.4.2.1, 10.5.1.1
    • Component/s: JDBC
    • Labels:
      None

      Description

      Take the following code to copy a sub-stream from a BLOB:

      Blob blob = rs.getBlob(1);
      InputStream stream = blob.getBinaryStream(1000, 2000);
      try {
      IOUtils.copy(stream, out);
      } finally {
      stream.close();
      }

      This will loop forever in IOUtils.copy, as the InputStream is returning 0 at end of stream instead of -1. It probably should return -1 to comply with the Javadoc for InputStream.

      Notes:
      I have not yet checked Blob.getBinaryStream(), or any of the Clob methods, or the client driver. So some of these may have a similar issue.

        Attachments

        1. derby-4061-1a.diff
          2 kB
          Kristian Waagan
        2. derby-4061-1b.diff
          2 kB
          Kristian Waagan

          Activity

            People

            • Assignee:
              kristwaa Kristian Waagan
              Reporter:
              trejkaz Trejkaz
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: