From 31b16c02575914c5b0dfd3cb2d3a8f94f4525741 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Wed, 16 Mar 2022 14:17:44 +1000 Subject: [PATCH] ignore any possible bug from jdk when trying to get compilation error diagnostic message Signed-off-by: Olivier Lamy --- .../org/codehaus/plexus/compiler/javac/JavaxToolsCompiler.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavaxToolsCompiler.java b/plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavaxToolsCompiler.java index b12a3244..e4d62a08 100644 --- a/plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavaxToolsCompiler.java +++ b/plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavaxToolsCompiler.java @@ -145,9 +145,10 @@ public CompilerResult compileInProcess( String[] args, final CompilerConfigurati { baseMessage = diagnostic.getMessage( Locale.getDefault() ); } - catch ( AssertionError e ) + catch ( Throwable e ) //ignore any possible error from jdk { // workaround for https://bugs.openjdk.java.net/browse/JDK-8210649 + // workaround for https://bugs.openjdk.java.net/browse/JDK-8216202 getLogger().debug( "Ignore Issue get JavaCompiler Diagnostic message (see https://bugs.openjdk.java.net/browse/JDK-8210649):" + e.getMessage(), e ); // in this case we try to replace the baseMessage with toString (hoping this does not throw a new exception.. baseMessage = diagnostic.toString();