} catch (MarshallingException e) {
throw new SecurityException("Error marshalling the original KeyInfo during cloning", e);
}
}
KeyInfo newKeyInfo = null;
try {
newKeyInfo = (KeyInfo) getUnmarshaller().unmarshall(origKeyInfo.getDOM());
} catch (UnmarshallingException e) {
throw new SecurityException("Error unmarshalling the new KeyInfo during cloning", e);
}
// If the original had no cached DOM, go ahead and drop so this operation doesn't have any side effects.
// If it did have, then drop it on the new one, so isn't cached by two objects.
if (origDOM == null) {
origKeyInfo.releaseChildrenDOM(true);
origKeyInfo.releaseDOM();
} else {
newKeyInfo.releaseChildrenDOM(true);
newKeyInfo.releaseDOM();
}
return newKeyInfo;
}