CAMEL-6727 Close the stream in XmlSignerHelper.getXslTransform with thanks to Franz
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/812524a6 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/812524a6 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/812524a6 Branch: refs/heads/camel-2.12.x Commit: 812524a64980100e819f2aa4fb3f30bef0e138db Parents: c04e88e Author: Willem Jiang <ningji...@apache.org> Authored: Wed Sep 11 17:04:06 2013 +0800 Committer: Willem Jiang <ningji...@apache.org> Committed: Wed Sep 11 17:37:00 2013 +0800 ---------------------------------------------------------------------- .../camel/component/xmlsecurity/api/XmlSignatureHelper.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/812524a6/components/camel-xmlsecurity/src/main/java/org/apache/camel/component/xmlsecurity/api/XmlSignatureHelper.java ---------------------------------------------------------------------- diff --git a/components/camel-xmlsecurity/src/main/java/org/apache/camel/component/xmlsecurity/api/XmlSignatureHelper.java b/components/camel-xmlsecurity/src/main/java/org/apache/camel/component/xmlsecurity/api/XmlSignatureHelper.java index 575f82b..851aeb5 100644 --- a/components/camel-xmlsecurity/src/main/java/org/apache/camel/component/xmlsecurity/api/XmlSignatureHelper.java +++ b/components/camel-xmlsecurity/src/main/java/org/apache/camel/component/xmlsecurity/api/XmlSignatureHelper.java @@ -52,6 +52,7 @@ import javax.xml.xpath.XPathExpression; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; +import org.apache.camel.util.IOHelper; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; @@ -330,7 +331,11 @@ public final class XmlSignatureHelper { if (is == null) { throw new IllegalStateException(String.format("XSL file %s not found", path)); } - return getXslTranform(is); + try{ + return getXslTranform(is); + }finally{ + IOHelper.close(is); + } } /**