1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2025-09-10 18:59:41 +02:00

SMACK-452 Correctly parse stream error packets

Modified PacketParserUtils.parseStreamError() to take into account that
there may be an optional text element and an optional application
specific element.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/branches/smack_3_3_2@13767 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Florian Schmaus 2013-10-09 17:02:34 +00:00 committed by flow
parent b253203cfb
commit bd709dc323
3 changed files with 126 additions and 7 deletions

View file

@ -82,13 +82,21 @@ package org.jivesoftware.smack.packet;
*/
public class StreamError {
public static final String NAMESPACE = "urn:ietf:params:xml:ns:xmpp-streams";
private String code;
private String text;
public StreamError(String code) {
super();
this.code = code;
}
public StreamError(String code, String text) {
this(code);
this.text = text;
}
/**
* Returns the error code.
*
@ -98,9 +106,19 @@ public class StreamError {
return code;
}
/**
* Returns the error text, which may be null.
*
* @return the error text.
*/
public String getText() {
return text;
}
public String toString() {
StringBuilder txt = new StringBuilder();
txt.append("stream:error (").append(code).append(")");
if (text != null) txt.append(" text: ").append(text);
return txt.toString();
}
}