Derby
  1. Derby
  2. DERBY-4531

Client setCharacterStream closes its Reader argument stream in finalizer

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 10.2.1.6, 10.2.2.0, 10.3.1.4, 10.3.2.1, 10.3.3.0, 10.4.1.3, 10.4.2.0, 10.5.1.1, 10.5.2.0, 10.5.3.0, 10.6.1.0
    • Fix Version/s: 10.7.1.1
    • Component/s: Network Client
    • Issue & fix info:
      Repro attached
    • Bug behavior facts:
      Embedded/Client difference, Regression

      Description

      The javadoc for PreparedStatement.setCharacterStream does not specify that the stream passed in will be closed, only that it will read to the number of characters specified.
      For the embedded driver, the stream is not closed after execution; the client driver, however, will close the stream when the internal stream object EncodedInputStream is garbage collected, which can happen any time after the statement has been executed.
      I am not sure this a bug vs. the JDBC specification, but it would be nice to harmonize client and embedded behavior on this.

      1. Repro.java
        14 kB
        Dag H. Wanvik
      2. derby-4531b.stat
        0.2 kB
        Dag H. Wanvik
      3. derby-4531b.diff
        3 kB
        Dag H. Wanvik
      4. derby-4531-1a-test_workaround.diff
        2 kB
        Kristian Waagan
      5. derby-4531.diff
        0.5 kB
        Dag H. Wanvik

        Issue Links

          Activity

          Gavin made changes -
          Workflow jira [ 12497632 ] Default workflow, editable Closed status [ 12802354 ]
          Mamta A. Satoor made changes -
          Link This issue relates to DERBY-6082 [ DERBY-6082 ]
          Kathey Marsden made changes -
          Status Reopened [ 4 ] Closed [ 6 ]
          Resolution Fixed [ 1 ]
          Kathey Marsden made changes -
          Labels derby_backport_reject_10_6
          Kathey Marsden made changes -
          Resolution Fixed [ 1 ]
          Status Closed [ 6 ] Reopened [ 4 ]
          Rick Hillegas made changes -
          Fix Version/s 10.7.1.1 [ 12315564 ]
          Fix Version/s 10.7.1.0 [ 12314971 ]
          Kristian Waagan made changes -
          Affects Version/s 10.6.1.0 [ 12313727 ]
          Dag H. Wanvik made changes -
          Fix Version/s 10.7.0.0 [ 12314971 ]
          Dag H. Wanvik made changes -
          Status Open [ 1 ] Closed [ 6 ]
          Resolution Fixed [ 1 ]
          Dag H. Wanvik made changes -
          Issue & fix info [Release Note Needed, Repro attached] [Repro attached]
          Dag H. Wanvik made changes -
          Issue & fix info [Patch Available, Release Note Needed, Repro attached] [Release Note Needed, Repro attached]
          Dag H. Wanvik made changes -
          Attachment derby-4531b.diff [ 12452443 ]
          Attachment derby-4531b.stat [ 12452444 ]
          Dag H. Wanvik made changes -
          Assignee Dag H. Wanvik [ dagw ]
          Dag H. Wanvik made changes -
          Issue & fix info [Repro attached] [Patch Available, Release Note Needed, Repro attached]
          Dag H. Wanvik made changes -
          Attachment derby-4531.diff [ 12444156 ]
          Kristian Waagan made changes -
          Attachment derby-4531-1a-test_workaround.diff [ 12443078 ]
          Dag H. Wanvik made changes -
          Issue & fix info [Repro attached]
          Dag H. Wanvik made changes -
          Attachment Repro.java [ 12434439 ]
          Dag H. Wanvik made changes -
          Description The javadoc for PreparedStatement.setCharacterStream does not specify that the stream passed in will be closed, only that it will be read to the number of chaaracters required or to EOF, whatever happens first.
          For the embedded driver, the stream is not closed after execution; the client driver, however, will close the stream when the internal stream object EncodedInputStream is garbage collected, which can happen any time after the statement has been executed.
          I am not sure this a bug vs. the JDBC specification, but it would be nice to harmonize client and embedded behavior on this.
          The javadoc for PreparedStatement.setCharacterStream does not specify that the stream passed in will be closed, only that it will read to the number of characters specified.
          For the embedded driver, the stream is not closed after execution; the client driver, however, will close the stream when the internal stream object EncodedInputStream is garbage collected, which can happen any time after the statement has been executed.
          I am not sure this a bug vs. the JDBC specification, but it would be nice to harmonize client and embedded behavior on this.
          Dag H. Wanvik made changes -
          Bug behavior facts [Embedded/Client difference] [Embedded/Client difference, Regression]
          Dag H. Wanvik made changes -
          Field Original Value New Value
          Affects Version/s 10.5.3.0 [ 12314117 ]
          Affects Version/s 10.5.2.0 [ 12314116 ]
          Affects Version/s 10.5.1.1 [ 12313771 ]
          Affects Version/s 10.4.2.0 [ 12313345 ]
          Affects Version/s 10.4.1.3 [ 12313111 ]
          Affects Version/s 10.3.3.0 [ 12313142 ]
          Affects Version/s 10.3.2.1 [ 12312876 ]
          Affects Version/s 10.3.1.4 [ 12312590 ]
          Affects Version/s 10.2.2.0 [ 12312027 ]
          Affects Version/s 10.2.1.6 [ 11187 ]
          Dag H. Wanvik created issue -

            People

            • Assignee:
              Dag H. Wanvik
              Reporter:
              Dag H. Wanvik
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development