svn commit: r956461 - /logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/layout/DefaultLayoutFactory.java

[email protected]
Newsgroups gmane.comp.apache.logging
Message-ID <[email protected]>
Author: sdeboy
Date: Mon Jun 21 05:40:14 2010
New Revision: 956461

URL: http://svn.apache.org/viewvc?rev=956461&view=rev
Log:
When an html file containing a default layout (included in the distribution) is displayed in the detail layout editor, pull the Apache header off of the layout in the editor pane.

Modified:
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/layout/DefaultLayoutFactory.java

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/layout/DefaultLayoutFactory.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/layout/DefaultLayoutFactory.java?rev=956461&r1=956460&r2=956461&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/layout/DefaultLayoutFactory.java (original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/layout/DefaultLayoutFactory.java Mon Jun 21 05:40:14 2010
@@ -73,8 +73,17 @@ public class DefaultLayoutFactory {
         } catch (Exception e) {
           content = new StringBuffer(PatternLayout.TTCC_CONVERSION_PATTERN);
         }
-
-        defaultPatternLayout = content.toString();
+        String trimmedContent = content.toString().trim();
+        //the default docs contain the apache license header, strip that out before displaying
+        String startComment = "<!--";
+        String endComment = "-->";
+        if (trimmedContent.startsWith(startComment)) {
+            int endIndex = trimmedContent.indexOf(endComment);
+            if (endIndex > -1) {
+                trimmedContent = trimmedContent.substring(endIndex + endComment.length()).trim();
+            }
+        }
+        defaultPatternLayout = trimmedContent;
       }
 
     return defaultPatternLayout;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.