tidy.setMessageListener(errorListener);
Document document = tidy.parseDOM(inStream, null);
if (errorListener.isBogus()) {
throw new ConversionException("renderers.converter.safe.invalid");
}
parseDocument(outStream, tidy, document);
try {
return filterOutput(new String(outStream.toByteArray(), ENCODING));
} catch (UnsupportedEncodingException e) {
logger.error(e.getMessage(), e);
throw new ConversionException("tidy.converter.ending.notSupported.critical");
}
}