diff --git a/src/main/java/se/bjurr/gitchangelog/internal/util/ResourceLoader.java b/src/main/java/se/bjurr/gitchangelog/internal/util/ResourceLoader.java index 0463834..19b4d2c 100644 --- a/src/main/java/se/bjurr/gitchangelog/internal/util/ResourceLoader.java +++ b/src/main/java/se/bjurr/gitchangelog/internal/util/ResourceLoader.java @@ -5,6 +5,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import java.net.URL; import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Path; @@ -30,6 +31,9 @@ public static String getResourceOrFile(final String resourceName, final Charset getResourceFromClassLoader( resourceName, Thread.currentThread().getContextClassLoader()); } + if (inputStream == null) { + inputStream = getResourceFromURL(resourceName); + } if (inputStream == null) { throw new FileNotFoundException( @@ -61,4 +65,13 @@ private static InputStream getResourceFromClassLoader( } return inputStream; } -} + + private static InputStream getResourceFromURL(final String resourceName) { + try { + URL url = new URL(resourceName); + return url.openStream(); + } catch (IOException e) { + return null; + } + } +} \ No newline at end of file