Replace try-with-resources to avoid CS warnings

Use traditional try..finally instead of Java 7's try-with-resources to
avoid warnings caused by older Checkstyle version and configuration.

Signed-off-by: Gregor Zurowski <[email protected]>

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

Branch: refs/heads/camel-2.15.x
Commit: c54b3628b66217c5785a9298d708fa214fd9e471
Parents: 0a4c7e3
Author: Gregor Zurowski <[email protected]>
Authored: Sun Mar 27 18:18:34 2016 +0200
Committer: Gregor Zurowski <[email protected]>
Committed: Sun Mar 27 18:18:34 2016 +0200

----------------------------------------------------------------------
 .../camel/component/netty4/NettyProducerHangTest.java    | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/c54b3628/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyProducerHangTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyProducerHangTest.java
 
b/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyProducerHangTest.java
index 2b4e74d..5af845c 100644
--- 
a/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyProducerHangTest.java
+++ 
b/components/camel-netty4/src/test/java/org/apache/camel/component/netty4/NettyProducerHangTest.java
@@ -72,8 +72,13 @@ public class NettyProducerHangTest extends CamelTestSupport {
         Socket soc = serverSocket.accept();
 
         log.info("Open socket and accept data");
-        try (InputStream is = soc.getInputStream();
-                OutputStream os = soc.getOutputStream()) {
+
+        InputStream is = null;
+        OutputStream os = null;
+
+        try {
+            is = soc.getInputStream();
+            os = soc.getOutputStream();
             // read first message
             is.read(buf);
 
@@ -85,6 +90,8 @@ public class NettyProducerHangTest extends CamelTestSupport {
 
             // do not reply, just close socket (emulate network problem)
         } finally {
+            os.close();
+            is.close();
             soc.close();
             serverSocket.close();
         }

Reply via email to