From 231e9bdcb3bf9e79fd028a4ca89fa8616d9d7551 Mon Sep 17 00:00:00 2001 From: Ceki Gulcu Date: Wed, 28 Feb 2024 14:30:12 +0100 Subject: [PATCH] more internal changes and refactorings Signed-off-by: Ceki Gulcu --- .../java/ch/qos/logback/core/model/ModelConstants.java | 3 ++- .../core/model/processor/ImplicitModelHandler.java | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/logback-core/src/main/java/ch/qos/logback/core/model/ModelConstants.java b/logback-core/src/main/java/ch/qos/logback/core/model/ModelConstants.java index dba881e15f..b55e06c2ca 100644 --- a/logback-core/src/main/java/ch/qos/logback/core/model/ModelConstants.java +++ b/logback-core/src/main/java/ch/qos/logback/core/model/ModelConstants.java @@ -24,4 +24,5 @@ public class ModelConstants { public static final String INVALID_ATTRIBUTES = "In element, either the \"file\" attribute alone, or " + "the \"resource\" element alone, or both the \"name\" and \"value\" attributes must be set."; -} + public static final String PARENT_PROPPERTY_KEY = "parent"; +} diff --git a/logback-core/src/main/java/ch/qos/logback/core/model/processor/ImplicitModelHandler.java b/logback-core/src/main/java/ch/qos/logback/core/model/processor/ImplicitModelHandler.java index ae77a4e1c7..a3202d0bef 100755 --- a/logback-core/src/main/java/ch/qos/logback/core/model/processor/ImplicitModelHandler.java +++ b/logback-core/src/main/java/ch/qos/logback/core/model/processor/ImplicitModelHandler.java @@ -23,6 +23,7 @@ import ch.qos.logback.core.model.ComponentModel; import ch.qos.logback.core.model.ImplicitModel; import ch.qos.logback.core.model.Model; +import ch.qos.logback.core.model.ModelConstants; import ch.qos.logback.core.spi.ContextAware; import ch.qos.logback.core.spi.LifeCycle; import ch.qos.logback.core.util.AggregationType; @@ -33,8 +34,7 @@ public class ImplicitModelHandler extends ModelHandlerBase { private final BeanDescriptionCache beanDescriptionCache; private ImplicitModelData implicitModelData; - - static final String PARENT_PROPPERTY_KEY = "parent"; + static public final String IGNORING_UNKNOWN_PROP = "Ignoring unknown property"; boolean inError = false; @@ -196,8 +196,8 @@ private void postHandleComplex(ModelInterpretationContext mic, Model model, nestedBean.setContext(context); // have the nested element point to its parent if possible - if (nestedBean.computeAggregationType(PARENT_PROPPERTY_KEY) == AggregationType.AS_COMPLEX_PROPERTY) { - nestedBean.setComplexProperty(PARENT_PROPPERTY_KEY, imdComplex.parentBean.getObj()); + if (nestedBean.computeAggregationType(ModelConstants.PARENT_PROPPERTY_KEY) == AggregationType.AS_COMPLEX_PROPERTY) { + nestedBean.setComplexProperty(ModelConstants.PARENT_PROPPERTY_KEY, imdComplex.parentBean.getObj()); } // start the nested complex property if it implements LifeCycle and is not