mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-18 21:02:04 +01:00
Fixes an error while parsing an error message with another format
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2160 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
7f2753f78d
commit
d9aa18a34c
1 changed files with 7 additions and 1 deletions
|
@ -617,16 +617,22 @@ class PacketReader {
|
||||||
*/
|
*/
|
||||||
private XMPPError parseError(XmlPullParser parser) throws Exception {
|
private XMPPError parseError(XmlPullParser parser) throws Exception {
|
||||||
String errorCode = null;
|
String errorCode = null;
|
||||||
|
String message = null;
|
||||||
for (int i=0; i<parser.getAttributeCount(); i++) {
|
for (int i=0; i<parser.getAttributeCount(); i++) {
|
||||||
if (parser.getAttributeName(i).equals("code")) {
|
if (parser.getAttributeName(i).equals("code")) {
|
||||||
errorCode = parser.getAttributeValue("", "code");
|
errorCode = parser.getAttributeValue("", "code");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String message = parser.nextText();
|
// Get the error text in a safe way since we are not sure about the error message format
|
||||||
|
try {
|
||||||
|
message = parser.nextText();
|
||||||
|
}
|
||||||
|
catch (XmlPullParserException ex) {}
|
||||||
while (true) {
|
while (true) {
|
||||||
if (parser.getEventType() == XmlPullParser.END_TAG && parser.getName().equals("error")) {
|
if (parser.getEventType() == XmlPullParser.END_TAG && parser.getName().equals("error")) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
parser.next();
|
||||||
}
|
}
|
||||||
return new XMPPError(Integer.parseInt(errorCode), message);
|
return new XMPPError(Integer.parseInt(errorCode), message);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue