* @throws DecryptionException thrown if there is an error when marshalling the XMLObject
*/
protected void checkAndMarshall(XMLObject xmlObject) throws DecryptionException {
Element targetElement = xmlObject.getDOM();
if (targetElement == null) {
Marshaller marshaller = Configuration.getMarshallerFactory().getMarshaller(xmlObject);
if (marshaller == null) {
marshaller =
Configuration.getMarshallerFactory().getMarshaller(Configuration.getDefaultProviderQName());
if (marshaller == null) {
String errorMsg = "No marshaller available for " + xmlObject.getElementQName();
log.error(errorMsg);
throw new DecryptionException(errorMsg);
}
}
try {
targetElement = marshaller.marshall(xmlObject);
} catch (MarshallingException e) {
log.error("Error marshalling target XMLObject", e);
throw new DecryptionException("Error marshalling target XMLObject", e);
}
}