You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by sd...@apache.org on 2004/01/16 09:02:11 UTC

cvs commit: logging-log4j/src/java/org/apache/log4j/spi LoggingEventFieldResolver.java

sdeboy      2004/01/16 00:02:11

  Modified:    src/java/org/apache/log4j/chainsaw
                        ChainsawCyclicBufferTableModel.java
                        LoggerNameTreePanel.java
               src/java/org/apache/log4j/spi LoggingEventFieldResolver.java
  Log:
  Added null checks
  changed loggingeventfieldresolver's getvalue method to throw illegalargumentexception if keyword doesn't exist
  Logging the evaluate exception in cyclicbuffer's reFilter method
  
  Revision  Changes    Path
  1.20      +13 -11    logging-log4j/src/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java
  
  Index: ChainsawCyclicBufferTableModel.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/ChainsawCyclicBufferTableModel.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- ChainsawCyclicBufferTableModel.java	15 Jan 2004 07:04:50 -0000	1.19
  +++ ChainsawCyclicBufferTableModel.java	16 Jan 2004 08:02:11 -0000	1.20
  @@ -134,18 +134,20 @@
     }
     
     private void reFilter() {
  -    synchronized(unfilteredList) {
  -      filteredList.clear();
  -      Iterator iter = unfilteredList.iterator();
  -      while (iter.hasNext()) {
  -          LoggingEvent e = (LoggingEvent)iter.next();
  -          if ((displayRule == null) || (displayRule.evaluate(e))) {
  -              filteredList.add(e);
  +    try {
  +        synchronized(unfilteredList) {
  +          filteredList.clear();
  +          Iterator iter = unfilteredList.iterator();
  +          while (iter.hasNext()) {
  +              LoggingEvent e = (LoggingEvent)iter.next();
  +              if ((displayRule == null) || (displayRule.evaluate(e))) {
  +                  filteredList.add(e);
  +              }
             }
  -      }
  -      fireTableDataChanged();
  -      notifyCountListeners();
  -    }
  +          fireTableDataChanged();
  +          notifyCountListeners();
  +        }
  +    } catch (IllegalArgumentException iae) {LogLog.warn("invalid expression", iae);}
     }
     
     /**
  
  
  
  1.23      +2 -2      logging-log4j/src/java/org/apache/log4j/chainsaw/LoggerNameTreePanel.java
  
  Index: LoggerNameTreePanel.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/LoggerNameTreePanel.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- LoggerNameTreePanel.java	17 Dec 2003 06:12:48 -0000	1.22
  +++ LoggerNameTreePanel.java	16 Jan 2004 08:02:11 -0000	1.23
  @@ -1022,7 +1022,7 @@
                   {
                     result =
                     result
  -                    && e.getLoggerName().startsWith(
  +                    && e.getLoggerName() != null && e.getLoggerName().startsWith(
                         currentlySelectedLoggerName);
                   }
   
  
  
  
  1.3       +1 -1      logging-log4j/src/java/org/apache/log4j/spi/LoggingEventFieldResolver.java
  
  Index: LoggingEventFieldResolver.java
  ===================================================================
  RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/spi/LoggingEventFieldResolver.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- LoggingEventFieldResolver.java	15 Jan 2004 07:04:51 -0000	1.2
  +++ LoggingEventFieldResolver.java	16 Jan 2004 08:02:11 -0000	1.3
  @@ -195,7 +195,7 @@
       }
   
       //there wasn't a match, so throw a runtime exception
  -    throw new RuntimeException("Unsupported field name: " + fieldName);
  +    throw new IllegalArgumentException("Unsupported field name: " + fieldName);
     }
   
       private String getExceptionMessage(String[] exception) {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org