Skip to content

Commit

Permalink
Update HTMLResource.java
Browse files Browse the repository at this point in the history
Use HTML in error messages.
  • Loading branch information
andreasrosdal committed May 26, 2024
1 parent 8cacef6 commit 49dd8de
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,17 @@ private HTMLResource(InputStream stream) {
Document jsoupDoc = Jsoup.parse(stream, StandardCharsets.UTF_8.name(), "", Parser.xmlParser());
this.document = convertJsoupToW3CDocument(jsoupDoc);
} catch (IOException | ParserConfigurationException | TransformerException | SAXException e) {
XRLog.load(java.util.logging.Level.SEVERE, "Failed to parse and convert XML document.", e);
throw new XRRuntimeException("Failed to parse and convert XML document.", e);
XRLog.load(java.util.logging.Level.SEVERE, "Failed to parse and convert HTML document.", e);
throw new XRRuntimeException("Failed to parse and convert HTML document.", e);
}
}

public static HTMLResource load(URL source) {
try (InputStream stream = source.openStream()) {
return new HTMLResource(stream);
} catch (IOException e) {
XRLog.load(java.util.logging.Level.SEVERE, "Failed to load XML from URL.", e);
throw new XRRuntimeException("Failed to load XML from URL.", e);
XRLog.load(java.util.logging.Level.SEVERE, "Failed to load HTML from URL.", e);
throw new XRRuntimeException("Failed to load HTML from URL.", e);
}
}

Expand All @@ -72,8 +72,8 @@ public static HTMLResource load(Reader reader) {
InputStream stream = convertReaderToInputStream(reader);
return new HTMLResource(stream);
} catch (IOException e) {
XRLog.load(java.util.logging.Level.SEVERE, "Failed to load XML from Reader.", e);
throw new XRRuntimeException("Failed to load XML from Reader.", e);
XRLog.load(java.util.logging.Level.SEVERE, "Failed to load HTML from Reader.", e);
throw new XRRuntimeException("Failed to load HTML from Reader.", e);
}
}

Expand Down

0 comments on commit 49dd8de

Please sign in to comment.