From issues-return-73027-archive-asf-public=cust-asf.ponee.io@commons.apache.org Sat Mar 30 01:23:02 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id E611E180651 for ; Sat, 30 Mar 2019 02:23:01 +0100 (CET) Received: (qmail 79640 invoked by uid 500); 30 Mar 2019 01:23:01 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 79626 invoked by uid 99); 30 Mar 2019 01:23:00 -0000 Received: from mailrelay1-us-west.apache.org (HELO mailrelay1-us-west.apache.org) (209.188.14.139) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 30 Mar 2019 01:23:00 +0000 Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id A3162E29CA for ; Sat, 30 Mar 2019 01:23:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 2A3902459C for ; Sat, 30 Mar 2019 01:23:00 +0000 (UTC) Date: Sat, 30 Mar 2019 01:23:00 +0000 (UTC) From: "Gary Gregory (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (DBCP-540) Close ObjectOutputStream before calling toByteArray on underlying ByteArrayOutputStream #28 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/DBCP-540?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Gary Gregory updated DBCP-540: ------------------------------ Description: Close ObjectOutputStream before calling toByteArray on underlying ByteArrayOutputStream #28 {quote} 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. {quote} was:Close ObjectOutputStream before calling toByteArray on underlying ByteArrayOutputStream #28 > Close ObjectOutputStream before calling toByteArray on underlying ByteArrayOutputStream #28 > ------------------------------------------------------------------------------------------- > > Key: DBCP-540 > URL: https://issues.apache.org/jira/browse/DBCP-540 > Project: Commons DBCP > Issue Type: Improvement > Reporter: Gary Gregory > Priority: Trivial > > Close ObjectOutputStream before calling toByteArray on underlying ByteArrayOutputStream #28 > {quote} > 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. > {quote} -- This message was sent by Atlassian JIRA (v7.6.3#76005)