-----BEGIN PGP SIGNATURE-----
iHEEABECADEWIQTOgHWiUVR77iSbwVGiEVrhX2uLcgUCYO0mxBMcYm9kZXdpZ0Bh
cGFjaGUub3JnAAoJEKIRWuFfa4tyTxYAn3qR7URSEzT4iw30Yb7CWZfWIuLNAJ9D
Rszr6E74icHyCo6xLSrxjykmxQ==
=MKUs
-----END PGP SIGNATURE-----
Merge tag 'rel/1.9.16' and prepare for next iteration
Apache Ant 1.9.16
Starting Java 17, System.setSecurityManager() usage is deprecated (for removal) as noted in https://openjdk.java.net/jeps/411.
The code here was just calling getSecurityManager() and then in a finally block setting it back using setSecurityManager(). However, we aren't setting any other security manager in between these calls.
Looking at the code history, it appears that at one point back in 2001, we were indeed setting a custom security manager (commit 41893fdb30) but that was then reverted in commit ff4e823ee2. So this current piece of code is practically doing nothing.
Related to https://bz.apache.org/bugzilla/show_bug.cgi?id=64733
The main "writer" thread which initiates the writes to the PipedOutputStream (via the switched System.out/System.err) would exit/complete but would leave the SysOutErrStreamReader thread alive thus causing the PipedInputStream.read()s to continue happening in that SysOutErrStreamReader thread. This would cause the following IOException because the writer thread has exited and is no longer alive:
[junitlauncher] Caused by: java.io.IOException: Pipe broken
[junitlauncher] at java.base/java.io.PipedInputStream.read(PipedInputStream.java:321)
[junitlauncher] at java.base/java.io.PipedInputStream.read(PipedInputStream.java:377)
[junitlauncher] at java.base/java.io.InputStream.read(InputStream.java:205)
[junitlauncher] at org.apache.tools.ant.taskdefs.optional.junitlauncher.LauncherSupport$SysOutErrStreamReader.run(LauncherSupport.java:525)
[junitlauncher] ... 1 more