} else {
try {
String s = XMLHelper.getXML((Document) obj);
log.debug("Object is Document. Returning string.");
log_xml.debug("Document -> String: " + s);
out.writeObject(s);
} catch (IOException e) {
log.error("Could not parse input Document into string! Weird.", e);
if (err == null) {
throw new RuntimeException("Could not parse input Document into string! Weird.", e);
} else {