XmlDataReader implements DataReader { protected static Data readXml(@Nonnull final InputStream inputStream, @Nonnull final Charset charset) { Check.notNull(inputStream, "inputStream"); Check.notNull(charset, "charset"); final DataBuilder builder = new DataBuilder(); boolean hasErrors = false; try { XmlParser.parse(inputStream, builder); } catch (final ParserConfigurationException e) { hasErrors = true; LOG.warn(e.getLocalizedMessage()); } catch (final SAXException e) { hasErrors = true; LOG.warn(e.getLocalizedMessage()); } catch (final IOException e) { hasErrors = true; LOG.warn(e.getLocalizedMessage()); } catch (final IllegalStateException e) { hasErrors = true; LOG.warn(e.getLocalizedMessage()); } catch (final Exception e) { hasErrors = true; LOG.warn(e.getLocalizedMessage(), e); } finally { Closeables.closeAndConvert(inputStream, true); } return hasErrors ? Data.EMPTY : builder.build(); }  @Override Data read(@Nonnull final String data); @Override Data read(@Nonnull final URL url, @Nonnull final Charset charset);  }
@Test(expected = IllegalNullArgumentException.class) public void readXml_charset_null() throws IOException { XmlDataReader.readXml(new InputStream() { @Override public int read() throws IOException { return 0; } }, null); }
@Test(expected = IllegalNullArgumentException.class) public void readXml_url_null() throws IOException { XmlDataReader.readXml(null, CHARSET); }