Commit dc0a6461 authored by Alex Wenckus's avatar Alex Wenckus Committed by alex

Missed handling of exception. Properly closed now.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/branches@5742 b35dd754-fafc-0310-a699-88a17e54d16e
parent 20fc533a
...@@ -14,6 +14,7 @@ import org.xmlpull.v1.XmlPullParserFactory; ...@@ -14,6 +14,7 @@ import org.xmlpull.v1.XmlPullParserFactory;
import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserException;
import org.jivesoftware.util.Log; import org.jivesoftware.util.Log;
import org.jivesoftware.wildfire.net.MXParser; import org.jivesoftware.wildfire.net.MXParser;
import org.jivesoftware.wildfire.auth.UnauthorizedException;
import org.dom4j.io.XMPPPacketReader; import org.dom4j.io.XMPPPacketReader;
import org.dom4j.Document; import org.dom4j.Document;
import org.dom4j.DocumentException; import org.dom4j.DocumentException;
...@@ -146,9 +147,18 @@ public class HttpBindServlet extends HttpServlet { ...@@ -146,9 +147,18 @@ public class HttpBindServlet extends HttpServlet {
return; return;
} }
HttpConnection connection = new HttpConnection(rid, request.isSecure());
connection.setSession(sessionManager.createSession(rootNode, connection)); try {
respond(response, connection); HttpConnection connection = new HttpConnection(rid, request.isSecure());
connection.setSession(sessionManager.createSession(rootNode, connection));
respond(response, connection);
}
catch (UnauthorizedException e) {
// Server wasn't initialized yet.
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
"Server Not initialized");
}
} }
private void respond(HttpServletResponse response, HttpConnection connection) private void respond(HttpServletResponse response, HttpConnection connection)
......
...@@ -135,10 +135,10 @@ public class HttpSession extends ClientSession { ...@@ -135,10 +135,10 @@ public class HttpSession extends ClientSession {
} }
public void close() { public void close() {
close(false); conn.close();
} }
public synchronized void close(boolean isServerShuttingDown) { private synchronized void close(boolean isServerShuttingDown) {
if(isClosed) { if(isClosed) {
return; return;
} }
......
...@@ -187,10 +187,10 @@ public class HttpSessionManager { ...@@ -187,10 +187,10 @@ public class HttpSessionManager {
router.route(packet); router.route(packet);
} }
catch (UnsupportedEncodingException e) { catch (UnsupportedEncodingException e) {
e.printStackTrace(); throw new HttpBindException("Bad auth request, unknown encoding", true, 400);
} }
catch (UnknownStanzaException e) { catch (UnknownStanzaException e) {
e.printStackTrace(); throw new HttpBindException("Unknown packet type.", false, 400);
} }
} }
...@@ -227,7 +227,7 @@ public class HttpSessionManager { ...@@ -227,7 +227,7 @@ public class HttpSessionManager {
} }
public void run() { public void run() {
session.close(false); session.close();
} }
} }
} }
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