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 4869A200C27 for ; Sun, 26 Feb 2017 11:08:17 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 42BF6160B6E; Sun, 26 Feb 2017 10:08:17 +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 8DF8C160B59 for ; Sun, 26 Feb 2017 11:08:16 +0100 (CET) Received: (qmail 97849 invoked by uid 500); 26 Feb 2017 10:08:15 -0000 Mailing-List: contact commits-help@maven.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@maven.apache.org Delivered-To: mailing list commits@maven.apache.org Received: (qmail 97840 invoked by uid 99); 26 Feb 2017 10:08:15 -0000 Received: from Unknown (HELO svn01-us-west.apache.org) (209.188.14.144) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 26 Feb 2017 10:08:15 +0000 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 A79B33A0309 for ; Sun, 26 Feb 2017 10:08:14 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1784430 - /maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/cli/StreamFeeder.java Date: Sun, 26 Feb 2017 10:08:14 -0000 To: commits@maven.apache.org From: schulte@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20170226100814.A79B33A0309@svn01-us-west.apache.org> archived-at: Sun, 26 Feb 2017 10:08:17 -0000 Author: schulte Date: Sun Feb 26 10:08:13 2017 New Revision: 1784430 URL: http://svn.apache.org/viewvc?rev=1784430&view=rev Log: [MSHARED-619] StreamFeeder silently ignores exceptions. Modified: maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/cli/StreamFeeder.java Modified: maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/cli/StreamFeeder.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/cli/StreamFeeder.java?rev=1784430&r1=1784429&r2=1784430&view=diff ============================================================================== --- maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/cli/StreamFeeder.java (original) +++ maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/cli/StreamFeeder.java Sun Feb 26 10:08:13 2017 @@ -33,25 +33,26 @@ import java.util.concurrent.atomic.Atomi class StreamFeeder extends AbstractStreamHandler { + private final AtomicReference input; + private final AtomicReference output; + private volatile Throwable exception; + /** * Create a new StreamFeeder * - * @param input Stream to read from + * @param input Stream to read from * @param output Stream to write to */ public StreamFeeder( InputStream input, OutputStream output ) { + super(); this.input = new AtomicReference( input ); this.output = new AtomicReference( output ); } - // ---------------------------------------------------------------------- - // Runnable implementation - // ---------------------------------------------------------------------- - @Override public void run() { @@ -62,6 +63,10 @@ class StreamFeeder catch ( Throwable e ) { // Catch everything so the streams will be closed and flagged as done. + if ( this.exception != null ) + { + this.exception = e; + } } finally { @@ -74,10 +79,6 @@ class StreamFeeder } } - // ---------------------------------------------------------------------- - // - // ---------------------------------------------------------------------- - public void close() { setDone(); @@ -90,7 +91,10 @@ class StreamFeeder } catch ( IOException ex ) { - // ignore + if ( this.exception != null ) + { + this.exception = ex; + } } } @@ -103,14 +107,21 @@ class StreamFeeder } catch ( IOException ex ) { - // ignore + if ( this.exception != null ) + { + this.exception = ex; + } } } } - // ---------------------------------------------------------------------- - // - // ---------------------------------------------------------------------- + /** + * @since 3.2.0 + */ + public Throwable getException() + { + return this.exception; + } @SuppressWarnings( "checkstyle:innerassignment" ) private void feed()