From 85d3caf07960957a2cef7596a713443087ea5bff Mon Sep 17 00:00:00 2001 From: rob bygrave Date: Mon, 21 May 2018 00:29:04 +1200 Subject: [PATCH] #1367 - Modularized project cannot locate ebean.properties file on Java 10 --- .../java/io/ebean/config/properties/LoadContext.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/ebean/config/properties/LoadContext.java b/src/main/java/io/ebean/config/properties/LoadContext.java index 7ec6a8f38..e8a5fc729 100644 --- a/src/main/java/io/ebean/config/properties/LoadContext.java +++ b/src/main/java/io/ebean/config/properties/LoadContext.java @@ -37,7 +37,7 @@ class LoadContext { InputStream is = null; if (source == Loader.Source.RESOURCE) { - is = getClass().getResourceAsStream("/" + resourcePath); + is = resourceStream(resourcePath); if (is != null) { loadedResources.add(resourcePath); } @@ -56,6 +56,15 @@ class LoadContext { return is; } + private InputStream resourceStream(String resourcePath) { + InputStream is = getClass().getResourceAsStream("/" + resourcePath); + if (is == null) { + // search the module path for top level resource + is = ClassLoader.getSystemResourceAsStream(resourcePath); + } + return is; + } + /** * Add a property entry. */