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 682C0200B97 for ; Sun, 9 Oct 2016 12:51:18 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 66BFD160ADA; Sun, 9 Oct 2016 10:51:18 +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 A3B66160AC3 for ; Sun, 9 Oct 2016 12:51:17 +0200 (CEST) Received: (qmail 17468 invoked by uid 500); 9 Oct 2016 10:51:16 -0000 Mailing-List: contact commits-help@poi.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@poi.apache.org Delivered-To: mailing list commits@poi.apache.org Received: (qmail 17459 invoked by uid 99); 9 Oct 2016 10:51:16 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 09 Oct 2016 10:51:16 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 27E931A04B9 for ; Sun, 9 Oct 2016 10:51:16 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -1.999 X-Spam-Level: X-Spam-Status: No, score=-1.999 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id PjPwzP_gtYuc for ; Sun, 9 Oct 2016 10:51:15 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 5AC7D5F307 for ; Sun, 9 Oct 2016 10:51:15 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 98032E00A5 for ; Sun, 9 Oct 2016 10:51:14 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id E72293A0233 for ; Sun, 9 Oct 2016 10:51:13 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1763959 - /poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SheetDataWriter.java Date: Sun, 09 Oct 2016 10:51:13 -0000 To: commits@poi.apache.org From: onealj@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20161009105113.E72293A0233@svn01-us-west.apache.org> archived-at: Sun, 09 Oct 2016 10:51:18 -0000 Author: onealj Date: Sun Oct 9 10:51:13 2016 New Revision: 1763959 URL: http://svn.apache.org/viewvc?rev=1763959&view=rev Log: bug 60153: findbugs OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE close opened streams if an exception is raised while decorating the stream Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SheetDataWriter.java Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SheetDataWriter.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SheetDataWriter.java?rev=1763959&r1=1763958&r2=1763959&view=diff ============================================================================== --- poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SheetDataWriter.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SheetDataWriter.java Sun Oct 9 10:51:13 2016 @@ -92,8 +92,16 @@ public class SheetDataWriter { * @param fd the file to write to */ public Writer createWriter(File fd) throws IOException { - final OutputStream decorated = decorateOutputStream(new FileOutputStream(fd)); - return new BufferedWriter(new OutputStreamWriter(decorated, "UTF-8")); + FileOutputStream fos = new FileOutputStream(fd); + OutputStream decorated; + try { + decorated = decorateOutputStream(fos); + } catch (final IOException e) { + fos.close(); + throw e; + } + return new BufferedWriter( + new OutputStreamWriter(decorated, "UTF-8")); } /** @@ -128,7 +136,13 @@ public class SheetDataWriter { */ public InputStream getWorksheetXMLInputStream() throws IOException { File fd = getTempFile(); - return decorateInputStream(new FileInputStream(fd)); + FileInputStream fis = new FileInputStream(fd); + try { + return decorateInputStream(fis); + } catch (IOException e) { + fis.close(); + throw e; + } } /** --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org For additional commands, e-mail: commits-help@poi.apache.org