logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1431919 - /logging/log4j/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/util/PropsUtil.java
Date Fri, 11 Jan 2013 07:24:09 GMT
Author: ggregory
Date: Fri Jan 11 07:24:09 2013
New Revision: 1431919

URL: http://svn.apache.org/viewvc?rev=1431919&view=rev
Log:
Resource leak: 'in' may not be closed.

Modified:
    logging/log4j/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/util/PropsUtil.java

Modified: logging/log4j/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/util/PropsUtil.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/util/PropsUtil.java?rev=1431919&r1=1431918&r2=1431919&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/util/PropsUtil.java
(original)
+++ logging/log4j/log4j2/trunk/api/src/main/java/org/apache/logging/log4j/util/PropsUtil.java
Fri Jan 11 07:24:09 2013
@@ -16,6 +16,7 @@
  */
 package org.apache.logging.log4j.util;
 
+import java.io.IOException;
 import java.io.InputStream;
 import java.util.Properties;
 
@@ -32,7 +33,6 @@ public class PropsUtil {
         return LOG4J_PROPERTIES;
     }
 
-
     public PropsUtil(final Properties props) {
         this.props = props;
     }
@@ -44,9 +44,14 @@ public class PropsUtil {
         if (null != in) {
             try {
                 this.props.load(in);
-                in.close();
-            } catch (final java.io.IOException e) {
+            } catch (final IOException e) {
                 // ignored
+            } finally {
+                try {
+                    in.close();
+                } catch (final IOException e) {
+                    // ignored
+                }
             }
         }
     }



Mime
View raw message