logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From carn...@apache.org
Subject svn commit: r527771 [1/2] - in /logging/log4j/trunk/src/java/org/apache/log4j: filter/ helpers/ rule/ spi/
Date Thu, 12 Apr 2007 05:17:13 GMT
Author: carnold
Date: Wed Apr 11 22:17:12 2007
New Revision: 527771

URL: http://svn.apache.org/viewvc?view=rev&rev=527771
Log:
Bug 42092: Checkstyle fixes in o.a.l.spi, .filter, and o.a.l.rule

Modified:
    logging/log4j/trunk/src/java/org/apache/log4j/filter/ExpressionFilter.java
    logging/log4j/trunk/src/java/org/apache/log4j/filter/LocationInfoFilter.java
    logging/log4j/trunk/src/java/org/apache/log4j/helpers/Constants.java
    logging/log4j/trunk/src/java/org/apache/log4j/helpers/UtilLoggingLevel.java
    logging/log4j/trunk/src/java/org/apache/log4j/rule/AbstractRule.java
    logging/log4j/trunk/src/java/org/apache/log4j/rule/AndRule.java
    logging/log4j/trunk/src/java/org/apache/log4j/rule/ColorRule.java
    logging/log4j/trunk/src/java/org/apache/log4j/rule/EqualsRule.java
    logging/log4j/trunk/src/java/org/apache/log4j/rule/ExistsRule.java
    logging/log4j/trunk/src/java/org/apache/log4j/rule/ExpressionRule.java
    logging/log4j/trunk/src/java/org/apache/log4j/rule/InFixToPostFix.java
    logging/log4j/trunk/src/java/org/apache/log4j/rule/InequalityRule.java
    logging/log4j/trunk/src/java/org/apache/log4j/rule/LevelEqualsRule.java
    logging/log4j/trunk/src/java/org/apache/log4j/rule/LevelInequalityRule.java
    logging/log4j/trunk/src/java/org/apache/log4j/rule/LikeRule.java
    logging/log4j/trunk/src/java/org/apache/log4j/rule/NotEqualsRule.java
    logging/log4j/trunk/src/java/org/apache/log4j/rule/NotRule.java
    logging/log4j/trunk/src/java/org/apache/log4j/rule/OrRule.java
    logging/log4j/trunk/src/java/org/apache/log4j/rule/PartialTextMatchRule.java
    logging/log4j/trunk/src/java/org/apache/log4j/rule/Rule.java
    logging/log4j/trunk/src/java/org/apache/log4j/rule/RuleFactory.java
    logging/log4j/trunk/src/java/org/apache/log4j/rule/TimestampEqualsRule.java
    logging/log4j/trunk/src/java/org/apache/log4j/rule/TimestampInequalityRule.java
    logging/log4j/trunk/src/java/org/apache/log4j/spi/LoggingEventFieldResolver.java

