龙将斩千 v5.5.5.39856版本的 MD5 值为:5c05b1d6f8d872ca3fe0343d6ff07caf

以下内容为反编译后的 AppenderRefAction.java 源代码,内容仅作参考


package ch.qos.logback.core.joran.action;

import ch.qos.logback.core.Appender;
import ch.qos.logback.core.joran.spi.InterpretationContext;
import ch.qos.logback.core.spi.AppenderAttachable;
import ch.qos.logback.core.util.OptionHelper;
import java.util.HashMap;
import org.xml.sax.Attributes;

public class AppenderRefAction<E> extends Action {
    boolean inError = false;

    @Override
    public void begin(InterpretationContext interpretationContext, String str, Attributes attributes) {
        this.inError = false;
        Object peekObject = interpretationContext.peekObject();
        if (!(peekObject instanceof AppenderAttachable)) {
            String str2 = "Could not find an AppenderAttachable at the top of execution stack. Near [" + str + "] line " + getLineNumber(interpretationContext);
            this.inError = true;
            addError(str2);
            return;
        }
        AppenderAttachable appenderAttachable = (AppenderAttachable) peekObject;
        String subst = interpretationContext.subst(attributes.getValue(ActionConst.REF_ATTRIBUTE));
        if (OptionHelper.isEmpty(subst)) {
            this.inError = true;
            addError("Missing appender ref attribute in <appender-ref> tag.");
            return;
        }
        Appender<E> appender = (Appender) ((HashMap) interpretationContext.getObjectMap().get(ActionConst.APPENDER_BAG)).get(subst);
        if (appender != null) {
            addInfo("Attaching appender named [" + subst + "] to " + appenderAttachable);
            appenderAttachable.addAppender(appender);
            return;
        }
        this.inError = true;
        addError("Could not find an appender named [" + subst + "]. Did you define it below instead of above in the configuration file?");
        addError("See http://logback.qos.ch/codes.html#appender_order for more details.");
    }

    @Override
    public void end(InterpretationContext interpretationContext, String str) {
    }
}