You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by co...@apache.org on 2014/06/13 11:57:14 UTC
svn commit: r1602356 -
/santuario/xml-security-java/branches/1.5.x-fixes/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMSignedInfo.java
Author: coheigea
Date: Fri Jun 13 09:57:14 2014
New Revision: 1602356
URL: http://svn.apache.org/r1602356
Log:
[SANTUARIO-393] - Performance regression as signature data is not buffered. Thanks to Markus KilÄs for the patch.
Modified:
santuario/xml-security-java/branches/1.5.x-fixes/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMSignedInfo.java
Modified: santuario/xml-security-java/branches/1.5.x-fixes/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMSignedInfo.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/1.5.x-fixes/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMSignedInfo.java?rev=1602356&r1=1602355&r2=1602356&view=diff
==============================================================================
--- santuario/xml-security-java/branches/1.5.x-fixes/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMSignedInfo.java (original)
+++ santuario/xml-security-java/branches/1.5.x-fixes/src/main/java/org/apache/jcp/xml/dsig/internal/dom/DOMSignedInfo.java Fri Jun 13 09:57:14 2014
@@ -219,8 +219,17 @@ public final class DOMSignedInfo extends
}
OutputStream os = new UnsyncBufferedOutputStream(bos);
+
+ DOMSubTreeData subTree = new DOMSubTreeData(localSiElem, true);
try {
- os.close();
+ ((DOMCanonicalizationMethod)
+ canonicalizationMethod).canonicalize(subTree, context, os);
+ } catch (TransformException te) {
+ throw new XMLSignatureException(te);
+ }
+
+ try {
+ os.flush();
} catch (IOException e) {
if (log.isDebugEnabled()) {
log.debug(e);
@@ -228,15 +237,6 @@ public final class DOMSignedInfo extends
// Impossible
}
- DOMSubTreeData subTree = new DOMSubTreeData(localSiElem, true);
-
- try {
- ((DOMCanonicalizationMethod)
- canonicalizationMethod).canonicalize(subTree, context, bos);
- } catch (TransformException te) {
- throw new XMLSignatureException(te);
- }
-
byte[] signedInfoBytes = bos.toByteArray();
// this whole block should only be done if logging is enabled
@@ -251,6 +251,15 @@ public final class DOMSignedInfo extends
}
this.canonData = new ByteArrayInputStream(signedInfoBytes);
+
+ try {
+ os.close();
+ } catch (IOException e) {
+ if (log.isDebugEnabled()) {
+ log.debug(e.getMessage(), e);
+ }
+ // Impossible
+ }
}
public void marshal(Node parent, String dsPrefix, DOMCryptoContext context)