mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-09 07:35:49 +00:00
8049244: XML Signature performance issue caused by unbuffered signature data
Reviewed-by: xuelei
This commit is contained in:
parent
723bfa2b58
commit
f5e233d84b
@ -221,8 +221,17 @@ public final class DOMSignedInfo extends DOMStructure implements SignedInfo {
|
||||
}
|
||||
|
||||
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.isLoggable(java.util.logging.Level.FINE)) {
|
||||
log.log(java.util.logging.Level.FINE, e.getMessage(), e);
|
||||
@ -230,15 +239,6 @@ public final class DOMSignedInfo extends DOMStructure implements SignedInfo {
|
||||
// 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
|
||||
@ -253,6 +253,15 @@ public final class DOMSignedInfo extends DOMStructure implements SignedInfo {
|
||||
}
|
||||
|
||||
this.canonData = new ByteArrayInputStream(signedInfoBytes);
|
||||
|
||||
try {
|
||||
os.close();
|
||||
} catch (IOException e) {
|
||||
if (log.isLoggable(java.util.logging.Level.FINE)) {
|
||||
log.log(java.util.logging.Level.FINE, e.getMessage(), e);
|
||||
}
|
||||
// Impossible
|
||||
}
|
||||
}
|
||||
|
||||
public void marshal(Node parent, String dsPrefix, DOMCryptoContext context)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user