Author: mbenson
Date: Thu Oct 6 11:45:32 2005
New Revision: 306835
URL: http://svn.apache.org/viewcvs?rev=306835&view=rev
Log:
add exception accessor per TODO
Modified:
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/StreamPumper.java
Modified:
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/StreamPumper.java
URL:
http://svn.apache.org/viewcvs/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/StreamPumper.java?rev=306835&r1=306834&r2=306835&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/StreamPumper.java
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/StreamPumper.java Thu
Oct 6 11:45:32 2005
@@ -1,5 +1,5 @@
/*
- * Copyright 2000,2002-2005 The Apache Software Foundation
+ * Copyright 2000, 2002-2005 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,7 +29,6 @@
public class StreamPumper implements Runnable {
// TODO: make SIZE an instance variable.
- // TODO: add a status flag to note if an error occurred in run.
private static final int SIZE = 128;
private InputStream is;
@@ -38,6 +37,7 @@
private volatile boolean finished;
private boolean closeWhenExhausted;
private boolean autoflush = false;
+ private Exception exception = null;
/**
* Create a new stream pumper.
@@ -94,7 +94,9 @@
}
os.flush();
} catch (Exception e) {
- // ignore errors
+ synchronized (this) {
+ exception = e;
+ }
} finally {
if (closeWhenExhausted) {
try {
@@ -127,6 +129,14 @@
while (!isFinished()) {
wait();
}
+ }
+
+ /**
+ * Get the exception encountered, if any.
+ * @return the Exception encountered.
+ */
+ public synchronized Exception getException() {
+ return exception;
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]