Commit dc91f193 authored by Tom Evans's avatar Tom Evans

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 a7cd832a
...@@ -206,8 +206,13 @@ public class OfflineMessageStore extends BasicModule implements UserEventListene ...@@ -206,8 +206,13 @@ public class OfflineMessageStore extends BasicModule implements UserEventListene
if (matcher.find()) { if (matcher.find()) {
msgXML = matcher.replaceAll(""); msgXML = matcher.replaceAll("");
} }
try {
message = new OfflineMessage(creationDate, message = new OfflineMessage(creationDate,
xmlReader.read(new StringReader(msgXML)).getRootElement()); 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
}
} }
// if there is already a delay stamp, we shouldn't add another. // if there is already a delay stamp, we shouldn't add another.
......
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