Skip to content

Commit 0f3d515

Browse files
committed
Guard against null module name
1 parent a101c58 commit 0f3d515

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/ModuleLayerFeature.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,12 @@ private Set<String> calculateRootModules(FeatureImpl.AfterAnalysisAccessImpl acc
245245
systemModuleFinder = SystemModuleFinders.ofSystem();
246246
}
247247

248-
ModuleFinder builderModuleFinder = ModuleFinder.compose(moduleLayerFeatureUtils.imageClassLoader.classLoaderSupport.modulepathModuleFinder, systemModuleFinder);
249-
ModuleFinder limitedBuilderModuleFinder = moduleLayerFeatureUtils.invokeModuleBootstrapLimitFinder(builderModuleFinder, Set.of(ModuleLayerFeature.class.getModule().getName()), Set.of());
250-
systemModuleFinder = ModuleFinder.compose(limitedBuilderModuleFinder, systemModuleFinder);
248+
Module builderModule = ModuleLayerFeature.class.getModule();
249+
if (builderModule.isNamed()) {
250+
ModuleFinder builderModuleFinder = ModuleFinder.compose(moduleLayerFeatureUtils.imageClassLoader.classLoaderSupport.modulepathModuleFinder, systemModuleFinder);
251+
ModuleFinder limitedBuilderModuleFinder = moduleLayerFeatureUtils.invokeModuleBootstrapLimitFinder(builderModuleFinder, Set.of(ModuleLayerFeature.class.getModule().getName()), Set.of());
252+
systemModuleFinder = ModuleFinder.compose(limitedBuilderModuleFinder, systemModuleFinder);
253+
}
251254

252255
if (haveUpgradeModulePath) {
253256
systemModuleFinder = ModuleFinder.compose(upgradeModulePath, systemModuleFinder);
@@ -1011,8 +1014,6 @@ ModuleFinder invokeModuleBootstrapLimitFinder(ModuleFinder finder, Set<String> r
10111014
try {
10121015
return (ModuleFinder) moduleBootstrapLimitFinderMethod.invoke(null, finder, roots, otherModules);
10131016
} catch (ReflectiveOperationException e) {
1014-
// TODO remove
1015-
e.printStackTrace();
10161017
throw VMError.shouldNotReachHere("Failed to reflectively invoke ModuleBootstrap.limitFinder().", e);
10171018
}
10181019
}

0 commit comments

Comments
 (0)