Author: lindner
Date: Mon Jan 12 01:42:38 2009
New Revision: 733663

URL: http://svn.apache.org/viewvc?rev=733663&view=rev
Log:
SHINDIG-802 | Patch from Vincent Siveton | Using 
org.apache.commons.io.IOUtils#closeQuietly()

Modified:
    
incubator/shindig/trunk/java/common/src/main/java/org/apache/shindig/common/PropertiesModule.java
    
incubator/shindig/trunk/java/samples/src/main/java/org/apache/shindig/social/opensocial/jpa/spi/JPASocialModule.java

Modified: 
incubator/shindig/trunk/java/common/src/main/java/org/apache/shindig/common/PropertiesModule.java
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/common/src/main/java/org/apache/shindig/common/PropertiesModule.java?rev=733663&r1=733662&r2=733663&view=diff
==============================================================================
--- 
incubator/shindig/trunk/java/common/src/main/java/org/apache/shindig/common/PropertiesModule.java
 (original)
+++ 
incubator/shindig/trunk/java/common/src/main/java/org/apache/shindig/common/PropertiesModule.java
 Mon Jan 12 01:42:38 2009
@@ -24,6 +24,7 @@
 import com.google.inject.name.Names;
 import com.google.inject.spi.Message;
 
+import org.apache.commons.io.IOUtils;
 import org.apache.shindig.common.util.ResourceLoader;
 
 import java.io.IOException;
@@ -38,9 +39,9 @@
 public class PropertiesModule extends AbstractModule {
 
   private final static String DEFAULT_PROPERTIES = "shindig.properties";
-  
+
   private final Properties properties;
-  
+
   public PropertiesModule() {
     this.properties = readPropertyFile(getDefaultPropertiesPath());
   }
@@ -48,7 +49,7 @@
   public PropertiesModule(String propertyFile) {
     this.properties = readPropertyFile(propertyFile);
   }
-  
+
   public PropertiesModule(Properties properties) {
     this.properties = properties;
   }
@@ -76,15 +77,9 @@
       throw new CreationException(Arrays.asList(
           new Message("Unable to load properties: " + propertyFile)));
     } finally {
-      try {
-        if (is != null) {
-          is.close();
-        }
-      } catch (IOException e) {
-        // weird
-      }
+      IOUtils.closeQuietly( is );
     }
-    
+
     return properties;
   }
 

Modified: 
incubator/shindig/trunk/java/samples/src/main/java/org/apache/shindig/social/opensocial/jpa/spi/JPASocialModule.java
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/samples/src/main/java/org/apache/shindig/social/opensocial/jpa/spi/JPASocialModule.java?rev=733663&r1=733662&r2=733663&view=diff
==============================================================================
--- 
incubator/shindig/trunk/java/samples/src/main/java/org/apache/shindig/social/opensocial/jpa/spi/JPASocialModule.java
 (original)
+++ 
incubator/shindig/trunk/java/samples/src/main/java/org/apache/shindig/social/opensocial/jpa/spi/JPASocialModule.java
 Mon Jan 12 01:42:38 2009
@@ -23,8 +23,7 @@
 import com.google.inject.name.Names;
 import com.google.inject.spi.Message;
 
-import org.apache.shindig.common.util.ResourceLoader;
-import org.apache.shindig.social.opensocial.jpa.PersonDb;
+import org.apache.commons.io.IOUtils;
 import 
org.apache.shindig.social.opensocial.jpa.eclipselink.EclipseEntityManagerProvider;
 import org.apache.shindig.social.opensocial.spi.ActivityService;
 import org.apache.shindig.social.opensocial.spi.AppDataService;
@@ -38,7 +37,7 @@
 import javax.persistence.EntityManager;
 
 /**
- * 
+ *
  */
 public class JPASocialModule extends AbstractModule {
 
@@ -46,7 +45,7 @@
   private Properties properties;
 
   /**
-   * 
+   *
    */
   public JPASocialModule() {
     InputStream is = null;
@@ -62,19 +61,13 @@
       throw new CreationException(Arrays.asList(new Message(
           "Unable to load properties: " + DEFAULT_PROPERTIES)));
     } finally {
-      try {
-        if (is != null) {
-          is.close();
-        }
-      } catch (IOException e) {
-        // dont care about this.
-      }
+      IOUtils.closeQuietly( is );
     }
   }
 
   /**
    * {...@inheritdoc}
-   * 
+   *
    * @see com.google.inject.AbstractModule#configure()
    */
   @Override


Reply via email to