diff options
author | Kevin Smith <git@kismith.co.uk> | 2012-10-17 09:29:00 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2012-10-17 10:17:06 (GMT) |
commit | f952ee8db573fae8b2c91dbd04fe3d9f11258c9f (patch) | |
tree | 5af3ee6495541eec5ffd5af87f01400cb8782970 /src/com | |
parent | d66758487de9cec5a0d3ca6380da2c3e22ab9ee2 (diff) | |
download | stroke-f952ee8db573fae8b2c91dbd04fe3d9f11258c9f.zip stroke-f952ee8db573fae8b2c91dbd04fe3d9f11258c9f.tar.bz2 |
Catch xml parser exceptions and fail parsing
Change-Id: If5ef43f2d875f958cd8114b0b3246e6e6f03c95b
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/isode/stroke/parser/XMPPParser.java | 8 |
1 files changed, 7 insertions, 1 deletions
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)); } |