- Timestamp:
- 2020-06-19T20:36:25+02:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/command/SequenceCommand.java
r16573 r16681 8 8 import java.util.HashSet; 9 9 import java.util.Objects; 10 import java.util.stream.Collectors; 11 import java.util.stream.Stream; 10 12 11 13 import javax.swing.Icon; … … 15 17 import org.openstreetmap.josm.tools.ImageProvider; 16 18 import org.openstreetmap.josm.tools.Utils; 19 import org.openstreetmap.josm.tools.bugreport.ReportedException; 17 20 18 21 /** … … 105 108 @Override public boolean executeCommand() { 106 109 for (int i = 0; i < sequence.length; i++) { 107 boolean result = sequence[i].executeCommand(); 110 boolean result; 111 try { 112 result = sequence[i].executeCommand(); 113 } catch (AssertionError | Exception e) { 114 throw createReportedException(e, i); 115 } 108 116 if (!result && !continueOnError) { 109 117 undoCommands(i-1); … … 127 135 protected final void undoCommands(int start) { 128 136 for (int i = start; i >= 0; --i) { 129 sequence[i].undoCommand(); 130 } 137 try { 138 sequence[i].undoCommand(); 139 } catch (AssertionError | Exception e) { 140 throw createReportedException(e, i); 141 } 142 } 143 } 144 145 private ReportedException createReportedException(Throwable e, int i) { 146 ReportedException exception = new ReportedException(e); 147 exception.startSection("sequence_information"); 148 exception.put("sequence_name", getDescriptionText()); 149 exception.put("sequence_command", sequence[i].getDescriptionText()); 150 exception.put("sequence_index", i); 151 exception.put("sequence_commands", Stream.of(sequence) 152 .map(o -> o.getClass().getCanonicalName()) 153 .map(String::valueOf) 154 .collect(Collectors.joining(";", "[", "]"))); 155 exception.put("sequence_commands_descriptions", Stream.of(sequence) 156 .map(Command::getDescriptionText) 157 .collect(Collectors.joining(";", "[", "]"))); 158 return exception; 131 159 } 132 160
Note:
See TracChangeset
for help on using the changeset viewer.