logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1582040 - /logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/json/JSONConfiguration.java
Date Wed, 26 Mar 2014 20:31:28 GMT
Author: ggregory
Date: Wed Mar 26 20:31:27 2014
New Revision: 1582040

URL: http://svn.apache.org/r1582040
Log:
Bullet-proofing.

Modified:
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/json/JSONConfiguration.java

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/json/JSONConfiguration.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/json/JSONConfiguration.java?rev=1582040&r1=1582039&r2=1582040&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/json/JSONConfiguration.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/json/JSONConfiguration.java
Wed Mar 26 20:31:27 2014
@@ -56,10 +56,14 @@ public class JSONConfiguration extends A
 
     public JSONConfiguration(final ConfigurationFactory.ConfigurationSource configSource)
{
         this.configFile = configSource.getFile();
+        byte[] buffer;
         try {
             final InputStream configStream = configSource.getInputStream();
-            byte[] buffer = toByteArray(configStream);
-            configStream.close();
+            try {
+                buffer = toByteArray(configStream);
+            } finally {
+                configStream.close();
+            }
             final InputStream is = new ByteArrayInputStream(buffer);
             root = getObjectMapper().readTree(is);
             if (root.size() == 1) {



Mime
View raw message