Based on the feedback, I added in the message retrieved from the io
exception. This is just for writer/outputstream.
Kev
Index: FileUtils.java
===================================================================
RCS file:
/home/cvspublic/ant/src/main/org/apache/tools/ant/util/FileUtils.java,v
retrieving revision 1.95
diff -u -r1.95 FileUtils.java
--- FileUtils.java 12 Jun 2005 15:54:15 -0000 1.95
+++ FileUtils.java 22 Jun 2005 11:25:36 -0000
@@ -24,10 +24,10 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.Writer;
-import java.io.OutputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.CharacterIterator;
@@ -37,15 +37,17 @@
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.Vector;
+
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
import org.apache.tools.ant.filters.util.ChainReaderHelper;
+import org.apache.tools.ant.launch.Locator;
import org.apache.tools.ant.taskdefs.condition.Os;
-import org.apache.tools.ant.types.Resource;
import org.apache.tools.ant.types.FilterSetCollection;
-import org.apache.tools.ant.types.resources.Touchable;
+import org.apache.tools.ant.types.Resource;
import org.apache.tools.ant.types.resources.FileResource;
-import org.apache.tools.ant.launch.Locator;
+import org.apache.tools.ant.types.resources.Touchable;
/**
* This class also encapsulates methods which allow Files to be
@@ -1556,6 +1558,23 @@
}
}
}
+
+ /**
+ * Close a writer without throwing any exception.
+ * Record message on tasks log for tracability
+ * @param device stream, can be null
+ * @param user task calling this method
+ * @param message message to log in case of IOException
+ */
+ public static void close(Writer device, Task user, String message) {
+ if (device != null) {
+ try {
+ device.close();
+ } catch (IOException ioex) {
+ user.log(message+" : "+ioex.getMessage());
+ }
+ }
+ }
/**
* Close a stream without throwing any exception if something went wrong.
@@ -1588,7 +1607,24 @@
}
}
}
-
+
+ /**
+ * Close a stream without throwing any exception.
+ * Record message on tasks log for tracability
+ * @param device stream, can be null
+ * @param user task calling this method
+ * @param message message to log in case of IOException
+ */
+ public static void close(OutputStream device, Task user, String message) {
+ if (device != null) {
+ try {
+ device.close();
+ } catch (IOException ioex) {
+ user.log(message+" : "+ioex.getMessage());
+ }
+ }
+ }
+
/**
* Close a stream without throwing any exception if something went wrong.
* Do not attempt to close it if the argument is null.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]