Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 80D76200B6F for ; Tue, 19 Jul 2016 14:14:22 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 7F6F9160A76; Tue, 19 Jul 2016 12:14:22 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id E0DEB160A8B for ; Tue, 19 Jul 2016 14:14:21 +0200 (CEST) Received: (qmail 78841 invoked by uid 500); 19 Jul 2016 12:14:21 -0000 Mailing-List: contact issues-help@struts.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@struts.apache.org Delivered-To: mailing list issues@struts.apache.org Received: (qmail 78509 invoked by uid 99); 19 Jul 2016 12:14:20 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 Jul 2016 12:14:20 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 967912C0D59 for ; Tue, 19 Jul 2016 12:14:20 +0000 (UTC) Date: Tue, 19 Jul 2016 12:14:20 +0000 (UTC) From: "Michael Hum (JIRA)" To: issues@struts.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (WW-4662) StreamResult closes outputstream early MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 19 Jul 2016 12:14:22 -0000 Michael Hum created WW-4662: ------------------------------- Summary: StreamResult closes outputstream early Key: WW-4662 URL: https://issues.apache.org/jira/browse/WW-4662 Project: Struts 2 Issue Type: Bug Affects Versions: 2.5 Reporter: Michael Hum We recently upgraded from struts 2.3.x to 2.5.2 at our workplace. One of the changes we noticed was with stream result - if an error occurs, the output stream is automatically closed and no response is sent to the user (ignoring our custom error-500 page). The content-length of the response is thus 0 - a blank page. This is occuring due to the addition of try-with-resources. In 2.3.x, the output stream wasn't set until after we find the input stream, like so: {code} try { get inputStream if (inputStream == null) throw Exception get outputStream } finally { if inputStream != null inputStream.close() if outputStream != null outputStream.close() } {code} However, in 2.5, this was changed to use a try-with-resources on the output stream (https://git-wip-us.apache.org/repos/asf?p=struts.git;a=commit;h=3fab155b4cc530ca3ca0b69299ddcb348eb5f26d): {code:java} try (OutputStream oOutput = oResponse.getOutputStream()) { // ... } {code} So, when we throw an error, the stream is closed and nothing further is written. Is this intended behaviour? Is there an alternate solution to show our own error pages now (with stack trace?)? -- This message was sent by Atlassian JIRA (v6.3.4#6332)