Quantcast
Channel: Ignite Realtime : All Content - Openfire Dev
Viewing all articles
Browse latest Browse all 966

XML Debugger is not working with Openfire 4.x

$
0
0

Openfire ships with an "xmldebugger" plugin; that's no longer working with Openfire 4, probably because of a change in startup order. The fix is to delay the initialisation until the plugin manager has completed.

 

To fix this, in org.jivesoftware.openfire.plugin.DebuggerPlugin, replace the existing initializePlugin(...) method with the following two (apologies about the formatting, it's got a little awry in the cut'n'paste).

 

public void initializePlugin(PluginManager pluginManager, File pluginDirectory) {

   if (pluginManager.isExecuted()) {

  addInterceptors();

  } else {

  pluginManager.addPluginManagerListener(new PluginManagerListener() {

   public void pluginsMonitored() {

   // Stop listening for plugin events
   pluginManager.removePluginManagerListener(this);

   // Start listeners
   addInterceptors();

  }

  });

  }

}

 

private void addInterceptors() {

   // Add filter to filter chain builder
   ConnectionManagerImpl connManager = (ConnectionManagerImpl) XMPPServer.getInstance().getConnectionManager();

   defaultPortFilter = new RawPrintFilter("C2S");

  SocketAcceptor socketAcceptor = connManager.getSocketAcceptor();

   if (socketAcceptor != null) {

  socketAcceptor.getFilterChain().addFirst("rawDebugger", defaultPortFilter);

  }

   oldPortFilter = new RawPrintFilter("SSL");

  SocketAcceptor sslAcceptor = connManager.getSSLSocketAcceptor();

   if (sslAcceptor != null) {

  sslAcceptor.getFilterChain().addFirst("rawDebugger", oldPortFilter);

  }

 

   componentPortFilter = new RawPrintFilter("ExComp");

  SocketAcceptor componentAcceptor = connManager.getComponentAcceptor();

   if (componentAcceptor != null) {

  componentAcceptor.getFilterChain().addFirst("rawDebugger", componentPortFilter);

  }

 

   multiplexerPortFilter = new RawPrintFilter("CM");

  SocketAcceptor multiplexerAcceptor = connManager.getMultiplexerSocketAcceptor();

   if (multiplexerAcceptor != null) {

  multiplexerAcceptor.getFilterChain().addFirst("rawDebugger", multiplexerPortFilter);

  }

 

   interpretedPrinter = new InterpretedXMLPrinter();

   if (JiveGlobals.getBooleanProperty("plugin.debugger.interpretedAllowed")) {

   // Add the packet interceptor that prints interpreted XML
   InterceptorManager.getInstance().addInterceptor(interpretedPrinter);

  }

   // Listen to property events
   PropertyEventDispatcher.addListener(this);

}


Viewing all articles
Browse latest Browse all 966

Trending Articles