default:
log.error("Attempting to send error message to remote system.", e);
break;
}
HL7Exception hl7e = e instanceof HL7Exception ?
(HL7Exception) e :
new HL7Exception(e.getMessage(), e);
try {
Message out = hl7e.getResponseMessage();
if (out == null) {
Message in = getInMessage(inHeader);
out = in.generateACK(DEFAULT_EXCEPTION_ACKNOWLEDGEMENT_CODE, hl7e);
}
return encoding != null ? p.encode(out, encoding) : p.encode(out);
} catch (IOException ioe) {
throw new HL7Exception(
"IOException creating error response message: "
+ ioe.getMessage());
}
}