Commit 0c8188e2 authored by Tom Evans's avatar Tom Evans Committed by Christian Schudt

OF-949: Catch parsing errors for offline messages

Detect offline messages that fail to parse; write to error log before
discarding as undeliverable. This will unblock the offline message queue
for future (valid) messages addressed to the affected user.
parent fe8d6a26
......@@ -206,8 +206,13 @@ public class OfflineMessageStore extends BasicModule implements UserEventListene
if (matcher.find()) {
msgXML = matcher.replaceAll("");
}
message = new OfflineMessage(creationDate,
try {
message = new OfflineMessage(creationDate,
xmlReader.read(new StringReader(msgXML)).getRootElement());
} catch (DocumentException de) {
Log.error("Failed to route packet (offline message): " + msgXML, de);
continue; // skip and process remaining offline messages
}
}
// Add a delayed delivery (XEP-0203) element to the message.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment