You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ro...@apache.org on 2010/09/29 17:22:55 UTC

svn commit: r1002676 - /qpid/branches/0.5.x-dev/qpid/java/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java

Author: robbie
Date: Wed Sep 29 15:22:54 2010
New Revision: 1002676

URL: http://svn.apache.org/viewvc?rev=1002676&view=rev
Log:
QPID-2886: close the input stream used when loading properties files for JNDI lookups

Modified:
    qpid/branches/0.5.x-dev/qpid/java/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java

Modified: qpid/branches/0.5.x-dev/qpid/java/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java
URL: http://svn.apache.org/viewvc/qpid/branches/0.5.x-dev/qpid/java/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java?rev=1002676&r1=1002675&r2=1002676&view=diff
==============================================================================
--- qpid/branches/0.5.x-dev/qpid/java/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java (original)
+++ qpid/branches/0.5.x-dev/qpid/java/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java Wed Sep 29 15:22:54 2010
@@ -81,10 +81,19 @@ public class PropertiesFileInitialContex
             if (file != null)
             {
                 _logger.info("Loading Properties from:" + file);
+
                 // Load the properties specified
+                BufferedInputStream inputStream = new BufferedInputStream(new FileInputStream(file));
                 Properties p = new Properties();
+                try
+                {
+                    p.load(inputStream);
+                }
+                finally
+                {
+                    inputStream.close();
+                }
 
-                p.load(new BufferedInputStream(new FileInputStream(file)));
                 Strings.Resolver resolver = new Strings.ChainedResolver
                     (Strings.SYSTEM_RESOLVER, new Strings.PropertiesResolver(p));
 



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org