jspwiki-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From juanpa...@apache.org
Subject svn commit: r1608960 - /jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/providers/AbstractFileProvider.java
Date Tue, 08 Jul 2014 21:52:49 GMT
Author: juanpablo
Date: Tue Jul  8 21:52:49 2014
New Revision: 1608960

URL: http://svn.apache.org/r1608960
Log:
use of IOUtils.closeQuietly to close streams

Modified:
    jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/providers/AbstractFileProvider.java

Modified: jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/providers/AbstractFileProvider.java
URL: http://svn.apache.org/viewvc/jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/providers/AbstractFileProvider.java?rev=1608960&r1=1608959&r2=1608960&view=diff
==============================================================================
--- jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/providers/AbstractFileProvider.java
(original)
+++ jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/providers/AbstractFileProvider.java
Tue Jul  8 21:52:49 2014
@@ -35,6 +35,7 @@ import java.util.List;
 import java.util.Properties;
 import java.util.TreeSet;
 
+import org.apache.commons.io.IOUtils;
 import org.apache.log4j.Logger;
 import org.apache.wiki.InternalWikiException;
 import org.apache.wiki.WikiEngine;
@@ -49,6 +50,7 @@ import org.apache.wiki.search.SearchResu
 import org.apache.wiki.util.FileUtil;
 import org.apache.wiki.util.TextUtil;
 
+
 /**
  *  Provides a simple directory based repository for Wiki pages.
  *  <P>
@@ -125,8 +127,7 @@ public abstract class AbstractFileProvid
 
         m_engine = engine;
 
-        m_encoding = properties.getProperty( WikiEngine.PROP_ENCODING, 
-                                             DEFAULT_ENCODING );
+        m_encoding = properties.getProperty( WikiEngine.PROP_ENCODING, DEFAULT_ENCODING );
 
         String os = System.getProperty( "os.name" ).toLowerCase();
         
@@ -280,14 +281,7 @@ public abstract class AbstractFileProvid
                 }
                 finally
                 {
-                    try
-                    {
-                        if( in  != null ) in.close();
-                    }
-                    catch( Exception e ) 
-                    {
-                        log.fatal("Closing failed",e);
-                    }
+                    IOUtils.closeQuietly( in );
                 }
             }
             else
@@ -322,11 +316,11 @@ public abstract class AbstractFileProvid
         }
         catch( IOException e )
         {
-            log.error( "Saving failed" );
+            log.error( "Saving failed", e );
         }
         finally
         {
-            if( out != null ) out.close();
+            IOUtils.closeQuietly( out );
         }
     }
 
@@ -437,11 +431,7 @@ public abstract class AbstractFileProvid
             }
             finally
             {
-                try
-                {
-                    if( input != null ) input.close();
-                }
-                catch( IOException e ) {} // It's fine to fail silently.
+                IOUtils.closeQuietly( input );
             }
         }
 



Mime
View raw message