public Status parseBytes(byte[] bytes) {
try {
InputSource is = new InputSource();
is.setByteStream(new ByteArrayInputStream(bytes));
PARSER.parse(is, DOCHANDLER);
return DOCHANDLER.getContents();
} catch (SAXException e) {
log.error("Failed to parse the bytes",e);
// let bad input fail silently
return DOCHANDLER.getContents();
} catch (IOException e) { // Should never happen
log.error("Failed to read the bytes",e);
// let bad input fail silently
return DOCHANDLER.getContents();
}
}
parse byte array and return Status object |