sdeboy 2004/05/20 23:19:32 Modified: src/java/org/apache/log4j/xml UtilLoggingXMLDecoder.java XMLDecoder.java Log: Preventing null exception in utillogging decoder
reverted support for xml files with xml declaration, doctype and eventSet root node requires xml files contain a collection of event nodes in order for processing to succeed Revision Changes Path 1.12 +3 -0 logging-log4j/src/java/org/apache/log4j/xml/UtilLoggingXMLDecoder.java Index: UtilLoggingXMLDecoder.java =================================================================== RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/xml/UtilLoggingXMLDecoder.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- UtilLoggingXMLDecoder.java 12 May 2004 06:37:31 -0000 1.11 +++ UtilLoggingXMLDecoder.java 21 May 2004 06:19:32 -0000 1.12 @@ -368,6 +368,9 @@ } else { info = LocationInfo.NA_LOCATION_INFO; } + if (exception == null) { + exception = new String[]{}; + } LoggingEvent loggingEvent = new LoggingEvent(); loggingEvent.setLogger(logger); 1.14 +4 -9 logging-log4j/src/java/org/apache/log4j/xml/XMLDecoder.java Index: XMLDecoder.java =================================================================== RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/xml/XMLDecoder.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- XMLDecoder.java 21 May 2004 05:38:28 -0000 1.13 +++ XMLDecoder.java 21 May 2004 06:19:32 -0000 1.14 @@ -47,9 +47,8 @@ * Decodes Logging Events in XML formated into elements that are used by * Chainsaw. * - * This decoder can process either: - * - a collection of log4j:event nodes ONLY (no XML declaration nor eventSet node), or - * - the XML declaration, log4j:eventSet root node AND containing log4j:event nodes (all required) + * This decoder can process a collection of log4j:event nodes ONLY + * (no XML declaration nor eventSet node) * * NOTE: Only a single LoggingEvent is returned from the decode method * even though the DTD supports multiple events nested in an eventSet. @@ -118,13 +117,9 @@ */ StringBuffer buf = new StringBuffer(1024); - if (!(data.substring(0, data.indexOf(" ")).toLowerCase().startsWith("<?xml"))) { - buf.append(BEGINPART); - } + buf.append(BEGINPART); buf.append(data); - if (!(data.endsWith(ENDPART))) { - buf.append(ENDPART); - } + buf.append(ENDPART); InputSource inputSource = new InputSource(new StringReader(buf.toString())); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]