[logback-dev] [JIRA] Commented: (LBCLASSIC-216) java.lang.NullPointerException in ThrowableProxyUtil.java:42

Joern Huxhorn (JIRA) noreply-jira at qos.ch
Wed Jul 28 14:29:16 CEST 2010


    [ http://jira.qos.ch/browse/LBCLASSIC-216?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11805#action_11805 ] 

Joern Huxhorn commented on LBCLASSIC-216:
-----------------------------------------

I agree that this issue should be fixed in ThrowableProxyUtil.

Beside that, I'd like to point out that the documentation of Throwable
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Throwable.html#getStackTrace%28%29
states, that getStackTrace() is required to return an empty array if no stacktrace is available.

If this happens to you then there is a bug somewhere.

> java.lang.NullPointerException in ThrowableProxyUtil.java:42
> ------------------------------------------------------------
>
>                 Key: LBCLASSIC-216
>                 URL: http://jira.qos.ch/browse/LBCLASSIC-216
>             Project: logback-classic
>          Issue Type: Bug
>          Components: Other
>    Affects Versions: 0.9.24
>         Environment: IDE WebSphere 6.1 , IBM JDK 1.5
>            Reporter: Luciano Canè
>            Assignee: Ceki Gulcu
>            Priority: Blocker
>
> {code:title=test example}
> import org.slf4j.LoggerFactory;
> public class TestLogBack {
> 	public TestLogBack() {
> 		super();
> 	}
> 	public static void main(String[] args) {
> 		TestLogBack test = new TestLogBack();
> 		test.execute();
> 	}
> 	private void execute() {
> 		org.slf4j.Logger logger = LoggerFactory.getLogger(TestLogBack.class);
> 		//test
> 		try {
> 			throw new TestLogBackException("Test: getStackTrace() return null"); //$NON-NLS-1$
> 		} catch (Throwable t) {
> 			logger.error("Messaggio di Test di {}", t.getMessage(), t); //$NON-NLS-1$
> 		}
> 	}
> 	class TestLogBackException
> 			extends Exception {
> 		private static final long serialVersionUID = 1L;
> 		public TestLogBackException(String message) {
> 			super(message);
> 		}
> 		@Override
> 		public StackTraceElement[] getStackTrace() {
> 			return null;
> 		}
> 	}
> }
> {code}
> {code:title=exception stack trace}
> Exception in thread "main" java.lang.NullPointerException
> 	at ch.qos.logback.classic.spi.ThrowableProxyUtil.steArrayToStepArray(ThrowableProxyUtil.java:42)
> 	at ch.qos.logback.classic.spi.ThrowableProxy.<init>(ThrowableProxy.java:35)
> 	at ch.qos.logback.classic.spi.LoggingEvent.<init>(LoggingEvent.java:123)
> 	at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:469)
> 	at ch.qos.logback.classic.Logger.filterAndLog_2(Logger.java:462)
> 	at ch.qos.logback.classic.Logger.error(Logger.java:580)
> 	at z_prove.logback.TestLogBack.execute(TestLogBack.java:28)
> 	at z_prove.logback.TestLogBack.main(TestLogBack.java:13)
> {code}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       


More information about the logback-dev mailing list