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 j k <jk...@dalim.com> on 2003/02/13 18:50:30 UTC

lf5 bug ?? and it's correction ?

I think I found a bug in lf5 (log4j 1.2.7):
(tried to file the bug in Bugzilla....well...really cumbersome, diddn't
succeed)

in file FilteredLogTableModel.java:

 public synchronized boolean addLogRecord(LogRecord record) {

   _allRecords.add(record);

   if (_filter.passes(record) == false) {
     return false;
   }
 
   getFilteredRecords().add(record);
 >>>>>>> BUGGG: args should be first and last index, i.e. "getRowCount()
- 1"                      
fireTableRowsInserted(getRowCount(),getRowCount());
 >>>>>>>
   trimRecords();
   return true;
 }

maybe this will eliminate following problem ??:

 protected LogRecord getFilteredRecord(int row) {
   List records = getFilteredRecords();
   int size = records.size();
   if (row < size) {
     return (LogRecord) records.get(row);
   }
   // a minor problem has happened. JTable has asked for
   // a row outside the bounds, because the size of
   // _filteredRecords has changed while it was looping.
   // return the last row.
 >>>>> I inserted an exception throw to see if....
   throw new IllegalArgumentException("still the bugg ??");
   //return (LogRecord) records.get(size - 1);
}

than I had an other bug also, (revealed by the correction of the first
one ?)

in addLogRecord(LogRecord record), if record passes the filter, the
following call

getFilteredRecords().add(record);

will add the record twice in case of _filteredRecords == null
(I have this just after loading a log file)

first,  getFilteredRecords() will call refresh() who will remake
_filteredRecords
from _allRecords and since the record has already been put in 
_allRecords it
will also be in _filteredRecords
than add() will add it again......







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