Skip to content

Commit 4b235a5

Browse files
committed
[GR-40762] Fix c.o.svm.core.jdk.Resources#createInputStream(String, String) for moduleName == null case.
PullRequest: graal/12645
2 parents 4e94e4a + 8faf577 commit 4b235a5

File tree

1 file changed

+14
-1
lines changed
  • substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk

1 file changed

+14
-1
lines changed

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/Resources.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@
4141
import org.graalvm.nativeimage.Platform;
4242
import org.graalvm.nativeimage.Platforms;
4343

44+
import com.oracle.svm.core.feature.AutomaticallyRegisteredFeature;
4445
import com.oracle.svm.core.feature.InternalFeature;
4546
import com.oracle.svm.core.jdk.resources.NativeImageResourcePath;
4647
import com.oracle.svm.core.jdk.resources.ResourceStorageEntry;
47-
import com.oracle.svm.core.feature.AutomaticallyRegisteredFeature;
4848
import com.oracle.svm.core.util.ImageHeapMap;
4949
import com.oracle.svm.core.util.VMError;
5050

@@ -222,6 +222,19 @@ public static InputStream createInputStream(String moduleName, String resourceNa
222222
}
223223

224224
ResourceStorageEntry entry = Resources.get(moduleName, resourceName);
225+
if (moduleName == null && entry == null) {
226+
/*
227+
* If no moduleName is specified and entry was not found as classpath-resource we have
228+
* to search for the resource in all modules in the image.
229+
*/
230+
for (Module module : BootModuleLayerSupport.instance().getBootLayer().modules()) {
231+
entry = Resources.get(module.getName(), resourceName);
232+
if (entry != null) {
233+
break;
234+
}
235+
}
236+
}
237+
225238
if (entry == null) {
226239
return null;
227240
}

0 commit comments

Comments
 (0)