Modified: logging/log4j/trunk/src/java/org/apache/log4j/filter/ExpressionFilter.java
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/java/org/apache/log4j/filter/ExpressionFilter.java?view=diff&rev=527771&r1=527770&r2=527771
==============================================================================
--- logging/log4j/trunk/src/java/org/apache/log4j/filter/ExpressionFilter.java (original)
+++ logging/log4j/trunk/src/java/org/apache/log4j/filter/ExpressionFilter.java Wed Apr 11 22:17:12 2007
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,89 +24,139 @@
 
 
 /**
- *A filter supporting complex expressions - supports both infix and postfix 
- * expressions (infix expressions must first be converted to postfix prior 
+ * A filter supporting complex expressions - supports both infix and postfix
+ * expressions (infix expressions must first be converted to postfix prior
  * to processing).
- *
- * <p>See <code>org.apache.log4j.chainsaw.LoggingEventFieldResolver.java</code> 
- * for the correct names for logging event fields used when building expressions.
- *
- * <p>See <org.apache.log4j.chainsaw.rule</code> package for a list of available
+ * <p/>
+ * <p>See <code>org.apache.log4j.chainsaw.LoggingEventFieldResolver.java</code>
+ * for the correct names for logging event fields
+ * used when building expressions.
+ * <p/>
+ * <p>See <code>org.apache.log4j.chainsaw.rule</code> package
+ * for a list of available
  * rules which can be applied using the expression syntax.
- *
- * <p>See <code>org.apache.log4j.chainsaw.RuleFactory</code> for the symbols 
+ * <p/>
+ * <p>See <code>org.apache.log4j.chainsaw.RuleFactory</code> for the symbols
  * used to activate the corresponding rules.
- *
- *NOTE:  Grouping using parentheses is supported - all tokens must be separated by spaces, and
- *operands which contain spaces are not yet supported.
- *
- *Example:
- *
- *In order to build a filter that displays all messages with infomsg-45 or infomsg-44 in the message,
- *as well as all messages with a level of WARN or higher, build an expression using 
- *the LikeRule (supports ORO-based regular expressions) and the InequalityRule. 
+ * <p/>
+ * NOTE:  Grouping using parentheses is supported -
+ * all tokens must be separated by spaces, and
+ * operands which contain spaces are not yet supported.
+ * <p/>
+ * Example:
+ * <p/>
+ * In order to build a filter that displays all messages with
+ * infomsg-45 or infomsg-44 in the message,
+ * as well as all messages with a level of WARN or higher,
+ * build an expression using
+ * the LikeRule (supports ORO-based regular expressions) and the InequalityRule.
  * <b> ( MSG LIKE infomsg-4[4,5] ) && ( LEVEL >= WARN ) </b>
- *  
- *Three options are required:
- *  <b>Expression</b> - the expression to match
- *  <b>ConvertInFixToPostFix</b> - convert from infix to posfix (default true)
- *  <b>AcceptOnMatch</b> - true or false (default true)
- *
+ * <p/>
+ * Three options are required:
+ * <b>Expression</b> - the expression to match
+ * <b>ConvertInFixToPostFix</b> - convert from infix to posfix (default true)
+ * <b>AcceptOnMatch</b> - true or false (default true)
+ * <p/>
  * Meaning of <b>AcceptToMatch</b>:
  * If there is a match between the value of the
  * Expression option and the {@link LoggingEvent} and AcceptOnMatch is true,
  * the {@link #decide} method returns {@link Filter#ACCEPT}.
- *
+ * <p/>
  * If there is a match between the value of the
  * Expression option and the {@link LoggingEvent} and AcceptOnMatch is false,
  * {@link Filter#DENY} is returned.
- *
+ * <p/>
  * If there is no match, {@link Filter#NEUTRAL} is returned.
  *
  * @author Scott Deboy sdeboy@apache.org
  */
 public class ExpressionFilter extends Filter {
-  boolean acceptOnMatch = true;
-  boolean convertInFixToPostFix = true;
-  String expression;
-  Rule expressionRule;
-
-  public void activateOptions() {
-    expressionRule =
-      ExpressionRule.getRule(expression, !convertInFixToPostFix);
-  }
-
-  public void setExpression(String expression) {
-    this.expression = expression;
-  }
-
-  public String getExpression() {
-    return expression;
-  }
-
-  public void setConvertInFixToPostFix(boolean convertInFixToPostFix) {
-    this.convertInFixToPostFix = convertInFixToPostFix;
-  }
-
-  public boolean getConvertInFixToPostFix() {
-    return convertInFixToPostFix;
-  }
-
-  public void setAcceptOnMatch(boolean acceptOnMatch) {
-    this.acceptOnMatch = acceptOnMatch;
-  }
-
-  public boolean getAcceptOnMatch() {
-    return acceptOnMatch;
-  }
-
-  /**
-     Returns {@link Filter#NEUTRAL} is there is no string match.
-   */
-  public int decide(LoggingEvent event) {
-    if (expressionRule.evaluate(event)) {
-      return (acceptOnMatch?Filter.ACCEPT:Filter.DENY);
+    /**
+     * accept on match.
+     */
+    boolean acceptOnMatch = true;
+    /**
+     * Convert in-fix to post-fix.
+     */
+    boolean convertInFixToPostFix = true;
+    /**
+     * Expression.
+     */
+    String expression;
+    /**
+     * Evaluated rule.
+     */
+    Rule expressionRule;
+
+    /**
+     * {@inheritDoc}
+     */
+    public void activateOptions() {
+        expressionRule =
+                ExpressionRule.getRule(expression, !convertInFixToPostFix);
+    }
+
+    /**
+     * Set exp.
+     * @param exp exp.
+     */
+    public void setExpression(final String exp) {
+        this.expression = exp;
+    }
+
+    /**
+     * Get expression.
+     * @return expression.
+     */
+    public String getExpression() {
+        return expression;
+    }
+
+    /**
+     * Set convert in-fix to post-fix.
+     * @param newValue new value.
+     */
+    public void setConvertInFixToPostFix(final boolean newValue) {
+        this.convertInFixToPostFix = newValue;
+    }
+
+    /**
+     * Get in-fix to post-fix conversion setting.
+     * @return true if in-fix expressions are converted to post-fix.
+     */
+    public boolean getConvertInFixToPostFix() {
+        return convertInFixToPostFix;
+    }
+
+    /**
+     * Set whether filter should accept events if they match the expression.
+     * @param newValue if true, accept on match.
+     */
+    public void setAcceptOnMatch(final boolean newValue) {
+        this.acceptOnMatch = newValue;
+    }
+
+    /**
+     * Gets whether filter accepts matching or non-matching events.
+     * @return if true, accept matching events.
+     */
+    public boolean getAcceptOnMatch() {
+        return acceptOnMatch;
+    }
+
+    /**
+     * Determines if event matches the filter.
+     * @param event logging event;
+     * @return {@link Filter#NEUTRAL} is there is no string match.
+     */
+    public int decide(final LoggingEvent event) {
+        if (expressionRule.evaluate(event)) {
+            if (acceptOnMatch) {
+                return Filter.ACCEPT;
+            } else {
+                return Filter.DENY;
+            }
+        }
+        return Filter.NEUTRAL;
     }
-    return Filter.NEUTRAL;
-  }
 }

Modified: logging/log4j/trunk/src/java/org/apache/log4j/filter/LocationInfoFilter.java
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/java/org/apache/log4j/filter/LocationInfoFilter.java?view=diff&rev=527771&r1=527770&r2=527771
==============================================================================
--- logging/log4j/trunk/src/java/org/apache/log4j/filter/LocationInfoFilter.java (original)
+++ logging/log4j/trunk/src/java/org/apache/log4j/filter/LocationInfoFilter.java Wed Apr 11 22:17:12 2007
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -25,60 +25,95 @@
 
 
 /**
- * Location information is usually specified at the appender level - all events associated 
- * with an appender either create and parse stack traces or they do not.  This is
- * an expensive operation and in some cases not needed for all events associated with
- * an appender.
- * 
- * This filter creates event-level location information only if the provided expression evaluates to true.
- * 
- * For information on expression syntax, see org.apache.log4j.rule.ExpressionRule
- * 
+ * Location information is usually specified at the appender level -
+ * all events associated
+ * with an appender either create and parse stack traces or they do not.
+ * This is an expensive operation and in some cases not needed
+ * for all events associated with an appender.
+ *
+ * This filter creates event-level location information only
+ * if the provided expression evaluates to true.
+ *
+ * For information on expression syntax,
+ * see org.apache.log4j.rule.ExpressionRule
+ *
  * @author Scott Deboy sdeboy@apache.org
  */
 public class LocationInfoFilter extends Filter {
+    /**
+     * Convert to in-fix to post-fix.
+     */
   boolean convertInFixToPostFix = true;
+    /**
+     * Expression.
+     */
   String expression;
+    /**
+     * Compiled expression.
+     */
   Rule expressionRule;
-  //HACK: Category is the last of the internal layers - pass this in as the class name
-  //in order for parsing to work correctly
+    /**
+    HACK: Category is the last of the internal layers -
+     pass this in as the class name
+  in order for parsing to work correctly.
+    */
   private String className = "org.apache.log4j.Category";
 
+    /**
+     * {@inheritDoc}
+     */
   public void activateOptions() {
     expressionRule =
       ExpressionRule.getRule(expression, !convertInFixToPostFix);
   }
 
-  public void setExpression(String expression) {
-    this.expression = expression;
+    /**
+     * Set expression.
+     * @param exp expression.
+     */
+  public void setExpression(final String exp) {
+    this.expression = exp;
   }
 
+    /**
+     * Get expression.
+     * @return expression.
+     */
   public String getExpression() {
     return expression;
   }
 
-  public void setConvertInFixToPostFix(boolean convertInFixToPostFix) {
-    this.convertInFixToPostFix = convertInFixToPostFix;
+    /**
+     * Set whether in-fix expressions should be converted to post-fix.
+     * @param newValue if true, convert/
+     */
+  public void setConvertInFixToPostFix(final boolean newValue) {
+    this.convertInFixToPostFix = newValue;
   }
 
+    /**
+     * Set whether in-fix expressions should be converted to post-fix.
+     * @return if true, expressions are converted.
+     */
   public boolean getConvertInFixToPostFix() {
     return convertInFixToPostFix;
   }
 
   /**
-   * If this event does not already contain location information, 
+   * If this event does not already contain location information,
    * evaluate the event against the expression.
-   * 
-   * If the expression evaluates to true, generate a LocationInfo instance 
+   *
+   * If the expression evaluates to true, generate a LocationInfo instance
    * by creating an exception and set this LocationInfo on the event.
-   * 
-   * Returns {@link Filter#NEUTRAL}
+   *
+   * @param event event
+   * @return Filter.NEUTRAL.
    */
-  public int decide(LoggingEvent event) {
+  public int decide(final LoggingEvent event) {
     if (!event.locationInformationExists()) {
       if (expressionRule.evaluate(event)) {
-	      Throwable t = new Exception();
-	      event.setLocationInformation(new LocationInfo(t, className));
+          Throwable t = new Exception();
+          event.setLocationInformation(new LocationInfo(t, className));
       }
     }
     return Filter.NEUTRAL;

Modified: logging/log4j/trunk/src/java/org/apache/log4j/helpers/Constants.java
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/java/org/apache/log4j/helpers/Constants.java?view=diff&rev=527771&r1=527770&r2=527771
==============================================================================
--- logging/log4j/trunk/src/java/org/apache/log4j/helpers/Constants.java (original)
+++ logging/log4j/trunk/src/java/org/apache/log4j/helpers/Constants.java Wed Apr 11 22:17:12 2007
@@ -1,12 +1,13 @@
 /*
- * Copyright 1999,2004 The Apache Software Foundation.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -19,50 +20,104 @@
 
 /**
  * Constants used internally throughout log4j.
- * 
+ *
  * @since 1.3
  */
 public interface Constants {
-  
-  static final String LOG4J_PACKAGE_NAME = "org.apache.log4j";
-  
+
+    /**
+     * log4j package name string literal.
+     */
+  String LOG4J_PACKAGE_NAME = "org.apache.log4j";
+
   /**
    *  The name of the default repository is "default" (without the quotes).
    */
-  static final String DEFAULT_REPOSITORY_NAME  = "default";
-  
-  
-  static final String APPLICATION_KEY = "application";
-  static final String HOSTNAME_KEY = "hostname";
-  static final String RECEIVER_NAME_KEY = "receiver";
-  static final String LOG4J_ID_KEY = "log4jid";
-  public static final String TIMESTAMP_RULE_FORMAT = "yyyy/MM/dd HH:mm:ss";
+  String DEFAULT_REPOSITORY_NAME  = "default";
+
+    /**
+     * application string literal.
+     */
+  String APPLICATION_KEY = "application";
+    /**
+     * hostname string literal.
+     */
+  String HOSTNAME_KEY = "hostname";
+    /**
+     * receiver string literal.
+     */
+  String RECEIVER_NAME_KEY = "receiver";
+    /**
+     * log4jid string literal.
+     */
+  String LOG4J_ID_KEY = "log4jid";
+    /**
+     * time stamp pattern string literal.
+     */
+  String TIMESTAMP_RULE_FORMAT = "yyyy/MM/dd HH:mm:ss";
 
-  /*
+  /**
    * The default property file name for automatic configuration.
    */
-  static final String DEFAULT_CONFIGURATION_FILE = "log4j.properties";
-  /*
+  String DEFAULT_CONFIGURATION_FILE = "log4j.properties";
+  /**
    * The default XML configuration file name for automatic configuration.
    */
-  static final String DEFAULT_XML_CONFIGURATION_FILE = "log4j.xml";
-  static final String DEFAULT_CONFIGURATION_KEY = "log4j.configuration";
-  static final String CONFIGURATOR_CLASS_KEY = "log4j.configuratorClass";
-  
-  static final String JNDI_CONTEXT_NAME = "java:comp/env/log4j/context-name";
-  
-  static final String TEMP_LIST_APPENDER_NAME = "TEMP_LIST_APPENDER";
-  static final String TEMP_CONSOLE_APPENDER_NAME = "TEMP_CONSOLE_APPENDER";
-  static final String CODES_HREF = "http://logging.apache.org/log4j/docs/codes.html";
-  
-  
-  public static final String ABSOLUTE_FORMAT = "ABSOLUTE";
-  public static final String ABSOLUTE_TIME_PATTERN = "HH:mm:ss,SSS";
-
-
-  public static final String DATE_AND_TIME_FORMAT = "DATE";
-  public static final String DATE_AND_TIME_PATTERN = "dd MMM yyyy HH:mm:ss,SSS";
-  
-  public static final String ISO8601_FORMAT = "ISO8601";
-  public static final String ISO8601_PATTERN = "yyyy-MM-dd HH:mm:ss,SSS";
+  String DEFAULT_XML_CONFIGURATION_FILE = "log4j.xml";
+    /**
+     * log4j.configuration string literal.
+     */
+  String DEFAULT_CONFIGURATION_KEY = "log4j.configuration";
+    /**
+     * log4j.configuratorClass string literal.
+     */
+  String CONFIGURATOR_CLASS_KEY = "log4j.configuratorClass";
+
+    /**
+     * JNDI context name string literal.
+     */
+  String JNDI_CONTEXT_NAME = "java:comp/env/log4j/context-name";
+
+    /**
+     * TEMP_LIST_APPENDER string literal.
+     */
+  String TEMP_LIST_APPENDER_NAME = "TEMP_LIST_APPENDER";
+    /**
+     * TEMP_CONSOLE_APPENDER string literal.
+     */
+  String TEMP_CONSOLE_APPENDER_NAME = "TEMP_CONSOLE_APPENDER";
+    /**
+     * Codes URL string literal.
+     */
+  String CODES_HREF =
+          "http://logging.apache.org/log4j/docs/codes.html";
+
+
+    /**
+     * ABSOLUTE string literal.
+     */
+  String ABSOLUTE_FORMAT = "ABSOLUTE";
+    /**
+     * SimpleTimePattern for ABSOLUTE.
+     */
+  String ABSOLUTE_TIME_PATTERN = "HH:mm:ss,SSS";
+
+
+    /**
+     * DATE string literal.
+     */
+  String DATE_AND_TIME_FORMAT = "DATE";
+    /**
+     * SimpleTimePattern for DATE.
+     */
+  String DATE_AND_TIME_PATTERN = "dd MMM yyyy HH:mm:ss,SSS";
+
+    /**
+     * ISO8601 string literal.
+     */
+  String ISO8601_FORMAT = "ISO8601";
+    /**
+     * SimpleTimePattern for ISO8601.
+     */
+  String ISO8601_PATTERN = "yyyy-MM-dd HH:mm:ss,SSS";
 }

Modified: logging/log4j/trunk/src/java/org/apache/log4j/helpers/UtilLoggingLevel.java
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/java/org/apache/log4j/helpers/UtilLoggingLevel.java?view=diff&rev=527771&r1=527770&r2=527771
==============================================================================
--- logging/log4j/trunk/src/java/org/apache/log4j/helpers/UtilLoggingLevel.java (original)
+++ logging/log4j/trunk/src/java/org/apache/log4j/helpers/UtilLoggingLevel.java Wed Apr 11 22:17:12 2007
@@ -1,12 +1,13 @@
 /*
- * Copyright 1999,2004 The Apache Software Foundation.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,126 +23,215 @@
 import org.apache.log4j.Level;
 
 /**
- *  An extension of the Level class that provides support for java.util.logging 
+ * An extension of the Level class that provides support for java.util.logging
  * Levels.
  *
- *  @author Scott Deboy <sdeboy@apache.org>
- *
+ * @author Scott Deboy (sdeboy@apache.org)
  */
 
 public class UtilLoggingLevel extends Level {
 
-  private static final long serialVersionUID = 909301162611820211L;
-
-  public static final int SEVERE_INT = 17000;
-  public static final int WARNING_INT = 16000;
-  public static final int INFO_INT = 15000;
-  public static final int CONFIG_INT = 14000;
-  public static final int FINE_INT = 13000;
-  public static final int FINER_INT = 12000;
-  public static final int FINEST_INT = 11000;
-  public static final int UNKNOWN_INT = 10000;
-  
-  public static final UtilLoggingLevel SEVERE = new UtilLoggingLevel(SEVERE_INT, "SEVERE", 0);
-  public static final UtilLoggingLevel WARNING = new UtilLoggingLevel(WARNING_INT, "WARNING", 4);
-  public static final UtilLoggingLevel INFO = new UtilLoggingLevel(INFO_INT, "INFO", 5);
-  public static final UtilLoggingLevel CONFIG = new UtilLoggingLevel(CONFIG_INT, "CONFIG", 6);
-  public static final UtilLoggingLevel FINE = new UtilLoggingLevel(FINE_INT, "FINE", 7);
-  public static final UtilLoggingLevel FINER = new UtilLoggingLevel(FINER_INT, "FINER", 8);      
-  public static final UtilLoggingLevel FINEST = new UtilLoggingLevel(FINEST_INT, "FINEST", 9);      
-
-  protected UtilLoggingLevel(int level, String levelStr, int syslogEquivalent) {
-    super(level, levelStr, syslogEquivalent);
-  }
-
-  /**
-    Convert an integer passed as argument to a level. If the
-    conversion fails, then this method returns the specified default.
-  */
-  public static UtilLoggingLevel toLevel(int val, UtilLoggingLevel defaultLevel) {
-    switch (val) {
-    case SEVERE_INT:
-      return SEVERE;
-
-    case WARNING_INT:
-      return WARNING;
-
-    case INFO_INT:
-      return INFO;
-
-    case CONFIG_INT:
-      return CONFIG;
-
-    case FINE_INT:
-      return FINE;
-
-    case FINER_INT:
-      return FINER;
-
-    case FINEST_INT:
-      return FINEST;
-
-    default:
-      return defaultLevel;
-    }
-  }
-
-  public static Level toLevel(int val) {
-    return toLevel(val, FINEST);
-  }
-
-  public static List getAllPossibleLevels() {
-  	ArrayList list=new ArrayList();
-  	list.add(FINE);
-  	list.add(FINER);
-  	list.add(FINEST);
-  	list.add(INFO);
-  	list.add(CONFIG);
-  	list.add(WARNING);
-  	list.add(SEVERE);
-  	return list;
-  }
-
-  public static Level toLevel(String s) {
-  	return toLevel(s, Level.DEBUG);
-  }
-  
-  public static Level toLevel(String sArg, Level defaultLevel) {
-    if (sArg == null) {
-      return defaultLevel;
-    }
-
-    String s = sArg.toUpperCase();
-
-    if (s.equals("SEVERE")) {
-      return SEVERE;
-    }
-
-    //if(s.equals("FINE")) return Level.FINE; 
-    if (s.equals("WARNING")) {
-      return WARNING;
-    }
-
-    if (s.equals("INFO")) {
-      return INFO;
-    }
-
-    if (s.equals("CONFI")) {
-      return CONFIG;
-    }
-
-    if (s.equals("FINE")) {
-      return FINE;
-    }
-
-    if (s.equals("FINER")) {
-      return FINER;
-    }
-
-    if (s.equals("FINEST")) {
-      return FINEST;
+    /**
+     * Serialization version id.
+     */
+    private static final long serialVersionUID = 909301162611820211L;
+
+    /**
+     * Numerical value for SEVERE.
+     */
+    public static final int SEVERE_INT = 17000;
+    /**
+     * Numerical value for WARNING.
+     */
+    public static final int WARNING_INT = 16000;
+    /**
+     * Numerical value for INFO.
+     */
+    public static final int INFO_INT = 15000;
+    /**
+     * Numerical value for CONFIG.
+     */
+    public static final int CONFIG_INT = 14000;
+    /**
+     * Numerical value for FINE.
+     */
+    public static final int FINE_INT = 13000;
+    /**
+     * Numerical value for FINER.
+     */
+    public static final int FINER_INT = 12000;
+    /**
+     * Numerical value for FINEST.
+     */
+    public static final int FINEST_INT = 11000;
+    /**
+     * Numerical value for UNKNOWN.
+     */
+    public static final int UNKNOWN_INT = 10000;
+
+    /**
+     * SEVERE.
+     */
+    public static final UtilLoggingLevel SEVERE =
+            new UtilLoggingLevel(SEVERE_INT, "SEVERE", 0);
+    /**
+     * WARNING.
+     */
+    public static final UtilLoggingLevel WARNING =
+            new UtilLoggingLevel(WARNING_INT, "WARNING", 4);
+    /**
+     * INFO.
+     */
+    public static final UtilLoggingLevel INFO =
+            new UtilLoggingLevel(INFO_INT, "INFO", 5);
+    /**
+     * CONFIG.
+     */
+    public static final UtilLoggingLevel CONFIG =
+            new UtilLoggingLevel(CONFIG_INT, "CONFIG", 6);
+    /**
+     * FINE.
+     */
+    public static final UtilLoggingLevel FINE =
+            new UtilLoggingLevel(FINE_INT, "FINE", 7);
+    /**
+     * FINER.
+     */
+    public static final UtilLoggingLevel FINER =
+            new UtilLoggingLevel(FINER_INT, "FINER", 8);
+    /**
+     * FINEST.
+     */
+    public static final UtilLoggingLevel FINEST =
+            new UtilLoggingLevel(FINEST_INT, "FINEST", 9);
+
+    /**
+     * Create new instance.
+     * @param level numeric value for level.
+     * @param levelStr symbolic name for level.
+     * @param syslogEquivalent Equivalent syslog severity.
+     */
+    protected UtilLoggingLevel(final int level,
+                               final String levelStr,
+                               final int syslogEquivalent) {
+        super(level, levelStr, syslogEquivalent);
+    }
+
+    /**
+     * Convert an integer passed as argument to a level. If the
+     * conversion fails, then this method returns the specified default.
+     * @param val numeric value.
+     * @param defaultLevel level to be returned if no level matches
+     * numeric value.
+     * @return matching level or default level.
+     */
+    public static UtilLoggingLevel toLevel(final int val,
+                               final UtilLoggingLevel defaultLevel) {
+        switch (val) {
+            case SEVERE_INT:
+                return SEVERE;
+
+            case WARNING_INT:
+                return WARNING;
+
+            case INFO_INT:
+                return INFO;
+
+            case CONFIG_INT:
+                return CONFIG;
+
+            case FINE_INT:
+                return FINE;
+
+            case FINER_INT:
+                return FINER;
+
+            case FINEST_INT:
+                return FINEST;
+
+            default:
+                return defaultLevel;
+        }
+    }
+
+    /**
+     * Gets level matching numeric value.
+     * @param val numeric value.
+     * @return  matching level or UtilLoggerLevel.FINEST if no match.
+     */
+    public static Level toLevel(final int val) {
+        return toLevel(val, FINEST);
+    }
+
+    /**
+     * Gets list of supported levels.
+     * @return  list of supported levels.
+     */
+    public static List getAllPossibleLevels() {
+        ArrayList list = new ArrayList();
+        list.add(FINE);
+        list.add(FINER);
+        list.add(FINEST);
+        list.add(INFO);
+        list.add(CONFIG);
+        list.add(WARNING);
+        list.add(SEVERE);
+        return list;
+    }
+
+    /**
+     * Get level with specified symbolic name.
+     * @param s symbolic name.
+     * @return matching level or Level.DEBUG if no match.
+     */
+    public static Level toLevel(final String s) {
+        return toLevel(s, Level.DEBUG);
+    }
+
+
+    /**
+     * Get level with specified symbolic name.
+     * @param sArg symbolic name.
+     * @param defaultLevel level to return if no match.
+     * @return matching level or defaultLevel if no match.
+     */
+    public static Level toLevel(final String sArg,
+                                final Level defaultLevel) {
+        if (sArg == null) {
+            return defaultLevel;
+        }
+
+        String s = sArg.toUpperCase();
+
+        if (s.equals("SEVERE")) {
+            return SEVERE;
+        }
+
+        //if(s.equals("FINE")) return Level.FINE;
+        if (s.equals("WARNING")) {
+            return WARNING;
+        }
+
+        if (s.equals("INFO")) {
+            return INFO;
+        }
+
+        if (s.equals("CONFI")) {
+            return CONFIG;
+        }
+
+        if (s.equals("FINE")) {
+            return FINE;
+        }
+
+        if (s.equals("FINER")) {
+            return FINER;
+        }
+
+        if (s.equals("FINEST")) {
+            return FINEST;
+        }
+        return defaultLevel;
     }
-    return defaultLevel;
-  }
 
 }

Modified: logging/log4j/trunk/src/java/org/apache/log4j/rule/AbstractRule.java
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/java/org/apache/log4j/rule/AbstractRule.java?view=diff&rev=527771&r1=527770&r2=527771
==============================================================================
--- logging/log4j/trunk/src/java/org/apache/log4j/rule/AbstractRule.java (original)
+++ logging/log4j/trunk/src/java/org/apache/log4j/rule/AbstractRule.java Wed Apr 11 22:17:12 2007
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,32 +26,55 @@
 /**
  * An abstract Rule class that provides the PropertyChange support plumbing.
  *
- * @author Paul Smith <psmith@apache.org>
- * @author Scott Deboy <sdeboy@apache.org>
+ * @author Paul Smith (psmith@apache.org)
+ * @author Scott Deboy (sdeboy@apache.org)
  */
 public abstract class AbstractRule implements Rule, Serializable {
+    /**
+     * Serialization id.
+     */
   static final long serialVersionUID = -2844288145563025172L;
-  
+
+    /**
+     * PropertySupport instance.
+     */
   private PropertyChangeSupport propertySupport =
     new PropertyChangeSupport(this);
 
-  public void addPropertyChangeListener(PropertyChangeListener l) {
+    /**
+     * Add property change listener.
+     * @param l listener.
+     */
+  public void addPropertyChangeListener(final PropertyChangeListener l) {
     propertySupport.addPropertyChangeListener(l);
   }
 
-  public void removePropertyChangeListener(PropertyChangeListener l) {
+    /**
+     * Remove property change listener.
+     * @param l listener.
+     */
+  public void removePropertyChangeListener(final PropertyChangeListener l) {
     propertySupport.removePropertyChangeListener(l);
   }
 
+    /**
+     * Send property change notification to attached listeners.
+     * @param propertyName property name.
+     * @param oldVal old value.
+     * @param newVal new value.
+     */
   protected void firePropertyChange(
-    String propertyName, Object oldVal, Object newVal) {
+    final String propertyName,
+    final Object oldVal,
+    final Object newVal) {
     propertySupport.firePropertyChange(propertyName, oldVal, newVal);
   }
 
   /**
-   * @param evt
+   * Send property change notification to attached listeners.
+   * @param evt property change event.
    */
-  public void firePropertyChange(PropertyChangeEvent evt) {
+  public void firePropertyChange(final PropertyChangeEvent evt) {
     propertySupport.firePropertyChange(evt);
   }
 }

Modified: logging/log4j/trunk/src/java/org/apache/log4j/rule/AndRule.java
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/java/org/apache/log4j/rule/AndRule.java?view=diff&rev=527771&r1=527770&r2=527771
==============================================================================
--- logging/log4j/trunk/src/java/org/apache/log4j/rule/AndRule.java (original)
+++ logging/log4j/trunk/src/java/org/apache/log4j/rule/AndRule.java Wed Apr 11 22:17:12 2007
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -25,25 +25,47 @@
 /**
  * A Rule class implementing a logical 'and'.
  *
- * @author Scott Deboy <sdeboy@apache.org>
+ * @author Scott Deboy (sdeboy@apache.org)
  */
 public class AndRule extends AbstractRule {
+    /**
+     * First rule.
+     */
   private final Rule firstRule;
+    /**
+     * Second rule.
+     */
   private final Rule secondRule;
+    /**
+     * Serialization id.
+     */
   static final long serialVersionUID = -8233444426923854651L;
-  
-  private AndRule(Rule firstRule, Rule secondRule) {
-    this.firstRule = firstRule;
-    this.secondRule = secondRule;
+
+    /**
+     * Create new instance.
+     * @param first first rule.
+     * @param second second rule.
+     */
+  private AndRule(final Rule first, final Rule second) {
+    super();
+    this.firstRule = first;
+    this.secondRule = second;
   }
 
-  public static Rule getRule(Stack stack) {
+    /**
+     * Create rule from top two elements of stack.
+     * @param stack stack of rules.
+     * @return Rule that evaluates true only if both rules are true.
+     */
+  public static Rule getRule(final Stack stack) {
     if (stack.size() < 2) {
-        throw new IllegalArgumentException("Invalid AND rule - expected two rules but received " + stack.size());
-    }  
+        throw new IllegalArgumentException(
+                "Invalid AND rule - expected two rules but received "
+                        + stack.size());
+    }
     Object o2 = stack.pop();
     Object o1 = stack.pop();
-    if ((o2 instanceof Rule) && (o1 instanceof Rule)) { 
+    if ((o2 instanceof Rule) && (o1 instanceof Rule)) {
         Rule p2 = (Rule) o2;
         Rule p1 = (Rule) o1;
         return new AndRule(p1, p2);
@@ -51,11 +73,20 @@
     throw new IllegalArgumentException("Invalid AND rule: " + o2 + "..." + o1);
   }
 
-  public static Rule getRule(Rule firstParam, Rule secondParam) {
+    /**
+     * Get rule.
+     * @param firstParam first rule.
+     * @param secondParam second rule.
+     * @return Rule that evaluates true only if both rules are true.
+     */
+  public static Rule getRule(final Rule firstParam, final Rule secondParam) {
     return new AndRule(firstParam, secondParam);
   }
 
-  public boolean evaluate(LoggingEvent event) {
+    /**
+     * {@inheritDoc}
+     */
+  public boolean evaluate(final LoggingEvent event) {
     return (firstRule.evaluate(event) && secondRule.evaluate(event));
   }
 }

Modified: logging/log4j/trunk/src/java/org/apache/log4j/rule/ColorRule.java
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/java/org/apache/log4j/rule/ColorRule.java?view=diff&rev=527771&r1=527770&r2=527771
==============================================================================
--- logging/log4j/trunk/src/java/org/apache/log4j/rule/ColorRule.java (original)
+++ logging/log4j/trunk/src/java/org/apache/log4j/rule/ColorRule.java Wed Apr 11 22:17:12 2007
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,46 +24,102 @@
 
 
 /**
- * A Rule class which also holds a color
+ * A Rule class which also holds a color.
  *
- * @author Scott Deboy <sdeboy@apache.org>
+ * @author Scott Deboy (sdeboy@apache.org)
  */
 public class ColorRule extends AbstractRule implements Serializable {
+    /**
+     * Serialization id.
+     */
   static final long serialVersionUID = -794434783372847773L;
 
+    /**
+     * Wrapped rule.
+     */
   private final Rule rule;
+    /**
+     * Foreground color.
+     */
   private final Color foregroundColor;
+    /**
+     * Background color.
+     */
   private final Color backgroundColor;
+    /**
+     * Expression.
+     */
   private final String expression;
 
-  public ColorRule(String expression, Rule rule, Color backgroundColor, Color foregroundColor) {
+    /**
+     * Create new instance.
+     * @param expression expression.
+     * @param rule rule.
+     * @param backgroundColor background color.
+     * @param foregroundColor foreground color.
+     */
+  public ColorRule(final String expression,
+                   final Rule rule,
+                   final Color backgroundColor,
+                   final Color foregroundColor) {
+    super();
     this.expression = expression;
     this.rule = rule;
     this.backgroundColor = backgroundColor;
     this.foregroundColor = foregroundColor;
   }
 
+    /**
+     * Get rule.
+     * @return underlying rule.
+     */
   public Rule getRule() {
       return rule;
   }
-  
+
+    /**
+     * Get foreground color.
+     * @return foreground color.
+     */
   public Color getForegroundColor() {
     return foregroundColor;
   }
 
+    /**
+     * Get background color.
+     * @return background color.
+     */
   public Color getBackgroundColor() {
     return backgroundColor;
   }
-  
+
+    /**
+     * Get expression.
+     * @return expression.
+     */
   public String getExpression() {
       return expression;
   }
 
-  public boolean evaluate(LoggingEvent event) {
+    /**
+     * {@inheritDoc}
+     */
+  public boolean evaluate(final LoggingEvent event) {
     return (rule != null && rule.evaluate(event));
   }
-  
+
+    /**
+     * {@inheritDoc}
+     */
   public String toString() {
-      return "color rule - expression: " + expression+", rule: " + rule + " bg: " + backgroundColor + " fg: " + foregroundColor;
+      StringBuffer buf = new StringBuffer("color rule - expression: ");
+      buf.append(expression);
+      buf.append(", rule: ");
+      buf.append(rule);
+      buf.append(" bg: ");
+      buf.append(backgroundColor);
+      buf.append(" fg: ");
+      buf.append(foregroundColor);
+      return buf.toString();
   }
 }

Modified: logging/log4j/trunk/src/java/org/apache/log4j/rule/EqualsRule.java
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/java/org/apache/log4j/rule/EqualsRule.java?view=diff&rev=527771&r1=527770&r2=527771
==============================================================================
--- logging/log4j/trunk/src/java/org/apache/log4j/rule/EqualsRule.java (original)
+++ logging/log4j/trunk/src/java/org/apache/log4j/rule/EqualsRule.java Wed Apr 11 22:17:12 2007
@@ -24,19 +24,38 @@
 
 
 /**
- * A Rule class which returns the result of performing equals against two strings.
+ * A Rule class which returns the result of
+ * performing equals against two strings.
  *
- * @author Scott Deboy <sdeboy@apache.org>
+ * @author Scott Deboy (sdeboy@apache.org)
  */
 public class EqualsRule extends AbstractRule {
-  static final long serialVersionUID = 1712851553477517245L;    
-  private static final LoggingEventFieldResolver resolver =
+    /**
+     * Serialization ID.
+     */
+  static final long serialVersionUID = 1712851553477517245L;
+    /**
+     * Resolver.
+     */
+  private static final LoggingEventFieldResolver RESOLVER =
     LoggingEventFieldResolver.getInstance();
+    /**
+     * Value.
+     */
   private final String value;
+    /**
+     * Field.
+     */
   private final String field;
 
-  private EqualsRule(String field, String value) {
-    if (!resolver.isField(field)) {
+    /**
+     * Create new instance.
+     * @param field field
+     * @param value value
+     */
+  private EqualsRule(final String field, final String value) {
+    super();
+    if (!RESOLVER.isField(field)) {
       throw new IllegalArgumentException(
         "Invalid EQUALS rule - " + field + " is not a supported field");
     }
@@ -45,7 +64,12 @@
     this.value = value;
   }
 
-  public static Rule getRule(Stack stack) {
+    /**
+     * Create new instance from top two elements of stack.
+     * @param stack stack
+     * @return new instance
+     */
+  public static Rule getRule(final Stack stack) {
     if (stack.size() < 2) {
       throw new IllegalArgumentException(
         "Invalid EQUALS rule - expected two parameters but received "
@@ -58,18 +82,25 @@
     return getRule(p1, p2);
   }
 
-  public static Rule getRule(String p1, String p2) {
+    /**
+     * Create new instance.
+     * @param p1 field, special treatment for level and timestamp.
+     * @param p2 value
+     * @return new instance
+     */
+  public static Rule getRule(final String p1, final String p2) {
     if (p1.equalsIgnoreCase(LoggingEventFieldResolver.LEVEL_FIELD)) {
-    	return LevelEqualsRule.getRule(p2);
+        return LevelEqualsRule.getRule(p2);
     } else if (p1.equalsIgnoreCase(LoggingEventFieldResolver.TIMESTAMP_FIELD)) {
-    	return TimestampEqualsRule.getRule(p2);
-    }else {
-    	return new EqualsRule(p1, p2);
+        return TimestampEqualsRule.getRule(p2);
+    } else {
+        return new EqualsRule(p1, p2);
     }
   }
 
-  public boolean evaluate(LoggingEvent event) {
-    Object p2 = resolver.getValue(field, event);
+    /** {@inheritDoc} */
+  public boolean evaluate(final LoggingEvent event) {
+    Object p2 = RESOLVER.getValue(field, event);
 
     return ((p2 != null) && p2.toString().equals(value));
   }

Modified: logging/log4j/trunk/src/java/org/apache/log4j/rule/ExistsRule.java
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/java/org/apache/log4j/rule/ExistsRule.java?view=diff&rev=527771&r1=527770&r2=527771
==============================================================================
--- logging/log4j/trunk/src/java/org/apache/log4j/rule/ExistsRule.java (original)
+++ logging/log4j/trunk/src/java/org/apache/log4j/rule/ExistsRule.java Wed Apr 11 22:17:12 2007
@@ -26,28 +26,53 @@
 /**
  * A Rule class implementing a not null (and not empty string) check.
  *
- * @author Scott Deboy <sdeboy@apache.org>
+ * @author Scott Deboy (sdeboy@apache.org)
  */
 public class ExistsRule extends AbstractRule {
-  static final long serialVersionUID = -5386265224649967464L;    
-  private static final LoggingEventFieldResolver resolver =
+    /**
+     * Serialization id.
+     */
+  static final long serialVersionUID = -5386265224649967464L;
+    /**
+     * field resolver.
+     */
+  private static final LoggingEventFieldResolver RESOLVER =
     LoggingEventFieldResolver.getInstance();
+    /**
+     * field name.
+     */
   private final String field;
 
-  private ExistsRule(String field) {
-    if (!resolver.isField(field)) {
+    /**
+     * Create new instance.
+     * @param fld field name.
+     */
+  private ExistsRule(final String fld) {
+    super();
+    if (!RESOLVER.isField(fld)) {
       throw new IllegalArgumentException(
-        "Invalid EXISTS rule - " + field + " is not a supported field");
+        "Invalid EXISTS rule - " + fld + " is not a supported field");
     }
 
-    this.field = field;
+    this.field = fld;
   }
 
-  public static Rule getRule(String field) {
+    /**
+     * Get an instance of ExistsRule.
+     * @param field field.
+     * @return instance of ExistsRule.
+     */
+  public static Rule getRule(final String field) {
     return new ExistsRule(field);
   }
 
-  public static Rule getRule(Stack stack) {
+    /**
+     * Create an instance of ExistsRule using the
+     * top name on the stack.
+     * @param stack stack
+     * @return instance of ExistsRule.
+     */
+  public static Rule getRule(final Stack stack) {
     if (stack.size() < 1) {
       throw new IllegalArgumentException(
         "Invalid EXISTS rule - expected one parameter but received "
@@ -57,8 +82,11 @@
     return new ExistsRule(stack.pop().toString());
   }
 
-  public boolean evaluate(LoggingEvent event) {
-    Object p2 = resolver.getValue(field, event);
+    /**
+     * {@inheritDoc}
+     */
+  public boolean evaluate(final LoggingEvent event) {
+    Object p2 = RESOLVER.getValue(field, event);
 
     return (!((p2 == null) || ((p2 != null) && p2.toString().equals(""))));
   }

Modified: logging/log4j/trunk/src/java/org/apache/log4j/rule/ExpressionRule.java
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/java/org/apache/log4j/rule/ExpressionRule.java?view=diff&rev=527771&r1=527770&r2=527771
==============================================================================
--- logging/log4j/trunk/src/java/org/apache/log4j/rule/ExpressionRule.java (original)
+++ logging/log4j/trunk/src/java/org/apache/log4j/rule/ExpressionRule.java Wed Apr 11 22:17:12 2007
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,51 +24,92 @@
 
 
 /**
- * A Rule class supporting both infix and postfix expressions, accepting any rule which
+ * A Rule class supporting both infix and postfix expressions,
+ * accepting any rule which
  * is supported by the <code>RuleFactory</code>.
  *
- * NOTE: parsing is supported through the use of <code>StringTokenizer</code>, which
+ * NOTE: parsing is supported through the use of
+ * <code>StringTokenizer</code>, which
  * implies two limitations:
- * 1: all tokens in the expression must be separated by spaces, including parenthese
- * 2: operands which contain spaces MUST be wrapped in single quotes. 
+ * 1: all tokens in the expression must be separated by spaces,
+ * including parenthesis
+ * 2: operands which contain spaces MUST be wrapped in single quotes.
  *    For example, the expression:
  *      msg == 'some msg'
  *    is a valid expression.
  * 3: To group expressions, use parentheses.
  *    For example, the expression:
- *      level >= INFO || ( msg == 'some msg' || logger == 'test' ) 
+ *      level >= INFO || ( msg == 'some msg' || logger == 'test' )
  *    is a valid expression.
- * See org.apache.log4j.rule.InFixToPostFix for a description of supported operators.
+ * See org.apache.log4j.rule.InFixToPostFix for a
+ * description of supported operators.
  * See org.apache.log4j.spi.LoggingEventFieldResolver for field keywords.
  *
- * @author Scott Deboy <sdeboy@apache.org>
+ * @author Scott Deboy (sdeboy@apache.org)
  */
 public class ExpressionRule extends AbstractRule {
+    /**
+     * Serialization ID.
+     */
   static final long serialVersionUID = 5809121703146893729L;
-  private static final InFixToPostFix convertor = new InFixToPostFix();
-  private static final PostFixExpressionCompiler compiler = new PostFixExpressionCompiler();
+    /**
+     * Converter.
+     */
+  private static final InFixToPostFix CONVERTER = new InFixToPostFix();
+    /**
+     * Compiler.
+     */
+  private static final PostFixExpressionCompiler COMPILER =
+          new PostFixExpressionCompiler();
+    /**
+     * Rule.
+     */
   private final Rule rule;
 
-  private ExpressionRule(Rule rule) {
-    this.rule = rule;
+    /**
+     * Create new instance.
+     * @param r rule
+     */
+  private ExpressionRule(final Rule r) {
+    super();
+    this.rule = r;
   }
 
-  public static Rule getRule(String expression) {
+    /**
+     * Get rule.
+     * @param expression expression.
+     * @return rule.
+     */
+  public static Rule getRule(final String expression) {
       return getRule(expression, false);
   }
-  
-  public static Rule getRule(String expression, boolean isPostFix) {
+
+    /**
+     * Get rule.
+     * @param expression expression.
+     * @param isPostFix If post-fix.
+     * @return rule
+     */
+  public static Rule getRule(final String expression,
+                             final boolean isPostFix) {
+    String postFix = expression;
     if (!isPostFix) {
-      expression = convertor.convert(expression);
+      postFix = CONVERTER.convert(expression);
     }
 
-    return new ExpressionRule(compiler.compileExpression(expression));
+    return new ExpressionRule(COMPILER.compileExpression(postFix));
   }
 
-  public boolean evaluate(LoggingEvent event) {
+    /**
+     * {@inheritDoc}
+     */
+  public boolean evaluate(final LoggingEvent event) {
     return rule.evaluate(event);
   }
-  
+
+    /**
+     * {@inheritDoc}
+     */
   public String toString() {
       return rule.toString();
   }
@@ -77,8 +118,13 @@
    * Evaluate a boolean postfix expression.
    *
    */
-  static class PostFixExpressionCompiler {
-    Rule compileExpression(String expression) {
+  static final class PostFixExpressionCompiler {
+      /**
+       * Compile expression.
+       * @param expression expression.
+       * @return rule.
+       */
+    public Rule compileExpression(final String expression) {
       RuleFactory factory = RuleFactory.getInstance();
 
       Stack stack = new Stack();
@@ -87,16 +133,20 @@
       while (tokenizer.hasMoreTokens()) {
         //examine each token
         String token = tokenizer.nextToken();
-        if ((token.startsWith("'")) && (token.endsWith("'") && (token.length() > 2))) {
+        if ((token.startsWith("'"))
+                && (token.endsWith("'")
+                && (token.length() > 2))) {
             token = token.substring(1, token.length() - 1);
         }
-        if ((token.startsWith("'")) && (token.endsWith("'") && (token.length() == 2))) {
+        if ((token.startsWith("'"))
+                && (token.endsWith("'")
+                && (token.length() == 2))) {
             token = "";
         }
 
         boolean inText = token.startsWith("'");
         if (inText) {
-            token=token.substring(1);
+            token = token.substring(1);
             while (inText && tokenizer.hasMoreTokens()) {
               token = token + " " + tokenizer.nextToken();
               inText = !(token.endsWith("'"));
@@ -106,7 +156,8 @@
           }
         }
 
-        //if a symbol is found, pop 2 off the stack, evaluate and push the result 
+        //if a symbol is found, pop 2 off the stack,
+          // evaluate and push the result
         if (factory.isRule(token)) {
           Rule r = factory.getRule(token, stack);
           stack.push(r);
@@ -117,15 +168,15 @@
           }
         }
       }
-      
+
       if ((stack.size() == 1) && (!(stack.peek() instanceof Rule))) {
-      	//while this may be an attempt at creating an expression,
-      	//for ease of use, convert this single entry to a partial-text 
-      	//match on the MSG field
-      	Object o = stack.pop();
-      	stack.push("MSG");
-      	stack.push(o);
-      	return factory.getRule("~=", stack);
+        //while this may be an attempt at creating an expression,
+        //for ease of use, convert this single entry to a partial-text
+        //match on the MSG field
+        Object o = stack.pop();
+        stack.push("MSG");
+        stack.push(o);
+        return factory.getRule("~=", stack);
       }
 
       //stack should contain a single rule if the expression is valid

Modified: logging/log4j/trunk/src/java/org/apache/log4j/rule/InFixToPostFix.java
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/java/org/apache/log4j/rule/InFixToPostFix.java?view=diff&rev=527771&r1=527770&r2=527771
==============================================================================
--- logging/log4j/trunk/src/java/org/apache/log4j/rule/InFixToPostFix.java (original)
+++ logging/log4j/trunk/src/java/org/apache/log4j/rule/InFixToPostFix.java Wed Apr 11 22:17:12 2007
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,16 +26,18 @@
 
 /**
  * A helper class which converts infix expressions to postfix expressions
- * Currently grouping is supported, as well as all of the Rules supported by <code>RuleFactory</code>
- * 
- * NOTE: parsing is supported through the use of <code>StringTokenizer</code>, which means 
- * all tokens in the expression must be separated by spaces.
- * 
- * Supports grouping via parens, mult-word operands using single quotes, and these operators:
- * 
+ * Currently grouping is supported, as well as all of the
+ * Rules supported by <code>RuleFactory</code>
+ *
+ * NOTE: parsing is supported through the use of <code>StringTokenizer</code>,
+ * which means all tokens in the expression must be separated by spaces.
+ *
+ * Supports grouping via parens, mult-word operands using single quotes,
+ * and these operators:
+ *
  * !        NOT operator
  * !=       NOT EQUALS operator
- * ==       EQUALS operator 
+ * ==       EQUALS operator
  * ~=       CASE-INSENSITIVE equals operator
  * ||       OR operator
  * &&       AND operator
@@ -45,15 +47,25 @@
  * &gt      GREATER THAN operator
  * &lt=     LESS THAN EQUALS operator
  * &gt=     GREATER THAN EQUALS operator
- * 
- * @author Scott Deboy <sdeboy@apache.org>
+ *
+ * @author Scott Deboy (sdeboy@apache.org)
  */
 
 public class InFixToPostFix {
+    /**
+     * Precedence map.
+     */
   private final Map precedenceMap = new HashMap();
+    /**
+     * Operators.
+     */
   private final List operators = new Vector();
 
+    /**
+     * Create new instance.
+     */
   public InFixToPostFix() {
+     super();
     //boolean operators
     operators.add("!");
     operators.add("!=");
@@ -67,37 +79,52 @@
     operators.add(">");
     operators.add("<=");
     operators.add(">=");
-    
+
     //boolean precedence
     precedenceMap.put("<", new Integer(3));
     precedenceMap.put(">", new Integer(3));
     precedenceMap.put("<=", new Integer(3));
     precedenceMap.put(">=", new Integer(3));
-    
+
     precedenceMap.put("!", new Integer(3));
     precedenceMap.put("!=", new Integer(3));
     precedenceMap.put("==", new Integer(3));
     precedenceMap.put("~=", new Integer(3));
     precedenceMap.put("like", new Integer(3));
     precedenceMap.put("exists", new Integer(3));
-    
+
     precedenceMap.put("||", new Integer(2));
     precedenceMap.put("&&", new Integer(2));
   }
 
-  public String convert(String expression) {
+    /**
+     * Convert in-fix expression to post-fix.
+     * @param expression in-fix expression.
+     * @return post-fix expression.
+     */
+  public String convert(final String expression) {
     return infixToPostFix(new StringTokenizer(expression));
   }
 
-  boolean isOperand(String symbol) {
-    symbol = symbol.toLowerCase();
-
+    /**
+     * Evaluates whether symbol is operand.
+     * @param s symbol.
+     * @return true if operand.
+     */
+  boolean isOperand(final String s) {
+    String symbol = s.toLowerCase();
     return (!operators.contains(symbol));
   }
 
-  boolean precedes(String symbol1, String symbol2) {
-    symbol1 = symbol1.toLowerCase();
-    symbol2 = symbol2.toLowerCase();
+    /**
+     * Determines whether one symbol precedes another.
+     * @param s1 symbol 1
+     * @param s2 symbol 2
+     * @return true if symbol 1 precedes symbol 2
+     */
+  boolean precedes(final String s1, final String s2) {
+    String symbol1 = s1.toLowerCase();
+    String symbol2 = s2.toLowerCase();
 
     if (!precedenceMap.keySet().contains(symbol1)) {
       return false;
@@ -115,8 +142,13 @@
     return precedesResult;
   }
 
-  String infixToPostFix(StringTokenizer tokenizer) {
-    String SPACE = " ";
+    /**
+     * convert in-fix expression to post-fix.
+     * @param tokenizer tokenizer.
+     * @return post-fix expression.
+     */
+  String infixToPostFix(final StringTokenizer tokenizer) {
+    final String space = " ";
     StringBuffer postfix = new StringBuffer();
 
     Stack stack = new Stack();
@@ -135,22 +167,23 @@
       if ("(".equals(token)) {
         //recurse
         postfix.append(infixToPostFix(tokenizer));
-        postfix.append(SPACE);
+        postfix.append(space);
       } else if (")".equals(token)) {
         //exit recursion level
         while (stack.size() > 0) {
           postfix.append(stack.pop().toString());
-          postfix.append(SPACE);
+          postfix.append(space);
         }
 
         return postfix.toString();
       } else if (isOperand(token)) {
         postfix.append(token);
-        postfix.append(SPACE);
+        postfix.append(space);
       } else {
         //operator..
         //peek the stack..if the top element has a lower precedence than token
-        //(peeked + has lower precedence than token *), push token onto the stack
+        //(peeked + has lower precedence than token *),
+        // push token onto the stack
         //otherwise, pop top element off stack and add to postfix string
         //in a loop until lower precedence or empty..then push token
         if (stack.size() > 0) {
@@ -167,7 +200,7 @@
                 (stack.size() > 0)
                   && !precedes(stack.peek().toString(), token)) {
                 postfix.append(stack.pop().toString());
-                postfix.append(SPACE);
+                postfix.append(space);
               } else {
                 bypass = true;
               }
@@ -183,7 +216,7 @@
 
     while (stack.size() > 0) {
       postfix.append(stack.pop().toString());
-      postfix.append(SPACE);
+      postfix.append(space);
     }
 
     return postfix.toString();

Modified: logging/log4j/trunk/src/java/org/apache/log4j/rule/InequalityRule.java
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/java/org/apache/log4j/rule/InequalityRule.java?view=diff&rev=527771&r1=527770&r2=527771
==============================================================================
--- logging/log4j/trunk/src/java/org/apache/log4j/rule/InequalityRule.java (original)
+++ logging/log4j/trunk/src/java/org/apache/log4j/rule/InequalityRule.java Wed Apr 11 22:17:12 2007
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,57 +24,107 @@
 
 
 /**
- * A Rule class implementing inequality evaluation - expects to be able to convert two values to longs.
- * If a specific inequality evaluation class has been provided for the event field, the appropriate rule is returned.
- * (For example, if the expression is Level &lt DEBUG, a LevelInequalityRule is returned).
+ * A Rule class implementing inequality evaluation.
+ * expects to be able to convert two values to longs.
+ * If a specific inequality evaluation class has been provided
+ * for the event field, the appropriate rule is returned.
+ * (For example, if the expression is Level &lt DEBUG,
+ * a LevelInequalityRule is returned).
  *
- * @author Scott Deboy <sdeboy@apache.org>
+ * @author Scott Deboy (sdeboy@apache.org)
  */
 public class InequalityRule extends AbstractRule {
-  static final long serialVersionUID = -5592986598528885122L;    
-  private static final LoggingEventFieldResolver resolver = LoggingEventFieldResolver.getInstance();
+    /**
+     * Serialization ID.
+     */
+  static final long serialVersionUID = -5592986598528885122L;
+    /**
+     * field RESOLVER.
+     */
+  private static final LoggingEventFieldResolver RESOLVER =
+          LoggingEventFieldResolver.getInstance();
+    /**
+     * Field name.
+     */
   private final String field;
+    /**
+     * Comparison value.
+     */
   private final String value;
+    /**
+     * Inequality symbol.
+     */
   private final String inequalitySymbol;
 
+    /**
+     * Create new instance.
+     * @param inequalitySymbol inequality symbol.
+     * @param field field
+     * @param value comparison value.
+     */
   private InequalityRule(
-    String inequalitySymbol, String field, String value) {
+    final String inequalitySymbol,
+    final String field,
+    final String value) {
+    super();
     this.inequalitySymbol = inequalitySymbol;
-    if (!resolver.isField(field)) {
-        throw new IllegalArgumentException("Invalid " + inequalitySymbol + " rule - " + field + " is not a supported field");
+    if (!RESOLVER.isField(field)) {
+        throw new IllegalArgumentException("Invalid " + inequalitySymbol
+                + " rule - " + field + " is not a supported field");
     }
 
     this.field = field;
     this.value = value;
   }
-  
-  public static Rule getRule(String inequalitySymbol, Stack stack) {
+
+    /**
+     * Create new instance from top two elements on stack.
+     * @param inequalitySymbol inequality symbol.
+     * @param stack stack.
+     * @return rule.
+     */
+  public static Rule getRule(final String inequalitySymbol,
+                             final Stack stack) {
       if (stack.size() < 2) {
-          throw new IllegalArgumentException("Invalid " + inequalitySymbol + " rule - expected two parameters but received " + stack.size());
-      }  
+          throw new IllegalArgumentException("Invalid " + inequalitySymbol
+                  + " rule - expected two parameters but received "
+                  + stack.size());
+      } 
 
       String p2 = stack.pop().toString();
       String p1 = stack.pop().toString();
       return getRule(inequalitySymbol, p1, p2);
   }
-  
-  public static Rule getRule(String inequalitySymbol, String field, String value) {
+
+    /**
+     * Create new instance from top two elements on stack.
+     * @param inequalitySymbol inequality symbol.
+     * @param field field.
+     * @param value comparison value.
+     * @return rule.
+     */
+  public static Rule getRule(final String inequalitySymbol,
+                             final String field,
+                             final String value) {
     if (field.equalsIgnoreCase(LoggingEventFieldResolver.LEVEL_FIELD)) {
-      //push the value back on the stack and allow the level-specific rule pop values
+      //push the value back on the stack and
+        // allow the level-specific rule pop values
       return LevelInequalityRule.getRule(inequalitySymbol, value);
-    } else if (field.equalsIgnoreCase(LoggingEventFieldResolver.TIMESTAMP_FIELD)){
+    } else if (
+            field.equalsIgnoreCase(LoggingEventFieldResolver.TIMESTAMP_FIELD)) {
       return TimestampInequalityRule.getRule(inequalitySymbol, value);
     } else {
       return new InequalityRule(inequalitySymbol, field, value);
     }
   }
 
-  public boolean evaluate(LoggingEvent event) {
+    /** {@inheritDoc} */
+  public boolean evaluate(final LoggingEvent event) {
     long first = 0;
 
     try {
       first =
-        new Long(resolver.getValue(field, event).toString()).longValue();
+        new Long(RESOLVER.getValue(field, event).toString()).longValue();
     } catch (NumberFormatException nfe) {
       return false;
     }

Modified: logging/log4j/trunk/src/java/org/apache/log4j/rule/LevelEqualsRule.java
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/java/org/apache/log4j/rule/LevelEqualsRule.java?view=diff&rev=527771&r1=527770&r2=527771
==============================================================================
--- logging/log4j/trunk/src/java/org/apache/log4j/rule/LevelEqualsRule.java (original)
+++ logging/log4j/trunk/src/java/org/apache/log4j/rule/LevelEqualsRule.java Wed Apr 11 22:17:12 2007
@@ -27,24 +27,41 @@
 
 /**
  * A Rule class implementing equals against two levels.
- * 
- * @author Scott Deboy <sdeboy@apache.org>
+ *
+ * @author Scott Deboy (sdeboy@apache.org)
  */
 public class LevelEqualsRule extends AbstractRule {
+    /**
+     * Serialization ID.
+     */
     static final long serialVersionUID = -3638386582899583994L;
 
+    /**
+     * Level.
+     */
     private transient Level level;
 
+    /**
+     * List of levels.
+     */
     private static List levelList = new LinkedList();
 
     static {
         populateLevels();
     }
-    
-    private LevelEqualsRule(Level level) {
+
+    /**
+     * Create new instance.
+     * @param level level.
+     */
+    private LevelEqualsRule(final Level level) {
+        super();
         this.level = level;
     }
 
+    /**
+     * Populate list of levels.
+     */
     private static void populateLevels() {
         levelList = new LinkedList();
 
@@ -56,29 +73,38 @@
         levelList.add(Level.TRACE.toString());
     }
 
-    public static Rule getRule(String value) {
-        Level thisLevel = null;
+    /**
+     * Create new rule.
+     * @param value name of level.
+     * @return instance of LevelEqualsRule.
+     */
+    public static Rule getRule(final String value) {
+        Level thisLevel;
         if (levelList.contains(value.toUpperCase())) {
             thisLevel = Level.toLevel(value.toUpperCase());
           } else {
-              thisLevel = UtilLoggingLevel.toLevel(value.toUpperCase());
+            thisLevel = UtilLoggingLevel.toLevel(value.toUpperCase());
         }
 
         return new LevelEqualsRule(thisLevel);
     }
 
-    public boolean evaluate(LoggingEvent event) {
+    /**
+     * {@inheritDoc}
+     */
+    public boolean evaluate(final LoggingEvent event) {
         return level.equals(event.getLevel());
     }
 
     /**
-     * Deserialize the state of the object
-     * 
-     * @param in
-     * 
-     * @throws IOException
+     * Deserialize the state of the object.
+     *
+     * @param in object input stream.
+     *
+     * @throws IOException if error in reading stream for deserialization.
      */
-    private void readObject(java.io.ObjectInputStream in) throws IOException {
+    private void readObject(final java.io.ObjectInputStream in)
+            throws IOException {
         populateLevels();
         boolean isUtilLogging = in.readBoolean();
         int levelInt = in.readInt();
@@ -90,13 +116,14 @@
     }
 
     /**
-     * Serialize the state of the object
-     * 
-     * @param out
-     * 
-     * @throws IOException
+     * Serialize the state of the object.
+     *
+     * @param out object output stream.
+     *
+     * @throws IOException if error in writing stream during serialization.
      */
-    private void writeObject(java.io.ObjectOutputStream out) throws IOException {
+    private void writeObject(final java.io.ObjectOutputStream out)
+            throws IOException {
         out.writeBoolean(level instanceof UtilLoggingLevel);
         out.writeInt(level.toInt());
     }

Modified: logging/log4j/trunk/src/java/org/apache/log4j/rule/LevelInequalityRule.java
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/java/org/apache/log4j/rule/LevelInequalityRule.java?view=diff&rev=527771&r1=527770&r2=527771
==============================================================================
--- logging/log4j/trunk/src/java/org/apache/log4j/rule/LevelInequalityRule.java (original)
+++ logging/log4j/trunk/src/java/org/apache/log4j/rule/LevelInequalityRule.java Wed Apr 11 22:17:12 2007
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -27,20 +27,34 @@
 /**
  * A Rule class implementing inequality evaluation for Levels (log4j and
  * util.logging) using the toInt method.
- * 
- * @author Scott Deboy <sdeboy@apache.org>
+ *
+ * @author Scott Deboy (sdeboy@apache.org)
  */
 public class LevelInequalityRule {
+    /**
+     * Level list.
+     */
     private static List levelList;
+    /**
+     * List equivalents of java.util.logging levels.
+     */
     private static List utilLoggingLevelList;
 
+
     static {
         populateLevels();
     }
 
+    /**
+     * Create new instance.
+     */
     private LevelInequalityRule() {
+        super();
     }
-    
+
+    /**
+     * Populate list of levels.
+     */
     private static void populateLevels() {
         levelList = new LinkedList();
 
@@ -50,7 +64,7 @@
         levelList.add(Level.INFO.toString());
         levelList.add(Level.DEBUG.toString());
         levelList.add(Level.TRACE.toString());
-        
+
         utilLoggingLevelList = new LinkedList();
 
         utilLoggingLevelList.add(UtilLoggingLevel.SEVERE.toString());
@@ -63,21 +77,32 @@
 
     }
 
-    public static Rule getRule(String inequalitySymbol, String value) {
+    /**
+     * Create new rule.
+     * @param inequalitySymbol inequality symbol.
+     * @param value Symbolic name of comparison level.
+     * @return instance of AbstractRule.
+     */
+    public static Rule getRule(final String inequalitySymbol,
+                               final String value) {
 
-        Level thisLevel = null;
-        
-        //if valid util.logging levels are used against events with log4j levels, the 
+        Level thisLevel;
+
+        //if valid util.logging levels are used against events
+        // with log4j levels, the
         //DEBUG level is used and an illegalargumentexception won't be generated
-        
-        //an illegalargumentexception is only generated if the user types a level name
+
+        //an illegalargumentexception is only generated
+        // if the user types a level name
         //that doesn't exist as either a log4j or util.logging level name
         if (levelList.contains(value.toUpperCase())) {
             thisLevel = Level.toLevel(value.toUpperCase());
-        } else if (utilLoggingLevelList.contains(value.toUpperCase())){
+        } else if (utilLoggingLevelList.contains(value.toUpperCase())) {
             thisLevel = UtilLoggingLevel.toLevel(value.toUpperCase());
         } else {
-            throw new IllegalArgumentException("Invalid level inequality rule - " + value + " is not a supported level");
+            throw new IllegalArgumentException(
+                    "Invalid level inequality rule - " + value
+                            + " is not a supported level");
         }
 
         if ("<".equals(inequalitySymbol)) {
@@ -96,50 +121,101 @@
         return null;
     }
 
-    static class LessThanRule extends AbstractRule {
+    /**
+     * Rule returning true if event level less than specified level.
+     */
+    private static final class LessThanRule extends AbstractRule {
+        /**
+         * Comparison level.
+         */
         private final int newLevelInt;
 
-        public LessThanRule(Level level) {
+        /**
+         * Create new instance.
+         * @param level comparison level.
+         */
+        public LessThanRule(final Level level) {
+            super();
             newLevelInt = level.toInt();
         }
 
-        public boolean evaluate(LoggingEvent event) {
+        /** {@inheritDoc} */
+        public boolean evaluate(final LoggingEvent event) {
             return (event.getLevel().toInt() < newLevelInt);
         }
     }
 
-    static class GreaterThanRule extends AbstractRule {
+    /**
+     * Rule returning true if event level greater than specified level.
+     */
+    private static final class GreaterThanRule extends AbstractRule {
+        /**
+         * Comparison level.
+         */
         private final int newLevelInt;
 
-        public GreaterThanRule(Level level) {
+        /**
+         * Create new instance.
+         * @param level comparison level.
+         */
+        public GreaterThanRule(final Level level) {
+            super();
             newLevelInt = level.toInt();
         }
 
-        public boolean evaluate(LoggingEvent event) {
+        /** {@inheritDoc} */
+        public boolean evaluate(final LoggingEvent event) {
             return (event.getLevel().toInt() > newLevelInt);
         }
     }
 
-    static class GreaterThanEqualsRule extends AbstractRule {
+    /**
+     * Rule returning true if event level greater than
+     * or equal to specified level.
+     */
+    private static final class GreaterThanEqualsRule extends AbstractRule {
+        /**
+         * Comparison level.
+         */
         private final int newLevelInt;
 
-        public GreaterThanEqualsRule(Level level) {
+        /**
+         * Create new instance.
+         * @param level comparison level.
+         */
+        public GreaterThanEqualsRule(final Level level) {
+            super();
             newLevelInt = level.toInt();
         }
 
-        public boolean evaluate(LoggingEvent event) {
+        /** {@inheritDoc} */
+        public boolean evaluate(final LoggingEvent event) {
             return event.getLevel().toInt() >= newLevelInt;
         }
     }
 
-    static class LessThanEqualsRule extends AbstractRule {
+    /**
+     * Rule returning true if event level less than or
+     * equal to specified level.
+     */
+
+    private static final class LessThanEqualsRule extends AbstractRule {
+        /**
+         * Comparison level.
+         */
         private final int newLevelInt;
 
-        public LessThanEqualsRule(Level level) {
+        /**
+         * Create new instance.
+         * @param level comparison level.
+         */
+        public LessThanEqualsRule(final Level level) {
+            super();
             newLevelInt = level.toInt();
         }
 
-        public boolean evaluate(LoggingEvent event) {
+        /** {@inheritDoc} */
+        public boolean evaluate(final LoggingEvent event) {
             return (event.getLevel().toInt() <= newLevelInt);
         }
     }

Modified: logging/log4j/trunk/src/java/org/apache/log4j/rule/LikeRule.java
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/java/org/apache/log4j/rule/LikeRule.java?view=diff&rev=527771&r1=527770&r2=527771
==============================================================================
--- logging/log4j/trunk/src/java/org/apache/log4j/rule/LikeRule.java (original)
+++ logging/log4j/trunk/src/java/org/apache/log4j/rule/LikeRule.java Wed Apr 11 22:17:12 2007
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -28,84 +28,124 @@
 import org.apache.oro.text.regex.Perl5Matcher;
 
 /**
- * A Rule class providing support for ORO-based regular expression syntax. 
- * 
- * @author Scott Deboy <sdeboy@apache.org>
+ * A Rule class providing support for ORO-based regular expression syntax.
+ *
+ * @author Scott Deboy (sdeboy@apache.org)
  */
 public class LikeRule extends AbstractRule {
+    /**
+     * Serialization ID.
+     */
   static final long serialVersionUID = -3375458885595683156L;
 
-  private static final LoggingEventFieldResolver resolver = LoggingEventFieldResolver.getInstance();
+    /**
+     * Resolver.
+     */
+  private static final LoggingEventFieldResolver RESOLVER =
+            LoggingEventFieldResolver.getInstance();
+    /**
+     * Pattern.
+     */
   private transient Pattern pattern;
+    /**
+     * Regular expression matcher.
+     */
   private transient Perl5Matcher matcher = new Perl5Matcher();
+    /**
+     * Field.
+     */
   private transient String field;
 
-  private LikeRule(String field, Pattern pattern) {
-    if (!resolver.isField(field)) {
-        throw new IllegalArgumentException("Invalid LIKE rule - " + field + " is not a supported field");
+    /**
+     * Create new instance.
+     * @param field field
+     * @param pattern pattern
+     */
+  private LikeRule(final String field, final Pattern pattern) {
+    super();
+    if (!RESOLVER.isField(field)) {
+        throw new IllegalArgumentException(
+                "Invalid LIKE rule - " + field + " is not a supported field");
     }
-    
+
     this.field = field;
     this.pattern = pattern;
   }
 
-  public static Rule getRule(Stack stack) {
+    /**
+     * Create new instance from top two elements of stack.
+     * @param stack stack
+     * @return new instance
+     */
+  public static Rule getRule(final Stack stack) {
       if (stack.size() < 2) {
-          throw new IllegalArgumentException("Invalid LIKE rule - expected two parameters but received " + stack.size());
-      }  
-      
+          throw new IllegalArgumentException(
+                  "Invalid LIKE rule - expected two parameters but received "
+                          + stack.size());
+      }
+
       String p2 = stack.pop().toString();
       String p1 = stack.pop().toString();
       return getRule(p1, p2);
   }
 
-  public static Rule getRule(String field, String pattern) {
+    /**
+     * Create new instance.
+     * @param field field
+     * @param pattern pattern
+     * @return new instance
+     */
+  public static Rule getRule(final String field, final String pattern) {
     Perl5Compiler compiler = new Perl5Compiler();
     Pattern pattern1 = null;
 
     try {
       pattern1 = compiler.compile(pattern, Perl5Compiler.CASE_INSENSITIVE_MASK);
     } catch (MalformedPatternException e) {
-        throw new IllegalArgumentException("Invalid LIKE rule - " + e.getMessage());
+        throw new IllegalArgumentException(
+                "Invalid LIKE rule - " + e.getMessage());
     }
 
     return new LikeRule(field, pattern1);
   }
 
-  public boolean evaluate(LoggingEvent event) {
-    Object input = resolver.getValue(field, event);
-    return ((input != null) && (pattern != null) && (matcher.matches(input.toString(), pattern)));
+    /** {@inheritDoc} */
+  public boolean evaluate(final LoggingEvent event) {
+    Object input = RESOLVER.getValue(field, event);
+    return ((input != null) && (pattern != null)
+            && (matcher.matches(input.toString(), pattern)));
   }
-  
+
   /**
-    * Deserialize the state of the object
+    * Deserialize the state of the object.
     *
-    * @param in 
+    * @param in object input stream
     *
-    * @throws IOException 
-    * @throws ClassNotFoundException 
+    * @throws IOException if IOException during deserialization
+    * @throws ClassNotFoundException if class not found.
     */
-   private void readObject(java.io.ObjectInputStream in)
+   private void readObject(final java.io.ObjectInputStream in)
      throws IOException, ClassNotFoundException {
          try {
-           field = (String)in.readObject();
-           String patternString = (String)in.readObject();
+           field = (String) in.readObject();
+           String patternString = (String) in.readObject();
            Perl5Compiler compiler = new Perl5Compiler();
            matcher = new Perl5Matcher();
-           pattern = compiler.compile(patternString, Perl5Compiler.CASE_INSENSITIVE_MASK);
+           pattern = compiler.compile(patternString,
+                   Perl5Compiler.CASE_INSENSITIVE_MASK);
          } catch (MalformedPatternException e) {
              throw new IOException("Invalid LIKE rule - " + e.getMessage());
          }
    }
 
    /**
-    * Serialize the state of the object
+    * Serialize the state of the object.
     *
-    * @param out 
+    * @param out object output stream
     *
-    * @throws IOException 
+    * @throws IOException if IOException during serialization
     */
-   private void writeObject(java.io.ObjectOutputStream out)
+   private void writeObject(final java.io.ObjectOutputStream out)
      throws IOException {
      out.writeObject(field);
      out.writeObject(pattern.getPattern());

Modified: logging/log4j/trunk/src/java/org/apache/log4j/rule/NotEqualsRule.java
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/java/org/apache/log4j/rule/NotEqualsRule.java?view=diff&rev=527771&r1=527770&r2=527771
==============================================================================
--- logging/log4j/trunk/src/java/org/apache/log4j/rule/NotEqualsRule.java (original)
+++ logging/log4j/trunk/src/java/org/apache/log4j/rule/NotEqualsRule.java Wed Apr 11 22:17:12 2007
@@ -26,17 +26,35 @@
 /**
  * A Rule class implementing not equals against two strings.
  *
- * @author Scott Deboy <sdeboy@apache.org>
+ * @author Scott Deboy (sdeboy@apache.org)
  */
 public class NotEqualsRule extends AbstractRule {
+    /**
+     * Serialization ID.
+     */
   static final long serialVersionUID = -1135478467213793211L;
-  private static final LoggingEventFieldResolver resolver =
+    /**
+     * Resolver.
+     */
+  private static final LoggingEventFieldResolver RESOLVER =
     LoggingEventFieldResolver.getInstance();
+    /**
+     * Field.
+     */
   private final String field;
+    /**
+     * Value.
+     */
   private final String value;
 
-  private NotEqualsRule(String field, String value) {
-    if (!resolver.isField(field)) {
+    /**
+     * Create new instance.
+     * @param field field
+     * @param value value
+     */
+  private NotEqualsRule(final String field, final String value) {
+    super();
+    if (!RESOLVER.isField(field)) {
       throw new IllegalArgumentException(
         "Invalid NOT EQUALS rule - " + field + " is not a supported field");
     }
@@ -45,11 +63,22 @@
     this.value = value;
   }
 
-  public static Rule getRule(String field, String value) {
+    /**
+     * Get new instance.
+     * @param field field
+     * @param value value
+     * @return new instance.
+     */
+  public static Rule getRule(final String field, final String value) {
     return new NotEqualsRule(field, value);
   }
 
-  public static Rule getRule(Stack stack) {
+    /**
+     * Get new instance from top two elements of stack.
+     * @param stack stack.
+     * @return new instance.
+     */
+  public static Rule getRule(final Stack stack) {
     if (stack.size() < 2) {
       throw new IllegalArgumentException(
         "Invalid NOT EQUALS rule - expected two parameters but received "
@@ -62,8 +91,9 @@
     return new NotEqualsRule(p1, p2);
   }
 
-  public boolean evaluate(LoggingEvent event) {
-    Object p2 = resolver.getValue(field, event);
+    /** {@inheritDoc} */
+  public boolean evaluate(final LoggingEvent event) {
+    Object p2 = RESOLVER.getValue(field, event);
 
     return ((p2 != null) && !(p2.toString().equals(value)));
   }

Modified: logging/log4j/trunk/src/java/org/apache/log4j/rule/NotRule.java
URL: http://svn.apache.org/viewvc/logging/log4j/trunk/src/java/org/apache/log4j/rule/NotRule.java?view=diff&rev=527771&r1=527770&r2=527771
==============================================================================
--- logging/log4j/trunk/src/java/org/apache/log4j/rule/NotRule.java (original)
+++ logging/log4j/trunk/src/java/org/apache/log4j/rule/NotRule.java Wed Apr 11 22:17:12 2007
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,35 +22,60 @@
 import java.util.Stack;
 
 /**
- * A Rule class implementing logical not. 
- * 
- * @author Scott Deboy <sdeboy@apache.org>
+ * A Rule class implementing logical not.
+ *
+ * @author Scott Deboy (sdeboy@apache.org)
  */
 public class NotRule extends AbstractRule {
-  static final long serialVersionUID = -6827159473117969306L;    
+    /**
+     * Serialization ID.
+     */
+  static final long serialVersionUID = -6827159473117969306L;
+    /**
+     * Enclosed rule.
+     */
   private final Rule rule;
 
-  private NotRule(Rule rule) {
+    /**
+     * Create new instance.
+     * @param rule enclosed rule.
+     */
+  private NotRule(final Rule rule) {
+    super();
     this.rule = rule;
   }
 
-  public static Rule getRule(Rule rule) {
+    /**
+     * Create new instance.
+     * @param rule enclosed rule.
+     * @return new rule.
+     */
+  public static Rule getRule(final Rule rule) {
       return new NotRule(rule);
   }
-  
-  public static Rule getRule(Stack stack) {
+
+    /**
+     * Create new instance from top element of stack.
+     * @param stack stack
+     * @return new rule.
+     */
+  public static Rule getRule(final Stack stack) {
       if (stack.size() < 1) {
-          throw new IllegalArgumentException("Invalid NOT rule - expected one rule but received " + stack.size());
-      }  
+          throw new IllegalArgumentException(
+                  "Invalid NOT rule - expected one rule but received "
+                          + stack.size());
+      }
       Object o1 = stack.pop();
       if (o1 instanceof Rule) {
-        Rule p1 = (Rule)o1;
+        Rule p1 = (Rule) o1;
         return new NotRule(p1);
       }
-      throw new IllegalArgumentException("Invalid NOT rule: - expected rule but received " + o1);
+      throw new IllegalArgumentException(
+              "Invalid NOT rule: - expected rule but received " + o1);
   }
 
-  public boolean evaluate(LoggingEvent event) {
+    /** {@inheritDoc} */
+  public boolean evaluate(final LoggingEvent event) {
     return !(rule.evaluate(event));
   }
 }



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