Skip to content

Commit 7790122

Browse files
committed
fix classpath check
1 parent efa069f commit 7790122

File tree

1 file changed

+5
-1
lines changed
  • graphviz-java/src/main/java/guru/nidi/graphviz/engine

1 file changed

+5
-1
lines changed

graphviz-java/src/main/java/guru/nidi/graphviz/engine/IoUtils.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ static String readStream(InputStream in) throws IOException {
3333
}
3434

3535
static boolean isOnClasspath(String resource) {
36-
return Thread.currentThread().getContextClassLoader().getResourceAsStream(resource) != null;
36+
try (final InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource)) {
37+
return stream != null;
38+
} catch (IOException e) {
39+
throw new AssertionError(e);
40+
}
3741
}
3842

3943
static void closeQuietly(AutoCloseable c) {

0 commit comments

Comments
 (0)