What should be the expected output? "null" or a no-op?

Gary


On Thu, Jan 10, 2013 at 6:42 AM, Christian Grobmeier <[email protected]>wrote:

> Folks,
>
> i am doing this:
>
> logger.debug(line)
>
> where line is null. Please not, if I do sysout(line) before the error
> does not happen.
>
> The exception is below. I believe it is because:
>
> toAppendTo.append(config != null && result.contains("${") ?
>                 config.getSubst().replace(event, result) : result);
>
>
> toAppendTo is null when I put null into .debug thus it crashes.
> Shouldn't it be nullsafe? I can imagine people are putting null into
> that messages.
>
> Cheers
> Christian
>
>
> ERROR StatusLogger An exception occurred processing Appender STDOUT
> java.lang.NullPointerException
> at
> org.apache.logging.log4j.core.pattern.MessagePatternConverter.format(MessagePatternConverter.java:70)
> at
> org.apache.logging.log4j.core.pattern.PatternFormatter.format(PatternFormatter.java:36)
> at
> org.apache.logging.log4j.core.layout.PatternLayout.toSerializable(PatternLayout.java:141)
> at
> org.apache.logging.log4j.core.layout.PatternLayout.toSerializable(PatternLayout.java:48)
> at
> org.apache.logging.log4j.core.layout.AbstractStringLayout.toByteArray(AbstractStringLayout.java:56)
> at
> org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender.append(AbstractOutputStreamAppender.java:112)
> at
> org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:98)
> at
> org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:335)
> at
> org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:316)
> at
> org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:319)
> at
> org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:281)
> at org.apache.logging.log4j.core.Logger.log(Logger.java:106)
> at
> org.apache.logging.log4j.spi.AbstractLoggerWrapper.log(AbstractLoggerWrapper.java:53)
> at org.slf4j.impl.SLF4JLogger.debug(SLF4JLogger.java:129)
>
> --
> http://www.grobmeier.de
> https://www.timeandbill.de
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>


-- 
E-Mail: [email protected] | [email protected]
JUnit in Action, 2nd Ed: <http://goog_1249600977>http://bit.ly/ECvg0
Spring Batch in Action: <http://s.apache.org/HOq>http://bit.ly/bqpbCK
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Reply via email to