logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sde...@apache.org
Subject cvs commit: logging-log4j/src/java/org/apache/log4j/xml Log4jEntityResolver.java XMLDecoder.java
Date Fri, 21 May 2004 05:38:28 GMT
sdeboy      2004/05/20 22:38:28

  Modified:    src/java/org/apache/log4j/xml Log4jEntityResolver.java
                        XMLDecoder.java
  Log:
  Added support in XMLDecoder for xml documents conforming to log4j.dtd which include the
XML declaration and doctype declaration
  Assigning exception to an empty string array if no exception provided in the decoded event
(prevents NPEs when the exception is accessed)
  Removed system.err msgs in log4jentityresolver
  
  Revision  Changes    Path
  1.4       +0 -2      logging-log4j/src/java/org/apache/log4j/xml/Log4jEntityResolver.java
  
  Index: Log4jEntityResolver.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/xml/Log4jEntityResolver.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Log4jEntityResolver.java	5 May 2003 20:42:58 -0000	1.3
  +++ Log4jEntityResolver.java	21 May 2004 05:38:28 -0000	1.4
  @@ -23,8 +23,6 @@
   public class Log4jEntityResolver implements EntityResolver {
   
     public InputSource resolveEntity (String publicId, String systemId) {
  -    System.err.println("piblicID: ["+publicId+"]");
  -    System.err.println("systemId: ["+systemId+"]");
       if (systemId.endsWith("log4j.dtd")) {
         Class clazz = getClass();
         InputStream in = clazz.getResourceAsStream("/org/apache/log4j/xml/log4j.dtd");
  
  
  
  1.13      +13 -2     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.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- XMLDecoder.java	12 May 2004 06:37:31 -0000	1.12
  +++ XMLDecoder.java	21 May 2004 05:38:28 -0000	1.13
  @@ -47,6 +47,10 @@
    * 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)
  + * 
    * NOTE:  Only a single LoggingEvent is returned from the decode method
    * even though the DTD supports multiple events nested in an eventSet.
    *
  @@ -114,9 +118,13 @@
          */
         StringBuffer buf = new StringBuffer(1024);
   
  -      buf.append(BEGINPART);
  +      if (!(data.substring(0, data.indexOf(" ")).toLowerCase().startsWith("<?xml")))
{
  +        buf.append(BEGINPART);
  +      }
         buf.append(data);
  -      buf.append(ENDPART);
  +      if (!(data.endsWith(ENDPART))) {
  +        buf.append(ENDPART);
  +      }
   
         InputSource inputSource =
           new InputSource(new StringReader(buf.toString()));
  @@ -378,6 +386,9 @@
             info = new LocationInfo(fileName, className, methodName, lineNumber);
         } else {
           info = LocationInfo.NA_LOCATION_INFO;
  +      }
  +      if (exception == null) {
  +          exception = new String[]{};
         }
         
         LoggingEvent loggingEvent = new LoggingEvent();
  
  
  

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


Mime
View raw message