java.lang.NullPointerException

QOS.ch JIRA | Albert Louis Rossi | 3 years ago
  1. 0

    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)

    QOS.ch JIRA | 3 years ago | Albert Louis Rossi
    java.lang.NullPointerException
  2. 0

    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)

    QOS.ch JIRA | 3 years ago | Albert Louis Rossi
    java.lang.NullPointerException
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

    1 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at ch.qos.logback.core.subst.Parser.T()
    2. Logback Core Module
      GenericConfigurator.doConfigure
      1. ch.qos.logback.core.subst.Parser.T(Parser.java:75)
      2. ch.qos.logback.core.subst.Parser.E(Parser.java:50)
      3. ch.qos.logback.core.subst.Parser.parse(Parser.java:46)
      4. ch.qos.logback.core.subst.NodeToStringTransformer.tokenizeAndParseString(NodeToStringTransformer.java:55)
      5. ch.qos.logback.core.subst.NodeToStringTransformer.handleVariable(NodeToStringTransformer.java:96)
      6. ch.qos.logback.core.subst.NodeToStringTransformer.compileNode(NodeToStringTransformer.java:72)
      7. ch.qos.logback.core.subst.NodeToStringTransformer.transform(NodeToStringTransformer.java:60)
      8. ch.qos.logback.core.subst.NodeToStringTransformer.substituteVariable(NodeToStringTransformer.java:48)
      9. ch.qos.logback.core.util.OptionHelper.substVars(OptionHelper.java:117)
      10. ch.qos.logback.core.joran.spi.InterpretationContext.subst(InterpretationContext.java:159)
      11. ch.qos.logback.core.joran.action.NestedBasicPropertyIA.body(NestedBasicPropertyIA.java:87)
      12. ch.qos.logback.core.joran.spi.Interpreter.callBodyAction(Interpreter.java:295)
      13. ch.qos.logback.core.joran.spi.Interpreter.characters(Interpreter.java:175)
      14. ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:57)
      15. ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:149)
      16. ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:135)
      17. ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:99)
      18. ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:76)
      19. ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:68)
      19 frames
    3. Unknown
      LogbackTokenizerTest.main
      1. LogbackTokenizerTest.main(LogbackTokenizerTest.java:17)
      1 frame