Changeset 347 for trunk/JFCMonitor/src/de/ugoe/cs/eventbench
- Timestamp:
- 01/05/12 15:42:48 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JFCMonitor/src/de/ugoe/cs/eventbench/jfcmonitor/JFCListener.java
r303 r347 10 10 import java.lang.reflect.InvocationTargetException; 11 11 import java.lang.reflect.Method; 12 13 import de.ugoe.cs.util.StringTools; 12 14 13 15 /** … … 39 41 this.outputWriter = outputWriter; 40 42 try { 41 outputWriter.write("<?xml version=\"1.0\" encoding=\"UTF-16\"?>" + ENDLINE); 43 outputWriter.write("<?xml version=\"1.0\" encoding=\"UTF-16\"?>" 44 + ENDLINE); 42 45 outputWriter.write("<sessions>" + ENDLINE); 43 46 } catch (IOException e) { … … 111 114 builder.append(" <source>" + ENDLINE); 112 115 builder.append(" <param name=\"toString\" value=\"" 113 + event.getSource().toString() + "\" />" + ENDLINE); 116 + StringTools 117 .xmlEntityReplacement(event.getSource().toString()) 118 + "\" />" + ENDLINE); 114 119 if (event.getSource() instanceof Component) { 115 120 Component source = (Component) event.getSource(); … … 135 140 private void addComponentInfo(StringBuilder builder, Component component) { 136 141 builder.append(" <param name=\"getName\" value=\"" 137 + component.getName() + "\" />" + ENDLINE); 142 + StringTools.xmlEntityReplacement(component.getName()) 143 + "\" />" + ENDLINE); 138 144 for (Method method : component.getClass().getMethods()) { 139 145 try { … … 141 147 String text = (String) method.invoke(component, 142 148 new Object[] {}); 143 if( text!=null ) { 144 builder.append(" <param name=\"getText\" value=\"" + text + "\" />" + ENDLINE); 149 if (text != null) { 150 builder.append(" <param name=\"getText\" value=\"" 151 + StringTools.xmlEntityReplacement(text) 152 + "\" />" + ENDLINE); 145 153 } 146 154 } … … 148 156 String title = (String) method.invoke(component, 149 157 new Object[] {}); 150 if( title!=null ) { 151 builder.append(" <param name=\"getTitle\" value=\"" + title + "\" />" + ENDLINE); 158 if (title != null) { 159 builder.append(" <param name=\"getTitle\" value=\"" 160 + StringTools.xmlEntityReplacement(title) 161 + "\" />" + ENDLINE); 152 162 } 153 163 } … … 155 165 } catch (IllegalAccessException e) { 156 166 } catch (InvocationTargetException e) { 157 System.err.println("Found method with name " + method.getName() + " but could not access it."); 167 System.err.println("Found method with name " + method.getName() 168 + " but could not access it."); 158 169 } 159 170 }
Note: See TracChangeset
for help on using the changeset viewer.