Commit bd4e0766 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Fixed NPE when port 5222 or 5223 are disabled.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/branches/3_3_1_branch@9160 b35dd754-fafc-0310-a699-88a17e54d16e
parent d2c01164
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
package org.jivesoftware.openfire.plugin; package org.jivesoftware.openfire.plugin;
import org.apache.mina.transport.socket.nio.SocketAcceptor;
import org.jivesoftware.openfire.XMPPServer; import org.jivesoftware.openfire.XMPPServer;
import org.jivesoftware.openfire.container.Plugin; import org.jivesoftware.openfire.container.Plugin;
import org.jivesoftware.openfire.container.PluginManager; import org.jivesoftware.openfire.container.PluginManager;
...@@ -41,9 +42,15 @@ public class DebuggerPlugin implements Plugin, PropertyEventListener { ...@@ -41,9 +42,15 @@ public class DebuggerPlugin implements Plugin, PropertyEventListener {
// Add filter to filter chain builder // Add filter to filter chain builder
ConnectionManagerImpl connManager = (ConnectionManagerImpl) XMPPServer.getInstance().getConnectionManager(); ConnectionManagerImpl connManager = (ConnectionManagerImpl) XMPPServer.getInstance().getConnectionManager();
defaultPortFilter = new RawPrintFilter(); defaultPortFilter = new RawPrintFilter();
connManager.getSocketAcceptor().getFilterChain().addBefore("xmpp", "rawDebugger", defaultPortFilter); SocketAcceptor socketAcceptor = connManager.getSocketAcceptor();
if (socketAcceptor != null) {
socketAcceptor.getFilterChain().addBefore("xmpp", "rawDebugger", defaultPortFilter);
}
oldPortFilter = new RawPrintFilter(); oldPortFilter = new RawPrintFilter();
connManager.getSSLSocketAcceptor().getFilterChain().addBefore("xmpp", "rawDebugger", oldPortFilter); SocketAcceptor sslAcceptor = connManager.getSSLSocketAcceptor();
if (sslAcceptor != null) {
sslAcceptor.getFilterChain().addBefore("xmpp", "rawDebugger", oldPortFilter);
}
interpretedPrinter = new InterpretedXMLPrinter(); interpretedPrinter = new InterpretedXMLPrinter();
if (JiveGlobals.getBooleanProperty("plugin.debugger.interpretedAllowed")) { if (JiveGlobals.getBooleanProperty("plugin.debugger.interpretedAllowed")) {
...@@ -59,10 +66,12 @@ public class DebuggerPlugin implements Plugin, PropertyEventListener { ...@@ -59,10 +66,12 @@ public class DebuggerPlugin implements Plugin, PropertyEventListener {
PropertyEventDispatcher.removeListener(this); PropertyEventDispatcher.removeListener(this);
// Remove filter from filter chain builder // Remove filter from filter chain builder
ConnectionManagerImpl connManager = (ConnectionManagerImpl) XMPPServer.getInstance().getConnectionManager(); ConnectionManagerImpl connManager = (ConnectionManagerImpl) XMPPServer.getInstance().getConnectionManager();
if (connManager.getSocketAcceptor().getFilterChain().contains("rawDebugger")) { if (connManager.getSocketAcceptor() != null &&
connManager.getSocketAcceptor().getFilterChain().contains("rawDebugger")) {
connManager.getSocketAcceptor().getFilterChain().remove("rawDebugger"); connManager.getSocketAcceptor().getFilterChain().remove("rawDebugger");
} }
if (connManager.getSSLSocketAcceptor().getFilterChain().contains("rawDebugger")) { if (connManager.getSSLSocketAcceptor() != null &&
connManager.getSSLSocketAcceptor().getFilterChain().contains("rawDebugger")) {
connManager.getSSLSocketAcceptor().getFilterChain().remove("rawDebugger"); connManager.getSSLSocketAcceptor().getFilterChain().remove("rawDebugger");
} }
// Remove the filters from existing sessions // Remove the filters from existing sessions
......
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