logging-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sde...@apache.org
Subject svn commit: r954327 - /logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/TableColorizingRenderer.java
Date Sun, 13 Jun 2010 22:42:50 GMT
Author: sdeboy
Date: Sun Jun 13 22:42:50 2010
New Revision: 954327

URL: http://svn.apache.org/viewvc?rev=954327&view=rev
Log:
Weird Swing HTML/table cell renderer issue - if first character is a forward slash, the text
isn't displayed at all.  

Workaround is to render the leading slash character using the ASCII html code for forward
slash (/)

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

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/TableColorizingRenderer.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/TableColorizingRenderer.java?rev=954327&r1=954326&r2=954327&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/TableColorizingRenderer.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/TableColorizingRenderer.java
Sun Jun 13 22:42:50 2010
@@ -470,7 +470,7 @@ public class TableColorizingRenderer ext
 
     private String buildHighlightString(Object matchSet, String input) {
         if (!highlightSearchMatchText) {
-            return Transform.escapeTags(input);
+            return fixLeadingSlash(Transform.escapeTags(input));
         }
         if (matchSet instanceof Set) {
             Set thisSet = (Set)matchSet;
@@ -480,9 +480,21 @@ public class TableColorizingRenderer ext
                 String thisEntry = iter.next().toString();
                 result = bold(result, thisEntry);
             }
-            return "<html>" + escapeAllButBoldTags(result) + "</html>";
+            return "<html>" + fixLeadingSlash(escapeAllButBoldTags(result)) + "</html>";
+        }
+        return fixLeadingSlash(Transform.escapeTags(input));
+    }
+
+    /*
+        Weird Swing HTML/table cell renderer issue - if first character is a forward slash,
+        the text isn't displayed at all.  
+        Workaround is to render the leading slash character using the ASCII html code for
forward slash (&#47;)
+    */
+    private String fixLeadingSlash(String input) {
+        if (input.length() > 0 && input.charAt(0) == '/') {
+            return "&#47;" + input.substring(1);
         }
-        return Transform.escapeTags(input);
+        return input;
     }
 
     private String escapeAllButBoldTags(String input) {



Mime
View raw message