Uploaded image for project: 'Commons DBCP'
  1. Commons DBCP
  2. DBCP-540

Close ObjectOutputStream before calling toByteArray on underlying ByteArrayOutputStream #28

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • None
    • 2.7.0
    • None

    Description

      Close ObjectOutputStream before calling toByteArray on underlying ByteArrayOutputStream #28.

      https://github.com/apache/commons-dbcp/pull/28:

      When an ObjectOutputStream instance wraps an underlying ByteArrayOutputStream instance,
      it is recommended to flush or close the ObjectOutputStream before invoking the underlying instances's toByteArray(). Although in this case it is not strictly necessary because writeObject method is invoked right before toByteArray, and writeObject internally calls flush/drain. However, it is good practice to call flush/close explicitly as mentioned, for example, here.
      This pull request flips the order of close and toytBeArray methods.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            ggregory Gary D. Gregory
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Issue deployment