logging-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sde...@apache.org
Subject svn commit: r1158566 - in /logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw: ./ helper/ receivers/
Date Wed, 17 Aug 2011 08:18:24 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/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ApplicationPreferenceModelPanel.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/FileSaveAction.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogFilePatternLayoutBuilder.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ReceiverConfigurationPanel.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/TableColorizingRenderer.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/helper/SwingHelper.java
    logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/receivers/PluginPropertyEditorPanel.java

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ApplicationPreferenceModelPanel.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ApplicationPreferenceModelPanel.java?rev=1158566&r1=1158565&r2=1158566&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ApplicationPreferenceModelPanel.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ApplicationPreferenceModelPanel.java
Wed Aug 17 08:18:24 2011
@@ -30,6 +30,7 @@ import java.util.Dictionary;
 import java.util.Enumeration;
 import java.util.Hashtable;
 
+import java.util.Locale;
 import javax.swing.BorderFactory;
 import javax.swing.Box;
 import javax.swing.BoxLayout;
@@ -187,7 +188,7 @@ public static void main(String[] args) {
       boolean useNewLookAndFeels = false;
       int j = 0;
       for (int i=0;i<lookAndFeels.length;i++) {
-        if (lookAndFeels[i].getClassName().toLowerCase().contains("nimbus")) {
+        if (lookAndFeels[i].getClassName().toLowerCase(Locale.ENGLISH).contains("nimbus"))
{
             useNewLookAndFeels = true;
         } else {
             newLookAndFeels[j++] = lookAndFeels[i];
@@ -549,7 +550,7 @@ public static void main(String[] args) {
                       defaultPath = currentConfigurationPath.getPath();
                       //FileDialog will not navigate to this location unless we remove the
prefixing protocol and slash
                       //at least on winxp
-                      if (defaultPath.toLowerCase().startsWith("file:\\")) {
+                      if (defaultPath.toLowerCase(Locale.ENGLISH).startsWith("file:\\"))
{
                           defaultPath = defaultPath.substring("file:\\".length());
                       }
                   }

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java?rev=1158566&r1=1158565&r2=1158566&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java
Wed Aug 17 08:18:24 2011
@@ -27,6 +27,7 @@ import java.util.Date;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 
@@ -601,11 +602,11 @@ class ChainsawCyclicBufferTableModel ext
         //case may not match..try case sensitive and fall back to case-insensitive
         String result = event.getProperty(columnNames.get(columnIndex).toString());
         if (result == null) {
-            String lowerColName = columnNames.get(columnIndex).toString().toLowerCase();
+            String lowerColName = columnNames.get(columnIndex).toString().toLowerCase(Locale.ENGLISH);
             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(lowerColName)) {
+                if (thisEntry.getKey().toString().equalsIgnoreCase(lowerColName)) {
                     result = thisEntry.getValue().toString();
                 }
             }
@@ -785,7 +786,7 @@ class ChainsawCyclicBufferTableModel ext
    * @see javax.swing.table.TableModel#isCellEditable(int, int)
    */
   public boolean isCellEditable(int rowIndex, int columnIndex) {
-    if (getColumnName(columnIndex).toLowerCase().equals(ChainsawConstants.LOG4J_MARKER_COL_NAME_LOWERCASE))
{
+    if (getColumnName(columnIndex).equalsIgnoreCase(ChainsawConstants.LOG4J_MARKER_COL_NAME_LOWERCASE))
{
       return true;
     }
 

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/FileSaveAction.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/FileSaveAction.java?rev=1158566&r1=1158565&r2=1158566&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/FileSaveAction.java (original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/FileSaveAction.java Wed
Aug 17 08:18:24 2011
@@ -30,6 +30,7 @@ import java.io.OutputStreamWriter;
 import java.io.Writer;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Locale;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipOutputStream;
 
@@ -103,7 +104,7 @@ class FileSaveAction extends AbstractAct
 
     XMLLayout layout = new XMLLayout();
     layout.setProperties(true);
-    boolean saveAsZip = selectedFile.getName().toLowerCase().endsWith(".zip");
+    boolean saveAsZip = selectedFile.getName().toLowerCase(Locale.ENGLISH).endsWith(".zip");
     Writer writer = null;
     try {
       if (saveAsZip) {

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogFilePatternLayoutBuilder.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogFilePatternLayoutBuilder.java?rev=1158566&r1=1158565&r2=1158566&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogFilePatternLayoutBuilder.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogFilePatternLayoutBuilder.java
Wed Aug 17 08:18:24 2011
@@ -25,6 +25,7 @@ import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Properties;
 
@@ -191,7 +192,7 @@ public class LogFilePatternLayoutBuilder
         Map.Entry appenderEntry = (Map.Entry)iter.next();
         String appenderName = appenderEntry.getKey().toString();
         String appenderClassName = appenderEntry.getValue().toString();
-        if (appenderClassName.toLowerCase().endsWith("fileappender")) {
+        if (appenderClassName.toLowerCase(Locale.ENGLISH).endsWith("fileappender")) {
           String layout = props.getProperty(appenderPrefix + "." + appenderName + ".layout");
           if (layout != null && layout.trim().equals("org.apache.log4j.PatternLayout"))
{
             String conversion = props.getProperty(appenderPrefix + "." + appenderName + ".layout.ConversionPattern");
@@ -247,7 +248,7 @@ public class LogFilePatternLayoutBuilder
         if (appenderAttributes.getNamedItem("name") != null && appenderClass != null
&& appenderClass.getNodeValue() != null) {
           //all log4j fileappenders end in fileappender..if a custom fileappender also ends
in fileappender and uses the same dom nodes to be loaded,
           //try to parse the nodes as well
-          if (appenderClass.getNodeValue().toLowerCase().endsWith("fileappender")) {
+          if (appenderClass.getNodeValue().toLowerCase(Locale.ENGLISH).endsWith("fileappender"))
{
             String appenderName = appenderAttributes.getNamedItem("name").getNodeValue();
             //subclass of FileAppender - add it
             Map entry = new HashMap();
@@ -256,23 +257,23 @@ public class LogFilePatternLayoutBuilder
               Node appenderChild = appenderChildren.item(j);
               if (appenderChild.getNodeName().equals("param") && appenderChild.hasAttributes())
{
                 Node fileNameNode = appenderChild.getAttributes().getNamedItem("name");
-                if (fileNameNode != null && fileNameNode.getNodeValue().toLowerCase().equals("file"))
{
+                if (fileNameNode != null && fileNameNode.getNodeValue().equalsIgnoreCase("file"))
{
                   Node fileValueNode = appenderChild.getAttributes().getNamedItem("value");
                   if (fileValueNode != null) {
                     entry.put("file", fileValueNode.getNodeValue());
                   }
                 }
               }
-              if (appenderChild.getNodeName().toLowerCase().equals("layout") && appenderChild.hasAttributes())
{
+              if (appenderChild.getNodeName().equalsIgnoreCase("layout") && appenderChild.hasAttributes())
{
                 NamedNodeMap layoutAttributes = appenderChild.getAttributes();
                 Node layoutNode = layoutAttributes.getNamedItem("class");
-                if (layoutNode != null && layoutNode.getNodeValue() != null &&
layoutNode.getNodeValue().equals("org.apache.log4j.PatternLayout")) {
+                if (layoutNode != null && layoutNode.getNodeValue() != null &&
layoutNode.getNodeValue().equalsIgnoreCase("org.apache.log4j.PatternLayout")) {
                   NodeList layoutChildren = appenderChild.getChildNodes();
                   for (int k = 0; k < layoutChildren.getLength(); k++) {
                     Node layoutChild = layoutChildren.item(k);
                     if (layoutChild.getNodeName().equals("param") && layoutChild.hasAttributes())
{
                       Node layoutName = layoutChild.getAttributes().getNamedItem("name");
-                      if (layoutName != null && layoutName.getNodeValue() != null
&& layoutName.getNodeValue().toLowerCase().equals("conversionpattern")) {
+                      if (layoutName != null && layoutName.getNodeValue() != null
&& layoutName.getNodeValue().equalsIgnoreCase("conversionpattern")) {
                         Node conversionValue = layoutChild.getAttributes().getNamedItem("value");
                         if (conversionValue != null) {
                           entry.put("conversion", conversionValue.getNodeValue());

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java?rev=1158566&r1=1158565&r2=1158566&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java (original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogPanel.java Wed Aug 17
08:18:24 2011
@@ -67,6 +67,7 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 import java.util.StringTokenizer;
@@ -532,7 +533,7 @@ public class LogPanel extends DockablePa
         		}
             for (Iterator iter = preferenceModel.getVisibleColumnOrder().iterator();iter.hasNext();)
{
               TableColumn c = (TableColumn)iter.next();
-              if (c.getHeaderValue().toString().toLowerCase().equals(ChainsawConstants.LOG4J_MARKER_COL_NAME_LOWERCASE))
+              if (c.getHeaderValue().toString().equalsIgnoreCase(ChainsawConstants.LOG4J_MARKER_COL_NAME_LOWERCASE))
               {
                 c.setCellEditor(markerCellEditor);
               }
@@ -4321,7 +4322,7 @@ public class LogPanel extends DockablePa
                 List entriesCopy = new ArrayList(allEntries);
                 for (Iterator iter = entriesCopy.iterator();iter.hasNext();) {
                     String thisEntry = iter.next().toString();
-                    if (thisEntry.toLowerCase().contains(textToMatch.toLowerCase())) {
+                    if (thisEntry.toLowerCase(Locale.ENGLISH).contains(textToMatch.toLowerCase()))
{
                         model.addElement(thisEntry);
                     }
                 }

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java?rev=1158566&r1=1158565&r2=1158566&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java (original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/LogUI.java Wed Aug 17 08:18:24
2011
@@ -52,6 +52,7 @@ import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 
@@ -290,12 +291,12 @@ public class LogUI extends JFrame implem
           String lookAndFeelClassName = model.getLookAndFeelClassName();
           if (lookAndFeelClassName == null || lookAndFeelClassName.trim().equals("")) {
               String osName = System.getProperty("os.name");
-              if (osName.toLowerCase().startsWith("mac")) {
+              if (osName.toLowerCase(Locale.ENGLISH).startsWith("mac")) {
                   //no need to assign look and feel
-              } else if (osName.toLowerCase().startsWith("windows")) {
+              } else if (osName.toLowerCase(Locale.ENGLISH).startsWith("windows")) {
                   lookAndFeelClassName = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
                   model.setLookAndFeelClassName(lookAndFeelClassName);
-              } else if (osName.toLowerCase().startsWith("linux")) {
+              } else if (osName.toLowerCase(Locale.ENGLISH).startsWith("linux")) {
                   lookAndFeelClassName = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel";
                   model.setLookAndFeelClassName(lookAndFeelClassName);
               }
@@ -1453,7 +1454,7 @@ public class LogUI extends JFrame implem
             for (Iterator iter = plugins.iterator();iter.hasNext();) {
                 Plugin plugin = (Plugin)iter.next();
                 //don't stop ZeroConfPlugin if it is registered
-                if (!plugin.getName().toLowerCase().contains("zeroconf")) {
+                if (!plugin.getName().toLowerCase(Locale.ENGLISH).contains("zeroconf")) {
                   pluginRegistry.stopPlugin(plugin.getName());
                 }
             }

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ReceiverConfigurationPanel.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ReceiverConfigurationPanel.java?rev=1158566&r1=1158565&r2=1158566&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ReceiverConfigurationPanel.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/ReceiverConfigurationPanel.java
Wed Aug 17 08:18:24 2011
@@ -34,6 +34,7 @@ import java.net.URISyntaxException;
 import java.net.URL;
 import java.util.List;
 
+import java.util.Locale;
 import javax.swing.AbstractAction;
 import javax.swing.BorderFactory;
 import javax.swing.ButtonGroup;
@@ -809,7 +810,7 @@ class ReceiverConfigurationPanel extends
 
         boolean isPatternLayoutLogFormat() {
             Object item = logFileFormatTypeComboBox.getSelectedItem();
-            return item != null && item.toString().toLowerCase().contains("patternlayout");
+            return item != null && item.toString().toLowerCase(Locale.ENGLISH).contains("patternlayout");
         }
 
         String getLogFormatTimestampFormat() {

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=1158566&r1=1158565&r2=1158566&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
Wed Aug 17 08:18:24 2011
@@ -400,7 +400,7 @@ public class TableColorizingRenderer ext
         //find the property in the property set...case-sensitive
         for (Iterator iter = propertySet.iterator();iter.hasNext();) {
             String entry = iter.next().toString();
-            if (entry.toLowerCase().equals(headerName)) {
+            if (entry.equalsIgnoreCase(headerName)) {
                 thisProp = entry;
                 break;
             }

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/helper/SwingHelper.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/helper/SwingHelper.java?rev=1158566&r1=1158565&r2=1158566&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/helper/SwingHelper.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/helper/SwingHelper.java
Wed Aug 17 08:18:24 2011
@@ -30,6 +30,7 @@ import java.io.File;
 import java.util.ArrayList;
 import java.util.List;
 
+import java.util.Locale;
 import javax.swing.AbstractAction;
 import javax.swing.Action;
 import javax.swing.InputMap;
@@ -92,7 +93,7 @@ public final class SwingHelper {
   }
 
   public static boolean isMacOSX() {
-    return System.getProperty("os.name").toLowerCase().startsWith("mac os x");
+    return System.getProperty("os.name").toLowerCase(Locale.ENGLISH).startsWith("mac os x");
   }
 
   public static List orderOKCancelButtons(JButton okButton, JButton cancelButton) {

Modified: logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/receivers/PluginPropertyEditorPanel.java
URL: http://svn.apache.org/viewvc/logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/receivers/PluginPropertyEditorPanel.java?rev=1158566&r1=1158565&r2=1158566&view=diff
==============================================================================
--- logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/receivers/PluginPropertyEditorPanel.java
(original)
+++ logging/chainsaw/trunk/src/main/java/org/apache/log4j/chainsaw/receivers/PluginPropertyEditorPanel.java
Wed Aug 17 08:18:24 2011
@@ -349,7 +349,7 @@ public class PluginPropertyEditorPanel e
 
             if (columnIndex == 1) {
                 //ensure name is set
-                if (descriptors[rowIndex].getName().toLowerCase().equals("name") &&
(aValue == null || aValue.toString().trim().equals(""))) {
+                if (descriptors[rowIndex].getName().equalsIgnoreCase("name") && (aValue
== null || aValue.toString().trim().equals(""))) {
                     logger.error("Name required");
                     return;
                 }



Mime
View raw message