You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@click.apache.org by sa...@apache.org on 2010/02/05 13:39:43 UTC

svn commit: r906922 - /click/trunk/click/framework/src/org/apache/click/util/ClickUtils.java

Author: sabob
Date: Fri Feb  5 12:39:42 2010
New Revision: 906922

URL: http://svn.apache.org/viewvc?rev=906922&view=rev
Log:
revert ClickUtils close implementation. Will include the fix in 2.2.0

Modified:
    click/trunk/click/framework/src/org/apache/click/util/ClickUtils.java

Modified: click/trunk/click/framework/src/org/apache/click/util/ClickUtils.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/util/ClickUtils.java?rev=906922&r1=906921&r2=906922&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/util/ClickUtils.java (original)
+++ click/trunk/click/framework/src/org/apache/click/util/ClickUtils.java Fri Feb  5 12:39:42 2010
@@ -20,7 +20,6 @@
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
-import java.io.Closeable;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
@@ -28,6 +27,7 @@
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.io.OutputStream;
+import java.io.Reader;
 import java.io.Serializable;
 import java.io.UnsupportedEncodingException;
 import java.lang.reflect.InvocationTargetException;
@@ -574,15 +574,14 @@
     }
 
     /**
-     * Close the given closeable (stream, reader or writer) and ignore any
-     * exceptions thrown.
+     * Close the given input stream and ignore any exceptions thrown.
      *
      * @param closeable the stream, reader or writer to close.
      */
-    public static void close(Closeable closeable) {
-        if (closeable != null) {
+    public static void close(InputStream  stream) {
+        if (stream != null) {
             try {
-                closeable.close();
+                stream.close();
             } catch (IOException ex) {
                 // Ignore.
             }
@@ -590,6 +589,36 @@
     }
 
     /**
+     * Close the given output stream and ignore any exceptions thrown.
+     *
+     * @param stream the output stream to close.
+     */
+    public static void close(OutputStream stream) {
+        if (stream != null) {
+            try {
+                stream.close();
+            } catch (IOException ex) {
+                // Ignore.
+            }
+        }
+    }
+
+    /**
+     * Close the given reader and ignore any exceptions thrown.
+     *
+     * @param reader the reader to close.
+     */
+    public static void close(Reader reader) {
+        if (reader != null) {
+            try {
+                reader.close();
+            } catch (IOException ioe) {
+                // Ignore
+            }
+        }
+    }
+
+    /**
      * Create an HTML import statement from the given string pattern and
      * versionIndicator, formatted with the request context path.
      * <p/>