-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
21.0.6
-
linux
When using a build of JDK 21.0.6.7.1 or 21.0.7.6.1 on linux and running with param `-Djava.security.manager=allow`, the changes made by JDK-8342905 and JDK-8344993 introduce a regression. This behavior is not present prior to those commits (with JDK 21.0.5.11.1).
To reproduce:
1. Build JDK
2. Create App.java:
```
public class App {
public static void main(String[] args) {
var defaultExecutor = ForkJoinPool.commonPool();
defaultExecutor.execute(() -> {
Thread t = Thread.currentThread();
System.out.println("Running in thread: " + t.getClass().getName());
try {
t.setContextClassLoader(new java.net.URLClassLoader(new java.net.URL[0]));
System.out.println("Set context class loader.");
} catch (SecurityException e) {
System.err.println("SecurityException: " + e.getMessage());
e.printStackTrace();
}
});
try {
Thread.sleep(1_000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
}
```
3. Run `javac App.java`
4. Run `java -Djava.security.manager=allow App`
To reproduce:
1. Build JDK
2. Create App.java:
```
public class App {
public static void main(String[] args) {
var defaultExecutor = ForkJoinPool.commonPool();
defaultExecutor.execute(() -> {
Thread t = Thread.currentThread();
System.out.println("Running in thread: " + t.getClass().getName());
try {
t.setContextClassLoader(new java.net.URLClassLoader(new java.net.URL[0]));
System.out.println("Set context class loader.");
} catch (SecurityException e) {
System.err.println("SecurityException: " + e.getMessage());
e.printStackTrace();
}
});
try {
Thread.sleep(1_000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
}
```
3. Run `javac App.java`
4. Run `java -Djava.security.manager=allow App`
- caused by
-
JDK-8344993 [21u] [REDO] Backport JDK-8327501 and JDK-8328366 to JDK 21
-
- Resolved
-