jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r628263 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java
Date Sat, 16 Feb 2008 11:29:32 GMT
Author: jukka
Date: Sat Feb 16 03:29:27 2008
New Revision: 628263

URL: http://svn.apache.org/viewvc?rev=628263&view=rev
Log:
JCR-1374: [PATCH] make sure streams are closed
    - Close the stream in a finally block
    - Also, no need for BufferedInputStream

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java?rev=628263&r1=628262&r2=628263&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java
Sat Feb 16 03:29:27 2008
@@ -520,7 +520,9 @@
         } else {
             failIfNotFound = true;
         }
-        InputStream in = DbDataStore.class.getResourceAsStream(databaseType + ".properties");
+
+        InputStream in =
+            DbDataStore.class.getResourceAsStream(databaseType + ".properties");
         if (in == null) {
             if (failIfNotFound) {
                 String msg =
@@ -533,15 +535,20 @@
                 return;
             }
         }
+
         Properties prop = new Properties();
         try {
-            prop.load(new BufferedInputStream(in));
-            in.close();
+            try {
+                prop.load(in);
+            } finally {
+                in.close();
+            }
         } catch (IOException e) {
             String msg = "Configuration error: Could not read properties '" + databaseType
+ ".properties'";
             log.debug(msg);
             throw new DataStoreException(msg);
         }
+
         if (driver == null) {
             driver = getProperty(prop, "driver", driver);
         }



Mime
View raw message