Skip to content

Commit 2afebf9

Browse files
committed
exclude java.desktop from system modules
1 parent 04917c5 commit 2afebf9

File tree

1 file changed

+9
-1
lines changed
  • libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy

1 file changed

+9
-1
lines changed

libs/entitlement/src/main/java/org/elasticsearch/entitlement/runtime/policy/PolicyManager.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ public class PolicyManager {
6767

6868
static final Class<?> DEFAULT_FILESYSTEM_CLASS = PathUtils.getDefaultFileSystem().getClass();
6969

70+
static final Set<String> MODULES_EXCLUDED_FROM_SYSTEM_MODULES = Set.of("java.desktop");
71+
7072
/**
7173
* @param componentName the plugin name; or else one of the special component names
7274
* like {@link #SERVER_COMPONENT_NAME} or {@link #APM_AGENT_COMPONENT_NAME}.
@@ -141,7 +143,13 @@ private static Set<Module> findSystemModules() {
141143
// entitlements is a "system" module, we can do anything from it
142144
Stream.of(PolicyManager.class.getModule()),
143145
// anything in the boot layer is also part of the system
144-
ModuleLayer.boot().modules().stream().filter(m -> systemModulesDescriptors.contains(m.getDescriptor()))
146+
ModuleLayer.boot()
147+
.modules()
148+
.stream()
149+
.filter(
150+
m -> systemModulesDescriptors.contains(m.getDescriptor())
151+
&& MODULES_EXCLUDED_FROM_SYSTEM_MODULES.contains(m.getName()) == false
152+
)
145153
).collect(Collectors.toUnmodifiableSet());
146154
}
147155

0 commit comments

Comments
 (0)