XmlDataHandler extends DefaultHandler { protected static void logParsingIssue(final String prefix, final SAXParseException e) { final StringBuilder buffer = new StringBuilder(); buffer.append(prefix); buffer.append(" while reading UAS data: "); buffer.append(e.getMessage()); buffer.append(" (line: "); buffer.append(e.getLineNumber()); if (e.getSystemId() != null) { buffer.append(" uri: "); buffer.append(e.getSystemId()); } buffer.append(")"); LOG.warn(buffer.toString()); } XmlDataHandler(@Nonnull final DataBuilder builder); @Override void characters(final char ch[], final int start, final int length); @Override void endElement(final String uri, final String localName, final String tagName); @Override void error(final SAXParseException e); @Override void fatalError(final SAXParseException e); boolean hasError(); boolean hasWarning(); @Override InputSource resolveEntity(final String publicId, final String systemId); @Override void startElement(final String uri, final String localName, final String tagName, final Attributes attributes); @Override void warning(final SAXParseException e);  }
@Test public void logParsingIssue() { final String message = "msg"; final String publicId = "public id"; final String systemId = "system id"; final int lineNumber = 123; final int columnNumber = 345; final IllegalArgumentException iae = new IllegalArgumentException(); final SAXParseException e = new SAXParseException(message, publicId, systemId, lineNumber, columnNumber, iae); XmlDataHandler.logParsingIssue("Warning", e); }