Skip to content

Commit

Permalink
FIX: return null in case of a 404 error instead of throwing an exception
Browse files Browse the repository at this point in the history
Release version 1.6.0
  • Loading branch information
double-beep committed Oct 16, 2020
1 parent c8e06fb commit fe43636
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 0 additions & 1 deletion checkstyle_checks.xml
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,6 @@
<property name="format" value="^([^\s\/*])"/>
<message key="todo.match" value="Comment text should start with space."/>
</module>
<module name="TrailingComment"/>
<module name="UncommentedMain">
<property name="excludedClasses" value="\.(Application|JavadocPropertiesGenerator)$"/>
</module>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>bugs.stackoverflow</groupId>
<artifactId>belisarius</artifactId>
<version>1.5.11</version>
<version>1.6.0</version>

<properties>
<project.java.version>1.8</project.java.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ public static String getHtml(String url) throws IOException {
Connection.Response response = Jsoup.connect(url).method(Connection.Method.GET)
.ignoreContentType(true).ignoreHttpErrors(true).execute();
String body = response.body();
if (response.statusCode() != 200) {
if (response.statusCode() == 404) { // revision did not affect the body
return null;
} else if (response.statusCode() != 200) {
throw new IOException("HTTP " + response.statusCode() + " error fetching " + url + ".");
}
return Jsoup.parse(body).getElementsByTag("pre").text();
Expand Down

0 comments on commit fe43636

Please sign in to comment.