From f952ee8db573fae8b2c91dbd04fe3d9f11258c9f Mon Sep 17 00:00:00 2001 From: Kevin Smith Date: Wed, 17 Oct 2012 10:29:00 +0100 Subject: Catch xml parser exceptions and fail parsing Change-Id: If5ef43f2d875f958cd8114b0b3246e6e6f03c95b diff --git a/src/com/isode/stroke/parser/XMPPParser.java b/src/com/isode/stroke/parser/XMPPParser.java index 516ab76..658ed9b 100644 --- a/src/com/isode/stroke/parser/XMPPParser.java +++ b/src/com/isode/stroke/parser/XMPPParser.java @@ -31,7 +31,13 @@ public class XMPPParser implements XMLParserClient { public boolean parse(String data) { parseErrorOccurred_ = false; - boolean xmlParseResult = xmlParser_.parse(data); + boolean xmlParseResult = false; + try { + xmlParseResult = xmlParser_.parse(data); + } catch (Exception e) { + parseErrorOccurred_ = true; + logger_.warning("Data " + data + " caused:\n" + e.getMessage()); + } if (parseErrorOccurred_ || !xmlParseResult) { logger_.warning(String.format("When parsing, %b and %b", parseErrorOccurred_, xmlParseResult)); } -- cgit v0.10.2-6-g49f6