sdeboy 2003/07/10 21:52:52 Modified: src/java/org/apache/log4j/xml XMLDecoder.java UtilLoggingXMLDecoder.java Log: Corrected the event parsing in xml decoders where the received fragment was a large single event (the received fragment didn't include the event end tag). PR: Obtained from: Submitted by: Reviewed by: CVS: ---------------------------------------------------------------------- CVS: PR: CVS: If this change addresses a PR in the problem report tracking CVS: database, then enter the PR number(s) here. CVS: Obtained from: CVS: If this change has been taken from another system, such as NCSA, CVS: then name the system in this line, otherwise delete it. CVS: Submitted by: CVS: If this code has been contributed to Apache by someone else; i.e., CVS: they sent us a patch or a new module, then include their name/email CVS: address here. If this is your work then delete this line. CVS: Reviewed by: CVS: If we are doing pre-commit code reviews and someone else has CVS: reviewed your changes, include their name(s) here. CVS: If you have not had it reviewed then delete this line. Revision Changes Path 1.2 +7 -1 jakarta-log4j/src/java/org/apache/log4j/xml/XMLDecoder.java Index: XMLDecoder.java =================================================================== RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/xml/XMLDecoder.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- XMLDecoder.java 24 Jun 2003 08:08:43 -0000 1.1 +++ XMLDecoder.java 11 Jul 2003 04:52:52 -0000 1.2 @@ -213,7 +213,6 @@ public Vector decodeEvents(String document) { if (document != null) { document = document.trim(); - if (document.equals("")) { return null; } else { @@ -221,6 +220,13 @@ String newPartialEvent=null; //separate the string into the last portion ending with </log4j:event> (which will //be processed) and the partial event which will be combined and processed in the next section + + //if the document does not contain a record end, append it to the partial event string + if (document.lastIndexOf(RECORD_END) == -1) { + partialEvent = partialEvent + document; + return null; + } + if (document.lastIndexOf(RECORD_END) + RECORD_END.length() < document.length()) { newDoc = document.substring(0, document.lastIndexOf(RECORD_END) + RECORD_END.length()); newPartialEvent = document.substring(document.lastIndexOf(RECORD_END) + RECORD_END.length()); 1.2 +6 -0 jakarta-log4j/src/java/org/apache/log4j/xml/UtilLoggingXMLDecoder.java Index: UtilLoggingXMLDecoder.java =================================================================== RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/xml/UtilLoggingXMLDecoder.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- UtilLoggingXMLDecoder.java 24 Jun 2003 08:08:43 -0000 1.1 +++ UtilLoggingXMLDecoder.java 11 Jul 2003 04:52:52 -0000 1.2 @@ -241,6 +241,12 @@ //separate the string into the last portion ending with </record> (which will //be processed) and the partial event which will be combined and processed in the next section + //if the document does not contain a record end, append it to the partial event string + if (document.lastIndexOf(RECORD_END) == -1) { + partialEvent = partialEvent + document; + return null; + } + if (document.lastIndexOf(RECORD_END) + RECORD_END.length() < document.length()) { newDoc = document.substring(0, document.lastIndexOf(RECORD_END) + RECORD_END.length()); newPartialEvent = document.substring(document.lastIndexOf(RECORD_END) + RECORD_END.length());
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]