deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From johndam...@apache.org
Subject deltaspike git commit: DELTASPIKE-847 Close resource when read.
Date Wed, 04 Mar 2015 01:11:03 GMT
Repository: deltaspike
Updated Branches:
  refs/heads/master 86a047472 -> ca9ba188d


DELTASPIKE-847 Close resource when read.


Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/ca9ba188
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/ca9ba188
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/ca9ba188

Branch: refs/heads/master
Commit: ca9ba188de6dade28faf55179d84ae38a71238e3
Parents: 86a0474
Author: John D. Ament <johndament@apache.org>
Authored: Tue Mar 3 20:10:41 2015 -0500
Committer: John D. Ament <johndament@apache.org>
Committed: Tue Mar 3 20:10:41 2015 -0500

----------------------------------------------------------------------
 .../AbstractResourceProvider.java               | 27 +++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/ca9ba188/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/resourceloader/AbstractResourceProvider.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/resourceloader/AbstractResourceProvider.java
b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/resourceloader/AbstractResourceProvider.java
index c5625b3..f4b7825 100644
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/resourceloader/AbstractResourceProvider.java
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/resourceloader/AbstractResourceProvider.java
@@ -84,9 +84,30 @@ public abstract class AbstractResourceProvider implements InjectableResourceProv
     {
         final Properties properties = new Properties();
         final String name = injectableResource.location();
-        final InputStream inputStream = this.readStream(injectableResource);
-        this.loadInputStreamToProperties(inputStream, properties, name);
-        return properties;
+        InputStream inputStream = null;
+        try
+        {
+            inputStream = this.readStream(injectableResource);
+            this.loadInputStreamToProperties(inputStream, properties, name);
+            return properties;
+        }
+        finally
+        {
+            if (inputStream != null)
+            {
+                try
+                {
+                    inputStream.close();
+                }
+                catch (IOException e)
+                {
+                    if (logger.isLoggable(Level.FINE))
+                    {
+                        logger.log(Level.FINE, "Problem closing resource.", e);
+                    }
+                }
+            }
+        }
     }
 
     @Override


Mime
View raw message