Bug 35324 - Stacktrace may choke on null fields, as org.apache.log4j.spi.ThrowableInformation.VectorWriter.println(null) will bomb
Summary: Stacktrace may choke on null fields, as org.apache.log4j.spi.ThrowableInforma...
Alias: None
Product: Log4j - Now in Jira
Classification: Unclassified
Component: Appender (show other bugs)
Version: 1.2
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: log4j-dev
: 36587 (view as bug list)
Depends on:
Blocks: 40951
  Show dependency tree
Reported: 2005-06-11 00:11 UTC by Reiner Saddey
Modified: 2007-03-14 21:41 UTC (History)
1 user (show)


Note You need to log in before you can comment on or make changes to this bug.
Description Reiner Saddey 2005-06-11 00:11:05 UTC
VectorWriter extends java.io.PrintWriter but it does not suppply its forgiving 
services when trying to println(null). Each of Sun's implementations of println
(Object) is capable of handling the singular case of Object==null gracefully, 
but ThrowableInformation.VectorWriter does not, which effectively breaks custom 
made printStackTrace methods at the very instant, when the stack trace is to be 
output to a logger.

In detail, org.apache.log4j.spi.ThrowableInformation.VectorWriter.println
(Object) looks as follows:

  public void println(Object o) {      

whilst it might preferrably be:

  public void println(Object o) {      
Comment 1 Yoav Shapira 2005-07-30 22:51:31 UTC
Good catch and good suggestion: I've applied it to CVS HEAD in time for log4j
Comment 2 Curt Arnold 2007-02-20 23:24:24 UTC
Reopening for log4j 1.2 branch
Comment 3 Curt Arnold 2007-02-21 08:52:30 UTC
Committed interim fix in rev 510097.  Expect to gut existing implementation in just a few moments.
Comment 4 Curt Arnold 2007-02-21 13:44:17 UTC
Issue mooted by fix for bug 41219.
Comment 5 Jacob Kjome 2007-03-14 21:41:48 UTC
*** Bug 36587 has been marked as a duplicate of this bug. ***