Changeset 7420 in josm
- Timestamp:
- 2014-08-16T14:10:24+02:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r7402 r7420 23 23 import java.util.Arrays; 24 24 import java.util.Collection; 25 import java.util.Collections; 25 26 import java.util.HashMap; 26 27 import java.util.Iterator; … … 76 77 import org.openstreetmap.josm.gui.help.HelpUtil; 77 78 import org.openstreetmap.josm.gui.io.SaveLayersDialog; 79 import org.openstreetmap.josm.gui.layer.AbstractModifiableLayer; 78 80 import org.openstreetmap.josm.gui.layer.Layer; 79 import org.openstreetmap.josm.gui.layer.AbstractModifiableLayer;80 81 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 81 82 import org.openstreetmap.josm.gui.layer.OsmDataLayer.CommandQueueListener; … … 215 216 protected static final Map<String, Throwable> NETWORK_ERRORS = new HashMap<>(); 216 217 218 // First lines of last 10 error and warning messages, used for bug reports 219 private static final List<String> ERRORS_AND_WARNINGS = Collections.<String>synchronizedList(new ArrayList<String>()); 220 217 221 /** 218 222 * Logging level (5 = trace, 4 = debug, 3 = info, 2 = warn, 1 = error, 0 = none). … … 220 224 */ 221 225 public static int logLevel = 3; 226 227 private static void rememberWarnErrorMsg(String msg) { 228 // Only remember first line of message 229 int idx = msg.indexOf('\n'); 230 if (idx > 0) { 231 ERRORS_AND_WARNINGS.add(msg.substring(0, idx)); 232 } else { 233 ERRORS_AND_WARNINGS.add(msg); 234 } 235 // Only keep 10 lines to avoid memory leak 236 while (ERRORS_AND_WARNINGS.size() > 10) { 237 ERRORS_AND_WARNINGS.remove(0); 238 } 239 } 240 241 /** 242 * Replies the first lines of last 10 error and warning messages, used for bug reports 243 * @return the first lines of last 10 error and warning messages 244 * @since 7420 245 */ 246 public static final Collection<String> getLastErrorAndWarnings() { 247 return Collections.unmodifiableList(ERRORS_AND_WARNINGS); 248 } 222 249 223 250 /** … … 231 258 if (msg != null && !msg.isEmpty()) { 232 259 System.err.println(tr("ERROR: {0}", msg)); 260 rememberWarnErrorMsg("E: "+msg); 233 261 } 234 262 } … … 243 271 if (msg != null && !msg.isEmpty()) { 244 272 System.err.println(tr("WARNING: {0}", msg)); 273 rememberWarnErrorMsg("W: "+msg); 245 274 } 246 275 } -
trunk/src/org/openstreetmap/josm/actions/ShowStatusReportAction.java
r7335 r7420 11 11 import java.util.ArrayList; 12 12 import java.util.Arrays; 13 import java.util.Collection; 13 14 import java.util.HashSet; 14 15 import java.util.List; … … 121 122 shortenParam(it, param, propJavaHome, propJavaHomeAlt); 122 123 } 124 } else if (value.startsWith("-X")) { 125 // Remove arguments like -Xbootclasspath/a, -Xverify:remote, that can be very long and unhelpful 126 it.remove(); 123 127 } 124 128 } … … 148 152 text.append(PluginHandler.getBugReportText()); 149 153 text.append("\n"); 154 155 Collection<String> errorsWarnings = Main.getLastErrorAndWarnings(); 156 if (!errorsWarnings.isEmpty()) { 157 text.append("Last errors/warnings:\n"); 158 for (String s : errorsWarnings) { 159 text.append("- ").append(s).append("\n"); 160 } 161 text.append("\n"); 162 } 150 163 151 164 return text.toString(); -
trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
r7348 r7420 1271 1271 } 1272 1272 Collections.sort(pl); 1273 if (!pl.isEmpty()) { 1274 text.append("Plugins:\n"); 1275 } 1273 1276 for (String s : pl) { 1274 text.append(" Plugin:").append(s).append("\n");1277 text.append("- ").append(s).append("\n"); 1275 1278 } 1276 1279 return text.toString();
Note:
See TracChangeset
for help on using the changeset viewer.