From fc78b867aa25efe324cb3e185f171c8bd029d8ce Mon Sep 17 00:00:00 2001 From: Ceki Gulcu Date: Sun, 2 Oct 2022 21:00:47 +0200 Subject: [PATCH] fix LOGBACK-1689 Signed-off-by: Ceki Gulcu --- logback-core/pom.xml | 23 +++---------------- .../processor/conditional/IfModelHandler.java | 7 +++--- logback-core/src/main/java/module-info.java | 8 ++----- 3 files changed, 9 insertions(+), 29 deletions(-) diff --git a/logback-core/pom.xml b/logback-core/pom.xml index f51423a0d7..c2dc47f5d5 100755 --- a/logback-core/pom.xml +++ b/logback-core/pom.xml @@ -19,7 +19,7 @@ ch.qos.logback.core - + @@ -72,20 +72,6 @@ - - - org.apache.maven.plugins maven-surefire-plugin @@ -113,9 +99,6 @@ **/ConsoleAppenderTest.java - - **/IfThenElseTest.java - **/PropertyEvalScriptBuilderTest.java @@ -123,7 +106,7 @@ org.apache.maven.plugins maven-jar-plugin - + ${project.build.outputDirectory}/META-INF/MANIFEST.MF @@ -145,7 +128,7 @@ org.apache.felix maven-bundle-plugin true - + bundle-manifest diff --git a/logback-core/src/main/java/ch/qos/logback/core/model/processor/conditional/IfModelHandler.java b/logback-core/src/main/java/ch/qos/logback/core/model/processor/conditional/IfModelHandler.java index f5d2ccf678..967179cc5c 100644 --- a/logback-core/src/main/java/ch/qos/logback/core/model/processor/conditional/IfModelHandler.java +++ b/logback-core/src/main/java/ch/qos/logback/core/model/processor/conditional/IfModelHandler.java @@ -74,11 +74,12 @@ public void handle(ModelInterpretationContext mic, Model model) throws ModelHand ifModel.setBranchState(BranchState.IN_ERROR); return; } - PropertyEvalScriptBuilder pesb = new PropertyEvalScriptBuilder(mic); - pesb.setContext(context); + try { + PropertyEvalScriptBuilder pesb = new PropertyEvalScriptBuilder(mic); + pesb.setContext(context); condition = pesb.build(conditionStr); - } catch (Exception e) { + } catch (Exception|NoClassDefFoundError e) { ifModel.setBranchState(BranchState.IN_ERROR); addError("Failed to parse condition [" + conditionStr + "] on line "+lineNum, e); return; diff --git a/logback-core/src/main/java/module-info.java b/logback-core/src/main/java/module-info.java index 00ae1aa4a0..912b9bfee4 100644 --- a/logback-core/src/main/java/module-info.java +++ b/logback-core/src/main/java/module-info.java @@ -3,17 +3,13 @@ requires static transitive java.naming; requires static transitive java.xml; requires static transitive jakarta.mail; - //requires static jakarta.activation; - // jakarta.servlet 5.0 is not modular + // jakarta.servlet 5.0 is not modular so it cannot be declared 'transitive' requires static jakarta.servlet; + requires static janino; requires static commons.compiler; - //requires static org.codehaus.janino.janino; - //requires static org.codehaus.janino.commons.compiler; - - exports ch.qos.logback.core; exports ch.qos.logback.core.boolex;