We can safely throw IOException, so prefer that to throwing and
unchecked IllegalStateException.
Change-Id: Ib57512055a7a2698db5a568b8856ac5010d52f91
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
}
private static XMLStreamWriter createXmlWriter(final OutputStream entityStream,
- final @Nullable PrettyPrintParam prettyPrint) {
+ final @Nullable PrettyPrintParam prettyPrint) throws IOException {
final XMLStreamWriter xmlWriter;
try {
xmlWriter = XML_FACTORY.createXMLStreamWriter(entityStream, StandardCharsets.UTF_8.name());
} catch (XMLStreamException | FactoryConfigurationError e) {
- throw new IllegalStateException(e);
+ throw new IOException(e);
}
return prettyPrint != null && prettyPrint.value() ? new IndentingXMLStreamWriter(xmlWriter) : xmlWriter;