You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by gz...@apache.org on 2015/10/17 11:47:10 UTC

camel git commit: Replace try-with-resources statement with try..finally block

Repository: camel
Updated Branches:
  refs/heads/camel-2.15.x 706907ab1 -> c2b6a023d


Replace try-with-resources statement with try..finally block

The 2.15.x branch uses an older Checkstyle version that does not support
Java 7's try-with-resources statement. In order to cut releases on this
branch, this commit replaces the try-with-resources statement with a
traditional try..finally block.

Signed-off-by: Gregor Zurowski <gr...@zurowski.org>

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

Branch: refs/heads/camel-2.15.x
Commit: c2b6a023d758b20ab42d734c249d6551ee4c3c75
Parents: 706907a
Author: Gregor Zurowski <gr...@zurowski.org>
Authored: Sat Oct 17 11:46:53 2015 +0200
Committer: Gregor Zurowski <gr...@zurowski.org>
Committed: Sat Oct 17 11:46:53 2015 +0200

----------------------------------------------------------------------
 .../camel/test/blueprint/CamelBlueprintTestSupport.java      | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/c2b6a023/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java b/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java
index 5f9e5fc..cc33ed6 100644
--- a/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java
+++ b/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java
@@ -238,7 +238,9 @@ public abstract class CamelBlueprintTestSupport extends CamelTestSupport {
             ));
             for (URL descriptor : CamelBlueprintHelper.getBlueprintDescriptors(getBlueprintDescriptor())) {
                 DocumentBuilder db = dbf.newDocumentBuilder();
-                try (InputStream is = descriptor.openStream()) {
+                InputStream is = null;
+                try {
+                    is = descriptor.openStream();
                     Document doc = db.parse(is);
                     NodeList nl = doc.getDocumentElement().getChildNodes();
                     for (int i = 0; i < nl.getLength(); i++) {
@@ -254,6 +256,10 @@ public abstract class CamelBlueprintTestSupport extends CamelTestSupport {
                             }
                         }
                     }
+                } finally {
+                    if (is != null) {
+                        is.close();
+                    }
                 }
             }
         } catch (Exception e) {