summaryrefslogtreecommitdiff
path: root/qpid/java/amqp-1-0-client-jms/example/src/main/java/org/apache/qpid/amqp_1_0/jms/example/Hello.java
diff options
context:
space:
mode:
Diffstat (limited to 'qpid/java/amqp-1-0-client-jms/example/src/main/java/org/apache/qpid/amqp_1_0/jms/example/Hello.java')
-rw-r--r--qpid/java/amqp-1-0-client-jms/example/src/main/java/org/apache/qpid/amqp_1_0/jms/example/Hello.java7
1 files changed, 4 insertions, 3 deletions
diff --git a/qpid/java/amqp-1-0-client-jms/example/src/main/java/org/apache/qpid/amqp_1_0/jms/example/Hello.java b/qpid/java/amqp-1-0-client-jms/example/src/main/java/org/apache/qpid/amqp_1_0/jms/example/Hello.java
index b94c672133..670f358a26 100644
--- a/qpid/java/amqp-1-0-client-jms/example/src/main/java/org/apache/qpid/amqp_1_0/jms/example/Hello.java
+++ b/qpid/java/amqp-1-0-client-jms/example/src/main/java/org/apache/qpid/amqp_1_0/jms/example/Hello.java
@@ -20,6 +20,7 @@
*/
package org.apache.qpid.amqp_1_0.jms.example;
+import java.io.InputStream;
import java.util.Properties;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@@ -51,11 +52,11 @@ public class Hello
private void runExample()
{
- try
+ try(InputStream propertiesStream = getClass().getResourceAsStream("hello.properties"))
{
- // Read the hello.properties JNDI properties file and use contents to create the InitialContext.
Properties properties = new Properties();
- properties.load(getClass().getResourceAsStream("hello.properties"));
+ // Read the hello.properties JNDI properties file and use contents to create the InitialContext.
+ properties.load(propertiesStream);
Context context = new InitialContext(properties);
// Alternatively, JNDI information can be supplied by setting the "java.naming.factory.initial"
// system property to value "org.apache.qpid.amqp_1_0.jms.jndi.PropertiesFileInitialContextFactory"