Details
-
Bug
-
Resolution: Fixed
-
Major
-
1.1.1
-
Confirmed for 1.1.1 on Linux x86_64, but I doubt it is platform dependent.
Description
An empty string literal passed to property substitution will generate an NPE.
The problem seems to lie in the changes that were made to the ch.qos.logback.core.subst.NodeToStringTransformer class. Tokenize returns a null Token in this case, which then fails at line 75 of the ch.qos.logback.core.subst.Parser class, where the switch tries to access the type filed on Token.
I have attached a small test case which you can unzip and run. The stack trace below should appear on stderr.
Unexpected error, server was not started: this is probably a bug.
java.lang.NullPointerException
at ch.qos.logback.core.subst.Parser.T(Parser.java:75)
at ch.qos.logback.core.subst.Parser.E(Parser.java:50)
at ch.qos.logback.core.subst.Parser.parse(Parser.java:46)
at ch.qos.logback.core.subst.NodeToStringTransformer.tokenizeAndParseString(NodeToStringTransformer.java:55)
at ch.qos.logback.core.subst.NodeToStringTransformer.handleVariable(NodeToStringTransformer.java:96)
at ch.qos.logback.core.subst.NodeToStringTransformer.compileNode(NodeToStringTransformer.java:72)
at ch.qos.logback.core.subst.NodeToStringTransformer.transform(NodeToStringTransformer.java:60)
at ch.qos.logback.core.subst.NodeToStringTransformer.substituteVariable(NodeToStringTransformer.java:48)
at ch.qos.logback.core.util.OptionHelper.substVars(OptionHelper.java:117)
at ch.qos.logback.core.joran.spi.InterpretationContext.subst(InterpretationContext.java:159)
at ch.qos.logback.core.joran.action.NestedBasicPropertyIA.body(NestedBasicPropertyIA.java:87)
at ch.qos.logback.core.joran.spi.Interpreter.callBodyAction(Interpreter.java:295)
at ch.qos.logback.core.joran.spi.Interpreter.characters(Interpreter.java:175)
at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:57)
at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:149)
at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:135)
at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:99)
at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:76)
at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:68)
at LogbackTokenizerTest.main(LogbackTokenizerTest.java:17)