if (message != null) {
nextFilter(context);
}
AMFMessage response = context.getResponseMessage();
MessageSerializer serializer = context.locateSerializer();
try {
serializer.writeMessage(response);
} catch (Exception e) {
LogWriter.error(getClass(), "Failed to serialize response: " + e, e);
AMFMessageBody errorBody = new AMFMessageBody();
ErrorMessage errorMessage = new ErrorMessage("Failed to serialize message: " + e, "", "", null);
errorBody.setData(errorMessage);
context.setResponseBody(errorBody);
response = new AMFMessage();
response.getBodies().add(errorBody);
errorBody.setResponseURI(AMFMessageBody.STATUS_METHOD);
errorBody.setTargetURI(errorBody.getResponseURI());
try {
serializer.writeMessage(response);
} catch (Exception e1) {
LogWriter.error(getClass(), "Could not serialize error message: " + e1, e1);
throw new RuntimeException("Could not serialize error message", e1);
}
}