Changeset 296


Ignore:
Timestamp:
12/13/11 11:08:44 (12 years ago)
Author:
sherbold
Message:
  • added null-checks to remove useless information from the logs, e.g., widget names that are "null"
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JFCMonitor/src/de/ugoe/cs/eventbench/jfcmonitor/JFCListener.java

    r277 r296  
    4444         * Writes all received {@link MouseEvent}s and {@link KeyEvent}s to the 
    4545         * {@link #outputWriter}. 
     46         * </p> 
    4647         *  
    4748         * @see java.awt.event.AWTEventListener#eventDispatched(java.awt.AWTEvent) 
     
    133134                                        String text = (String) method.invoke(component, 
    134135                                                        new Object[] {}); 
    135                                         builder.append("  <param name=\"getText\" value=\"" + text + "\" />" + ENDLINE); 
     136                                        if( text!=null ) { 
     137                                                builder.append("  <param name=\"getText\" value=\"" + text + "\" />" + ENDLINE); 
     138                                        } 
    136139                                } 
    137140                                if (method.getName() == "getTitle") { 
    138141                                        String title = (String) method.invoke(component, 
    139142                                                        new Object[] {}); 
    140                                         builder.append("  <param name=\"getTitle\" value=\"" + title + "\" />" + ENDLINE); 
     143                                        if( title!=null ) { 
     144                                                builder.append("  <param name=\"getTitle\" value=\"" + title + "\" />" + ENDLINE); 
     145                                        } 
    141146                                } 
    142147                        } catch (IllegalArgumentException e) { 
    143148                        } catch (IllegalAccessException e) { 
    144149                        } catch (InvocationTargetException e) { 
     150                                System.err.println("Found method with name " + method.getName() + " but could not access it."); 
    145151                        } 
    146152                } 
Note: See TracChangeset for help on using the changeset viewer.