Skip to content

Commit

Permalink
fix warning "Catch block may ignore exception"
Browse files Browse the repository at this point in the history
  • Loading branch information
asolntsev committed May 26, 2024
1 parent 382de2e commit 2bda400
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions flying-saucer-examples/src/main/java/BrowsePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
*/
public class BrowsePanel {
private static final Logger log = LoggerFactory.getLogger(BrowsePanel.class);

private String uri;
private XHTMLPanel panel;
private JFrame frame;
Expand Down Expand Up @@ -170,7 +170,7 @@ private void loadAndCheckArgs(String[] args) {
try {
new URL(name);
} catch (MalformedURLException e) {
throw new IllegalArgumentException("File " + name + " does not exist or is not a URI");
throw new IllegalArgumentException("File " + name + " does not exist or is not a URI", e);
}
}
this.uri = name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,12 +283,14 @@ private Image loadImage(@Nullable String icon) {
try {
url = new URL(uri);
} catch (MalformedURLException e) {
log.debug("Failed to load image {} from uri {}", icon, uri, e);
return null;
}
InputStream is;
try {
is = url.openStream();
} catch (IOException e) {
log.debug("Failed to load image {} from uri {}", icon, uri, e);
return null;
}
if (is == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public String resolveURI(@Nullable String uri) {
ref = new URL(duri);
}
} catch (MalformedURLException e) {
Uu.p("URI/URL is malformed: " + burl + " or " + uri);
Uu.p("URI/URL is malformed: %s or %s (caused by: %s)".formatted(burl, uri, e));
}
} else {
if (!short_url.startsWith("/")) {
Expand All @@ -119,7 +119,7 @@ public String resolveURI(@Nullable String uri) {
}
ref = new URL(base, uri);
} catch (MalformedURLException e) {
Uu.p("URI/URL is malformed: " + burl + " or " + uri);
Uu.p("URI/URL is malformed: %s or %s (caused by: %s)".formatted(burl, uri, e));
}
}

Expand Down

0 comments on commit 2bda400

Please sign in to comment.