You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Evans Mark-PT1167 <Ma...@motorola.com> on 2005/02/17 01:33:16 UTC

Log4j 1.3 XMLDecoder.java bug

Background:  I was losing spaces in messages when using the XMLSocketReceiver.  I tracked it down to the XMLDecoder.

The decodeEvents(String document) method of XMLDecoder.java in Log4j 1.3 has a bug.  The first thing this method does is to trim() the given decode buffer.  However, that buffer can be a partial XML string, and if the XML string is broken in the middle of a field that contains a space, that space will be lost.  (Believe me, I'm losing spaces.)

The bug is in log4j 1.3 alpha 6, org.apache.log4j.xml.XMLDecoder.java, line 184.  The fix is to remove the statement "document = document.trim();".  (I'm curious if the trim() was added to solve some other problem.)

--Mark



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org