powered by Jive Software

Bug: PacketParserUtils.parseStreamError returns wrong error codes

According to: http://xmpp.org/schemas/streams.xsd

A stream error can look like this:

stream:errorReplaced by new connection</stream:error>

According to the code:

while (!done) {
int eventType = parser.next();

if (eventType == XmlPullParser.START_TAG) {
streamError = new StreamError(parser.getName());
}
else if (eventType == XmlPullParser.END_TAG) {
if (parser.getName().equals(“error”)) {
done = true;
}
}
}

This will return the wrong result.

For this stream error the error code returned from parseStreamError is:

stream:error (text)

but should be

stream:error (conflict)

This is a known issue tracked as SMACK-452

Thanks for reporting anyways

Ok

I am just wondering why this is not fixed yet.

According to http://xmpp.org/rfcs/rfc6120.html#streams-error-syntax the first XML tag includes the stream error and so the fix is somewhat trivial:

instead of: if(eventType == XmlPullParser.START_TAG) it should be if(eventType == XmlPullParser.START_TAG && streamError == null)

srossbach wrote:

I am just wondering why this is not fixed yet.

According to http://xmpp.org/rfcs/rfc6120.html#streams-error-syntax the first XML tag includes the stream error and so the fix is somewhat trivial:

I don’t see where RFC6120 specifies that the first element is the stream error. Anyway I agree that the fix is trivial.