diff options
| author | Robert Godfrey <rgodfrey@apache.org> | 2014-08-13 12:49:35 +0000 |
|---|---|---|
| committer | Robert Godfrey <rgodfrey@apache.org> | 2014-08-13 12:49:35 +0000 |
| commit | be9eacaeb0e5c1dfb1c68596e836477bff1bdc4b (patch) | |
| tree | 987a73b29269e12c185aff81a9f0cab506fe6248 /qpid/java/client/example | |
| parent | f405780fb9e553e31004777513574a6375687eeb (diff) | |
| download | qpid-python-be9eacaeb0e5c1dfb1c68596e836477bff1bdc4b.tar.gz | |
QPID-5993 : [Java] Address issues identified by Findbugs
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1617716 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/client/example')
| -rw-r--r-- | qpid/java/client/example/src/main/java/org/apache/qpid/example/Hello.java | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/qpid/java/client/example/src/main/java/org/apache/qpid/example/Hello.java b/qpid/java/client/example/src/main/java/org/apache/qpid/example/Hello.java index 949ee4dac6..7e956698d1 100644 --- a/qpid/java/client/example/src/main/java/org/apache/qpid/example/Hello.java +++ b/qpid/java/client/example/src/main/java/org/apache/qpid/example/Hello.java @@ -21,10 +21,18 @@ package org.apache.qpid.example; -import javax.jms.*; +import java.io.InputStream; +import java.util.Properties; + +import javax.jms.Connection; +import javax.jms.ConnectionFactory; +import javax.jms.Destination; +import javax.jms.MessageConsumer; +import javax.jms.MessageProducer; +import javax.jms.Session; +import javax.jms.TextMessage; import javax.naming.Context; import javax.naming.InitialContext; -import java.util.Properties; public class Hello @@ -42,9 +50,10 @@ public class Hello private void runTest() { - try { + try (InputStream resourceAsStream = this.getClass().getResourceAsStream("hello.properties")) + { Properties properties = new Properties(); - properties.load(this.getClass().getResourceAsStream("hello.properties")); + properties.load(resourceAsStream); Context context = new InitialContext(properties); ConnectionFactory connectionFactory = (ConnectionFactory) context.lookup("qpidConnectionfactory"); |
