camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gzurow...@apache.org
Subject camel git commit: Replace try-with-resources statement with try..finally block
Date Sat, 17 Oct 2015 09:47:10 GMT
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 <gregor@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 <gregor@zurowski.org>
Authored: Sat Oct 17 11:46:53 2015 +0200
Committer: Gregor Zurowski <gregor@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) {


Mime
View raw message