From f42d290f367701bf8386ca84397913c27c7f57b3 Mon Sep 17 00:00:00 2001 From: Robert Gemmell Date: Wed, 29 Sep 2010 15:22:19 +0000 Subject: QPID-2857: close the input stream used when loading properties files for JNDI lookups git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1002675 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/qpid/jndi/PropertiesFileInitialContextFactory.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/qpid/java/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java b/qpid/java/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java index f0f9a9840c..fec5af55c1 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactory.java @@ -81,10 +81,19 @@ public class PropertiesFileInitialContextFactory implements InitialContextFactor 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)); -- cgit v1.2.1