this.derefData = copyDerefData(dereferencedData);
dos = new DigesterOutputStream(md, true);
} else {
dos = new DigesterOutputStream(md);
}
OutputStream os = new UnsyncBufferedOutputStream(dos);
Data data = dereferencedData;
for (int i = 0, size = transforms.size(); i < size; i++) {
DOMTransform transform = (DOMTransform) transforms.get(i);
try {
if (i < size - 1) {
data = transform.transform(data, context);
} else {
data = transform.transform(data, context, os);
}
} catch (TransformException te) {
throw new XMLSignatureException(te);
}
}
try {
if (data != null) {
XMLSignatureInput xi;
if (data instanceof ApacheData) {
xi = ((ApacheData) data).getXMLSignatureInput();
} else if (data instanceof OctetStreamData) {
xi = new XMLSignatureInput
(((OctetStreamData)data).getOctetStream());
} else if (data instanceof NodeSetData) {
TransformService spi = TransformService.getInstance
(CanonicalizationMethod.INCLUSIVE, "DOM");
data = spi.transform(data, context);
xi = new XMLSignatureInput
(((OctetStreamData)data).getOctetStream());
} else {
throw new XMLSignatureException("unrecognized Data type");
}
xi.updateOutputStream(os);
}
os.flush();
if (cache != null && cache.booleanValue() == true) {
this.dis = dos.getInputStream();
}
return dos.getDigestValue();
} catch (Exception e) {