Source: antlr-maven-plugin
X-Debbugs-Cc: [email protected]
Version: 2.2-5
Severity: important
Dear Maintainer,
src/main/java/org/codehaus/mojo/antlr/AbstractAntlrMojo.java sets
SecurityManager in order to catch System.exit() call.
This causes packages using it fail to build with the following message:
----
[ERROR] Failed to execute goal org.codehaus.mojo:antlr-maven-
plugin:2.2:generate (default) on project checkstyle: Execution default of goal
org.codehaus.mojo:antlr-maven-plugin:2.2:generate failed: The Security Manager
is deprecated and will be removed in a future release -> [Help 1]
-----
because setSecurityManager() throws UnsupportedOperationException if
java.security.manager property is not set.
The attached patch adds UnsupportedOperationException to the catch statement
that bypasses the issue as the plugin already allows setSecurityManager() to
fail.
--- a/src/main/java/org/codehaus/mojo/antlr/AbstractAntlrMojo.java
+++ b/src/main/java/org/codehaus/mojo/antlr/AbstractAntlrMojo.java
@@ -337,7 +337,7 @@
oldSm = System.getSecurityManager();
System.setSecurityManager( NoExitSecurityManager.INSTANCE );
}
- catch ( SecurityException ex )
+ catch ( UnsupportedOperationException | SecurityException ex )
{
// ANTLR-12
oldSm = null;