Bug: Incorrect parsing of stream:error with text

So it seems if a stream:error contains a text element, Smack will incorrectly parse the error code as “text”, resulting in the vague error “stream:error(text)”.

For example the following error:

<stream:error>
  <conflict xmlns='urn:ietf:params:xml:ns:xmpp-streams' />
  <text xml:lang='' xmlns='urn:ietf:params:xml:ns:xmpp-streams'>Replaced by new connection</text>
</stream:error>

So instead of an error code of “conflict”, Smack will read the “text” element and clobber the “conflict” element that it first saw and return “text” as the stream error.

This causes problems with the ReconnectionManager’s reconnection strategy. If it parsed that error incorrectly as a “text” error rather than a “conflict” error, it would attempt to reconnect, whereas other “conflict” errors will not reconnect.

The attached patch will correctly read the error code, as well as the optional text field that can be present in stream:error messages.

Can someone file a JIRA ticket.

Thanks,

Dan
smack-stream-error-text.patch.zip (937 Bytes)