Changeset 10886 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2016-08-24T00:18:37+02:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/tools/bugreport
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/bugreport/BugReport.java
r10745 r10886 123 123 PrintWriter out = new PrintWriter(stringWriter); 124 124 if (isIncludeStatusReport()) { 125 out.println(ShowStatusReportAction.getReportHeader()); 125 try { 126 out.println(ShowStatusReportAction.getReportHeader()); 127 } catch (RuntimeException e) { 128 out.println("Could not generate status report: " + e.getMessage()); 129 } 126 130 } 127 131 if (isIncludeData()) { -
trunk/src/org/openstreetmap/josm/tools/bugreport/BugReportQueue.java
r10819 r10886 5 5 import java.util.ArrayList; 6 6 import java.util.LinkedList; 7 import java.util.concurrent.CopyOnWriteArrayList; 7 8 import java.util.function.BiFunction; 9 import java.util.function.Predicate; 8 10 9 11 import org.openstreetmap.josm.Main; … … 23 25 private Thread displayThread; 24 26 private final BiFunction<ReportedException, Integer, SuppressionMode> bugReportHandler = getBestHandler(); 27 private final CopyOnWriteArrayList<Predicate<ReportedException>> handlers = new CopyOnWriteArrayList<>(); 25 28 private int displayedErrors; 26 29 … … 97 100 98 101 private SuppressionMode displayFor(ReportedException e) { 102 if (handlers.stream().anyMatch(p -> p.test(e))) { 103 Main.trace("Intercepted by handler."); 104 return SuppressionMode.NONE; 105 } 99 106 return bugReportHandler.apply(e, getDisplayedErrors()); 100 107 } … … 123 130 } 124 131 132 /** 133 * Allows you to peek or even intersect the bug reports. 134 * @param handler The handler. It can return false to stop all further handling of the exception. 135 * @since 10886 136 */ 137 public void addBugReportHandler(Predicate<ReportedException> handler) { 138 handlers.add(handler); 139 } 140 141 /** 142 * Gets the global bug report queue 143 * @return The queue 144 * @since 10886 145 */ 125 146 public static BugReportQueue getInstance() { 126 147 return INSTANCE;
Note:
See TracChangeset
for help on using the changeset viewer.