catch number format exception in server ack

This commit is contained in:
Daniel Gultsch 2015-07-10 12:09:59 +02:00
parent 26044ca229
commit 7eac30d1f4
1 changed files with 14 additions and 10 deletions

View File

@ -366,17 +366,21 @@ public class XmppConnection implements Runnable {
} else if (nextTag.isStart("a")) { } else if (nextTag.isStart("a")) {
final Element ack = tagReader.readElement(nextTag); final Element ack = tagReader.readElement(nextTag);
lastPacketReceived = SystemClock.elapsedRealtime(); lastPacketReceived = SystemClock.elapsedRealtime();
final int serverSequence = Integer.parseInt(ack.getAttribute("h")); try {
if (Config.EXTENDED_SM_LOGGING) { final int serverSequence = Integer.parseInt(ack.getAttribute("h"));
Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": server acknowledged stanza #" + serverSequence); if (Config.EXTENDED_SM_LOGGING) {
} Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": server acknowledged stanza #" + serverSequence);
final String msgId = this.messageReceipts.get(serverSequence);
if (msgId != null) {
if (this.acknowledgedListener != null) {
this.acknowledgedListener.onMessageAcknowledged(
account, msgId);
} }
this.messageReceipts.remove(serverSequence); final String msgId = this.messageReceipts.get(serverSequence);
if (msgId != null) {
if (this.acknowledgedListener != null) {
this.acknowledgedListener.onMessageAcknowledged(
account, msgId);
}
this.messageReceipts.remove(serverSequence);
}
} catch (NumberFormatException e) {
Log.d(Config.LOGTAG,account.getJid().toBareJid()+": server send ack without sequence number");
} }
} else if (nextTag.isStart("failed")) { } else if (nextTag.isStart("failed")) {
tagReader.readElement(nextTag); tagReader.readElement(nextTag);