jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cko...@apache.org
Subject svn commit: r1213178 - /jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCARepositoryManager.java
Date Mon, 12 Dec 2011 09:42:01 GMT
Author: ckoell
Date: Mon Dec 12 09:42:01 2011
New Revision: 1213178

URL: http://svn.apache.org/viewvc?rev=1213178&view=rev
Log:
JCR-3176 JCARepositoryManager does not close InputStream

Modified:
    jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCARepositoryManager.java

Modified: jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCARepositoryManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCARepositoryManager.java?rev=1213178&r1=1213177&r2=1213178&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCARepositoryManager.java
(original)
+++ jackrabbit/trunk/jackrabbit-jca/src/main/java/org/apache/jackrabbit/jca/JCARepositoryManager.java
Mon Dec 12 09:42:01 2011
@@ -24,6 +24,7 @@ import org.apache.jackrabbit.commons.Jcr
 import org.apache.jackrabbit.core.RepositoryImpl;
 import org.apache.jackrabbit.core.config.RepositoryConfig;
 
+import java.io.IOException;
 import java.io.InputStream;
 import java.util.HashMap;
 import java.util.Map;
@@ -101,9 +102,19 @@ public final class JCARepositoryManager 
                 cl = this.getClass().getClassLoader();
             }
 
-            InputStream configInputStream = cl.getResourceAsStream(
-                configFile.substring(CLASSPATH_CONFIG_PREFIX.length()));
-            config = RepositoryConfig.create(configInputStream, homeDir);
+        	InputStream configInputStream = cl.getResourceAsStream(
+        			configFile.substring(CLASSPATH_CONFIG_PREFIX.length()));
+            try {
+            	config = RepositoryConfig.create(configInputStream, homeDir);
+            } finally {
+                if (configInputStream != null) {
+                    try {
+                        configInputStream.close();
+                    } catch (IOException e) {
+                        // ignore
+                    }
+                }
+            }            	
         } else {
             config = RepositoryConfig.create(configFile, homeDir);
         }



Mime
View raw message