From 5034b49c367d3325c06ecd43802f8e60fef10094 Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Tue, 4 Aug 2015 17:24:39 +0300 Subject: [PATCH] Fix https://github.com/konsoletyper/teavm/issues/147 --- .../org/teavm/resource/ClasspathResourceReader.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/teavm-core/src/main/java/org/teavm/resource/ClasspathResourceReader.java b/teavm-core/src/main/java/org/teavm/resource/ClasspathResourceReader.java index 1869c5c29..1d13c4310 100644 --- a/teavm-core/src/main/java/org/teavm/resource/ClasspathResourceReader.java +++ b/teavm-core/src/main/java/org/teavm/resource/ClasspathResourceReader.java @@ -35,7 +35,18 @@ public class ClasspathResourceReader implements ResourceReader { @Override public boolean hasResource(String name) { - return classLoader.getResource(name) != null; + if (classLoader.getResource(name) == null) { + return false; + } + try (InputStream input = classLoader.getResourceAsStream(name)) { + if (input == null) { + return false; + } + input.read(); + } catch (IOException e) { + return false; + } + return true; } @Override