sdeboy      2003/06/17 10:26:56

  Modified:    src/java/org/apache/log4j/chainsaw LogUI.java
  Log:
  cleaned up column loading process (preventing stack trace for eof)
  
  Revision  Changes    Path
  1.101     +5 -6      
jakarta-log4j-sandbox/src/java/org/apache/log4j/chainsaw/LogUI.java
  
  Index: LogUI.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-log4j-sandbox/src/java/org/apache/log4j/chainsaw/LogUI.java,v
  retrieving revision 1.100
  retrieving revision 1.101
  diff -u -r1.100 -r1.101
  --- LogUI.java        17 Jun 2003 16:33:56 -0000      1.100
  +++ LogUI.java        17 Jun 2003 17:26:56 -0000      1.101
  @@ -87,6 +87,7 @@
   
   import java.io.BufferedInputStream;
   import java.io.BufferedOutputStream;
  +import java.io.EOFException;
   import java.io.File;
   import java.io.FileInputStream;
   import java.io.FileNotFoundException;
  @@ -1980,10 +1981,8 @@
               tc.setHeaderValue(temp.getColName());
               newColumns.add(tc);
             }
  -        } catch (IOException ioe) {
  -            //may generate an EOFException if save process created file but 
  -            //the file is zero length..won't remove columns in that case
  -            ioe.printStackTrace();
  +        } catch (EOFException eof) {//end of file - ignore..
  +        } catch (IOException ioe) {ioe.printStackTrace();
           } catch (ClassNotFoundException cnfe) {cnfe.printStackTrace();
           } finally {
             if (s != null) {
  @@ -1993,6 +1992,8 @@
               }
             }
           }
  +        //only remove columns and add serialized columns if 
  +        //at least one column was read from the file
           if (newColumns.size() > 0) {
             //remove columns from model - will be re-added in the correct order
             for (int i = model.getColumnCount() - 1; i > -1; i--) {
  @@ -2002,8 +2003,6 @@
               model.addColumn((TableColumn)iter.next());
             }
           }
  -      } else {
  -        //error..shouldn't occur
         }
       }
     }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to