Commit 70bf7e0d authored by guus's avatar guus

OF-524: Apparently our exception gets wrapped.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@12983 b35dd754-fafc-0310-a699-88a17e54d16e
parent 31e93b66
...@@ -136,24 +136,25 @@ public abstract class ConnectionHandler extends IoHandlerAdapter { ...@@ -136,24 +136,25 @@ public abstract class ConnectionHandler extends IoHandlerAdapter {
public void exceptionCaught(IoSession session, Throwable cause) throws Exception { public void exceptionCaught(IoSession session, Throwable cause) throws Exception {
if (cause instanceof IOException) { if (cause instanceof IOException) {
// TODO Verify if there were packets pending to be sent and decide what to do with them // TODO Verify if there were packets pending to be sent and decide what to do with them
Log.debug("ConnectionHandler: ",cause); Log.info("ConnectionHandler reports IOException for session: " + session, cause);
}
else if (cause instanceof XMLNotWellFormedException) {
Log.warn("Closing session due to malformed XML: " + session, cause);
final Connection connection = (Connection) session.getAttribute(CONNECTION);
final StreamError error = new StreamError(StreamError.Condition.xml_not_well_formed);
connection.deliverRawText(error.toXML());
session.close();
} }
else if (cause instanceof ProtocolDecoderException) { else if (cause instanceof ProtocolDecoderException) {
Log.warn("Closing session due to exception: " + session, cause); Log.warn("Closing session due to exception: " + session, cause);
// PIO-524: Determine stream:error message.
final StreamError error;
if (cause.getCause() != null && cause.getCause() instanceof XMLNotWellFormedException) {
error = new StreamError(StreamError.Condition.xml_not_well_formed);
} else {
error = new StreamError(StreamError.Condition.internal_server_error);
}
final Connection connection = (Connection) session.getAttribute(CONNECTION); final Connection connection = (Connection) session.getAttribute(CONNECTION);
final StreamError error = new StreamError(StreamError.Condition.internal_server_error);
connection.deliverRawText(error.toXML()); connection.deliverRawText(error.toXML());
session.close(); session.close();
} }
else { else {
Log.error(cause.getMessage(), cause); Log.error("ConnectionHandler reports unexpected exception for session: " + session, cause);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment