Bug 45825 - lack of synchronization in ThrowableInformation
Summary: lack of synchronization in ThrowableInformation
Status: RESOLVED DUPLICATE of bug 44032
Alias: None
Product: Log4j - Now in Jira
Classification: Unclassified
Component: Other (show other bugs)
Version: 1.2
Hardware: PC Windows XP
: P2 major
Target Milestone: ---
Assignee: log4j-dev
Depends on:
Reported: 2008-09-17 07:54 UTC by Tomasz Sadura
Modified: 2008-09-17 09:12 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Tomasz Sadura 2008-09-17 07:54:10 UTC
Log4j version 1.2.15.
Method getThrowableStrRep in org.apache.log4j.spi.ThrowableInformation should be synchronized in some way. The variable rep can be read by one thread (for example AsynsAppender) in line 72, while another is in line 91 (lines.toArray(rep)). This may cause rep to contain some nulls. It leads to NullPointerException at java.io.Writer.write(Writer.java:140). Stacktrace:

 at java.io.Writer.write(Writer.java:140)   
 at org.apache.log4j.helpers.QuietWriter.write(QuietWriter.java:48)   
 at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:309)   
 at org.apache.log4j.WriterAppender.append(WriterAppender.java:160)   
 at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)   
 at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:66)   
 at org.apache.log4j.Category.callAppenders(Category.java:206)   
 at org.apache.log4j.Category.forcedLog(Category.java:391)   
 at org.apache.log4j.Category.info(Category.java:683)
Comment 1 Curt Arnold 2008-09-17 09:12:17 UTC

*** This bug has been marked as a duplicate of bug 44032 ***