logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sde...@apache.org
Subject svn commit: r1158566 - in /logging/log4j/companions/extras/trunk/src/main/java/org/apache/log4j: rule/InFixToPostFix.java rule/RuleFactory.java spi/LoggingEventFieldResolver.java
Date Wed, 17 Aug 2011 08:18:25 GMT
Author: sdeboy
Date: Wed Aug 17 08:18:24 2011
New Revision: 1158566

URL: http://svn.apache.org/viewvc?rev=1158566&view=rev
Log:
Update string comparisons to be case insensitive or explicitly use the English locale where
needed in Chainsaw and extras companion

Modified:
    logging/log4j/companions/extras/trunk/src/main/java/org/apache/log4j/rule/InFixToPostFix.java
    logging/log4j/companions/extras/trunk/src/main/java/org/apache/log4j/rule/RuleFactory.java
    logging/log4j/companions/extras/trunk/src/main/java/org/apache/log4j/spi/LoggingEventFieldResolver.java

Modified: logging/log4j/companions/extras/trunk/src/main/java/org/apache/log4j/rule/InFixToPostFix.java
URL: http://svn.apache.org/viewvc/logging/log4j/companions/extras/trunk/src/main/java/org/apache/log4j/rule/InFixToPostFix.java?rev=1158566&r1=1158565&r2=1158566&view=diff
==============================================================================
--- logging/log4j/companions/extras/trunk/src/main/java/org/apache/log4j/rule/InFixToPostFix.java
(original)
+++ logging/log4j/companions/extras/trunk/src/main/java/org/apache/log4j/rule/InFixToPostFix.java
Wed Aug 17 08:18:24 2011
@@ -21,6 +21,7 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Stack;
 import java.util.Vector;
@@ -108,7 +109,7 @@ public class InFixToPostFix {
      * @return true if operand.
      */
   public static boolean isOperand(final String s) {
-    String symbol = s.toLowerCase();
+    String symbol = s.toLowerCase(Locale.ENGLISH);
     return (!operators.contains(symbol));
   }
 
@@ -119,8 +120,8 @@ public class InFixToPostFix {
      * @return true if symbol 1 precedes symbol 2
      */
   boolean precedes(final String s1, final String s2) {
-    String symbol1 = s1.toLowerCase();
-    String symbol2 = s2.toLowerCase();
+    String symbol1 = s1.toLowerCase(Locale.ENGLISH);
+    String symbol2 = s2.toLowerCase(Locale.ENGLISH);
 
     if (!precedenceMap.keySet().contains(symbol1)) {
       return false;

Modified: logging/log4j/companions/extras/trunk/src/main/java/org/apache/log4j/rule/RuleFactory.java
URL: http://svn.apache.org/viewvc/logging/log4j/companions/extras/trunk/src/main/java/org/apache/log4j/rule/RuleFactory.java?rev=1158566&r1=1158565&r2=1158566&view=diff
==============================================================================
--- logging/log4j/companions/extras/trunk/src/main/java/org/apache/log4j/rule/RuleFactory.java
(original)
+++ logging/log4j/companions/extras/trunk/src/main/java/org/apache/log4j/rule/RuleFactory.java
Wed Aug 17 08:18:24 2011
@@ -19,6 +19,7 @@ package org.apache.log4j.rule;
 
 import java.util.Collection;
 import java.util.LinkedList;
+import java.util.Locale;
 import java.util.Stack;
 
 /**
@@ -124,7 +125,7 @@ public final class RuleFactory {
      * @return true if string is a known operator
      */
   public boolean isRule(final String symbol) {
-    return ((symbol != null) && (RULES.contains(symbol.toLowerCase())));
+    return ((symbol != null) && (RULES.contains(symbol.toLowerCase(Locale.ENGLISH))));
   }
 
     /**

Modified: logging/log4j/companions/extras/trunk/src/main/java/org/apache/log4j/spi/LoggingEventFieldResolver.java
URL: http://svn.apache.org/viewvc/logging/log4j/companions/extras/trunk/src/main/java/org/apache/log4j/spi/LoggingEventFieldResolver.java?rev=1158566&r1=1158565&r2=1158566&view=diff
==============================================================================
--- logging/log4j/companions/extras/trunk/src/main/java/org/apache/log4j/spi/LoggingEventFieldResolver.java
(original)
+++ logging/log4j/companions/extras/trunk/src/main/java/org/apache/log4j/spi/LoggingEventFieldResolver.java
Wed Aug 17 08:18:24 2011
@@ -237,7 +237,7 @@ public final class LoggingEventFieldReso
           Set entrySet = event.getProperties().entrySet();
           for (Iterator iter = entrySet.iterator();iter.hasNext();) {
               Map.Entry thisEntry = (Map.Entry) iter.next();
-              if (thisEntry.getKey().toString().toLowerCase().equals(lowerPropKey)) {
+              if (thisEntry.getKey().toString().equalsIgnoreCase(lowerPropKey)) {
                   propValue = thisEntry.getValue();
               }
           }



---------------------------------------------------------------------
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