Packet.toString() issue in Tigase 5.2

Igor Khomenko
Added over 4 years ago

Hi there,

I found one case where Packet.toString() returns wrong data

Let's say I have a packet

<message id="5469f208" type="groupchat" to="..."><body>test.</body><extra xmlns="jabber:client"><subject>my best subject</subject></extra></message>

Then I removed the extra child

Element extra = packet.getElement().getChildStaticStr(EXTRA_KEY);
boolean s = packet.getElement().removeChild(extra); // s is true here

Then I log a packet entity and it still shows that a packet contains extra child

I looked quickly into toStringFull implementation and found that packetToString is generated once

    public String toStringFull() {
        if (packetToString == null) {
            String elemData = elemToString(elem);
            packetToString = calcToString(elemData);

        return "from=" + packetFrom + ", to=" + packetTo + packetToString;

Is it a correct behaviour?

Replies (1)

Added by Wojciech Kapcia TigaseTeam over 4 years ago

Yes, please see #1895