powered by Jive Software

XMLDebugger for OF 3.10.2 [Solution]

The plugin stopped working when I upgraded to 3.10.2

I had to modify the plugin’s file RawPrintFilter.java methods: messageReceived and messageSent

Object message is no longer an instance of ByteBuffer but IoBuffer. Just replace the methods and recompile the plugin. Find the recompiled plugins attached to this post

@Override

public void messageReceived(NextFilter nextFilter, IoSession session, Object message) throws Exception {

    // Decode the bytebuffer and print it to the stdout

if (enabled && message instanceof IoBuffer) {

IoBuffer ioBuffer = (IoBuffer) message;

ByteBuffer byteBuffer = ioBuffer.buf();

        // Keep current position in the buffer

int currentPos = byteBuffer.position();

        // Decode buffer

Charset encoder = Charset.forName(“UTF-8”);

CharBuffer charBuffer = encoder.decode(byteBuffer.asReadOnlyBuffer());

        // Print buffer content

System.out.println(prefix + " - RECV (" + session.hashCode() + "): " + charBuffer);

        // Reset to old position in the buffer

byteBuffer.position(currentPos);

}

    // Pass the message to the next filter

super.messageReceived(nextFilter, session, message);

}

@Override

public void messageSent(NextFilter nextFilter, IoSession session, WriteRequest writeRequest) throws Exception {

if (enabled && writeRequest.getMessage() instanceof IoBuffer) {

IoBuffer ioBuffer = (IoBuffer) writeRequest.getMessage();

ByteBuffer byteBuffer = ioBuffer.buf();

System.out.println(prefix + " - SENT (" + session.hashCode() + "): " +

Charset.forName(“UTF-8”).decode(byteBuffer.asReadOnlyBuffer()));

}

    // Pass the message to the next filter

super.messageSent(nextFilter, session, writeRequest);

}
xmldebugger.jar (13053 Bytes)

Thanks, please consider sending us a Github pull request with that change.

hi dams,

really thanks your help, the messageReceived is ok, but the messageSent can not work.

Did you have any update for it?

Regards,

Snowing

byte[] b = ioBuffer.array();

String s = new String(b,“UTF-8”)

log s