Changeset 11746 in josm
- Timestamp:
- 2017-03-19T02:26:34+01:00 (8 years ago)
- Location:
- trunk
- Files:
-
- 58 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java
r11731 r11746 1127 1127 findBoundaryPolygonsStartingWith(discardedResult, traverser, result, startWay); 1128 1128 } 1129 } catch ( Throwablet) {1129 } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException t) { 1130 1130 throw BugReport.intercept(t).put("traverser", traverser); 1131 1131 } … … 1183 1183 } 1184 1184 } 1185 } catch ( Throwablet) {1185 } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException t) { 1186 1186 throw BugReport.intercept(t).put("path", path); 1187 1187 } -
trunk/src/org/openstreetmap/josm/actions/SessionLoadAction.java
r11645 r11746 31 31 import org.openstreetmap.josm.io.session.SessionReader; 32 32 import org.openstreetmap.josm.tools.CheckParameterUtil; 33 import org.openstreetmap.josm.tools.JosmRuntimeException; 33 34 import org.openstreetmap.josm.tools.Utils; 34 35 … … 178 179 } catch (IOException e) { 179 180 handleException(tr("IO Error"), e); 180 } catch ( RuntimeException e) {181 } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException e) { 181 182 cancel(); 182 183 throw e; -
trunk/src/org/openstreetmap/josm/actions/ShowStatusReportAction.java
r11650 r11746 269 269 String reportHeader = getReportHeader(); 270 270 text.append(reportHeader); 271 try { 272 Map<String, Setting<?>> settings = Main.pref.getAllSettings(); 273 Set<String> keys = new HashSet<>(settings.keySet()); 274 for (String key : keys) { 275 // Remove sensitive information from status report 276 if (key.startsWith("marker.show") || key.contains("username") || key.contains("password") || key.contains("access-token")) { 277 settings.remove(key); 278 } 279 } 280 for (Entry<String, Setting<?>> entry : settings.entrySet()) { 281 text.append(paramCleanup(entry.getKey())) 282 .append('=') 283 .append(paramCleanup(entry.getValue().getValue().toString())).append('\n'); 284 } 285 } catch (Exception ex) { 286 Main.error(ex); 271 Map<String, Setting<?>> settings = Main.pref.getAllSettings(); 272 Set<String> keys = new HashSet<>(settings.keySet()); 273 for (String key : keys) { 274 // Remove sensitive information from status report 275 if (key.startsWith("marker.show") || key.contains("username") || key.contains("password") || key.contains("access-token")) { 276 settings.remove(key); 277 } 278 } 279 for (Entry<String, Setting<?>> entry : settings.entrySet()) { 280 text.append(paramCleanup(entry.getKey())) 281 .append('=') 282 .append(paramCleanup(entry.getValue().getValue().toString())).append('\n'); 287 283 } 288 284 -
trunk/src/org/openstreetmap/josm/actions/audio/AudioBackAction.java
r6380 r11746 8 8 import java.awt.event.ActionEvent; 9 9 import java.awt.event.KeyEvent; 10 import java.io.IOException; 10 11 11 12 import org.openstreetmap.josm.Main; … … 38 39 else 39 40 MarkerLayer.playAudio(); 40 } catch (Exception ex) { 41 } catch (IOException | InterruptedException ex) { 41 42 AudioPlayer.audioMalfunction(ex); 42 43 } -
trunk/src/org/openstreetmap/josm/actions/audio/AudioFastSlowAction.java
r8444 r11746 3 3 4 4 import java.awt.event.ActionEvent; 5 import java.io.IOException; 5 6 6 7 import org.openstreetmap.josm.Main; … … 41 42 if (AudioPlayer.playing() || AudioPlayer.paused()) 42 43 AudioPlayer.play(AudioPlayer.url(), AudioPlayer.position(), speed * multiplier); 43 } catch (Exception ex) { 44 } catch (IOException | InterruptedException ex) { 44 45 AudioPlayer.audioMalfunction(ex); 45 46 } -
trunk/src/org/openstreetmap/josm/actions/audio/AudioFwdAction.java
r6380 r11746 7 7 import java.awt.event.ActionEvent; 8 8 import java.awt.event.KeyEvent; 9 import java.io.IOException; 9 10 10 11 import org.openstreetmap.josm.Main; … … 36 37 else 37 38 MarkerLayer.playAudio(); 38 } catch (Exception ex) { 39 } catch (IOException | InterruptedException ex) { 39 40 AudioPlayer.audioMalfunction(ex); 40 41 } -
trunk/src/org/openstreetmap/josm/actions/audio/AudioPlayPauseAction.java
r11452 r11746 7 7 import java.awt.event.ActionEvent; 8 8 import java.awt.event.KeyEvent; 9 import java.io.IOException; 9 10 import java.net.URL; 10 11 … … 53 54 } 54 55 } 55 } catch (Exception ex) { 56 } catch (IOException | InterruptedException ex) { 56 57 AudioPlayer.audioMalfunction(ex); 57 58 } -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmChangeTask.java
r10463 r11746 11 11 import java.util.Map.Entry; 12 12 import java.util.concurrent.Future; 13 import java.util.concurrent.RejectedExecutionException; 13 14 import java.util.regex.Matcher; 14 15 import java.util.regex.Pattern; … … 115 116 // Let's load all required history 116 117 Main.worker.submit(new HistoryLoaderAndListener(toLoad)); 117 } catch (Exception e) { 118 } catch (RejectedExecutionException e) { 118 119 rememberException(e); 119 120 setFailed(true); -
trunk/src/org/openstreetmap/josm/data/AutosaveTask.java
r11288 r11746 233 233 GuiHelper.runInEDT(this::displayNotification); 234 234 } 235 } catch (RuntimeException t) { 235 } catch (RuntimeException t) { // NOPMD 236 236 // Don't let exception stop time thread 237 237 Main.error("Autosave failed:"); -
trunk/src/org/openstreetmap/josm/data/Preferences.java
r11728 r11746 1420 1420 Utils.setObjectsAccessible(field); 1421 1421 field.set(null, ResourceBundle.getBundle("sun.awt.resources.awt")); 1422 } catch (ReflectiveOperationException | RuntimeException e) { 1422 } catch (ReflectiveOperationException | RuntimeException e) { // NOPMD 1423 // Catch RuntimeException in order to catch InaccessibleObjectException, new in Java 9 1423 1424 Main.warn(e); 1424 1425 } -
trunk/src/org/openstreetmap/josm/data/cache/JCSCacheManager.java
r11400 r11746 182 182 } catch (IOException e) { 183 183 throw e; 184 } catch (Exception e) { 184 } catch (Exception e) { // NOPMD 185 185 throw new IOException(e); 186 186 } -
trunk/src/org/openstreetmap/josm/data/osm/DatasetConsistencyTest.java
r10627 r11746 9 9 10 10 import org.openstreetmap.josm.Main; 11 import org.openstreetmap.josm.tools.JosmRuntimeException; 11 12 import org.openstreetmap.josm.tools.Utils; 12 13 … … 212 213 } 213 214 214 } catch ( RuntimeException e) {215 } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException e) { 215 216 writer.println("Exception during dataset integrity test:"); 216 217 e.printStackTrace(writer); -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
r11731 r11746 86 86 import org.openstreetmap.josm.tools.Geometry.AreaAndPerimeter; 87 87 import org.openstreetmap.josm.tools.ImageProvider; 88 import org.openstreetmap.josm.tools.JosmRuntimeException; 88 89 import org.openstreetmap.josm.tools.Utils; 89 90 import org.openstreetmap.josm.tools.bugreport.BugReport; … … 1735 1736 } 1736 1737 return output; 1737 } catch ( RuntimeException e) {1738 } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException e) { 1738 1739 throw BugReport.intercept(e).put("input-size", input.size()).put("output-size", output.size()); 1739 1740 } finally { … … 1747 1748 osm.accept(this); 1748 1749 } 1749 } catch ( RuntimeException e) {1750 } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException e) { 1750 1751 throw BugReport.intercept(e).put("osm", osm); 1751 1752 } … … 1855 1856 1856 1857 benchmark.renderDone(); 1857 } catch ( RuntimeException e) {1858 } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException e) { 1858 1859 throw BugReport.intercept(e) 1859 1860 .put("data", data) … … 1870 1871 try { 1871 1872 record.paintPrimitive(paintSettings, this); 1872 } catch ( RuntimeException e) {1873 } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException e) { 1873 1874 throw BugReport.intercept(e).put("record", record); 1874 1875 } -
trunk/src/org/openstreetmap/josm/data/preferences/PreferencesWriter.java
r11553 r11746 88 88 addDefaults(); 89 89 } else { 90 throw new NullPointerException();90 throw new IllegalArgumentException(setting.toString()); 91 91 } 92 92 } … … 105 105 addDefaults(); 106 106 } else { 107 throw new NullPointerException();107 throw new IllegalArgumentException(setting.toString()); 108 108 } 109 109 } … … 126 126 addDefaults(); 127 127 } else { 128 throw new NullPointerException();128 throw new IllegalArgumentException(setting.toString()); 129 129 } 130 130 } … … 147 147 addDefaults(); 148 148 } else { 149 throw new NullPointerException();149 throw new IllegalArgumentException(setting.toString()); 150 150 } 151 151 } -
trunk/src/org/openstreetmap/josm/data/projection/CustomProjection.java
r11553 r11746 32 32 import org.openstreetmap.josm.data.projection.proj.Proj; 33 33 import org.openstreetmap.josm.data.projection.proj.ProjParameters; 34 import org.openstreetmap.josm.tools.JosmRuntimeException; 34 35 import org.openstreetmap.josm.tools.Utils; 35 36 import org.openstreetmap.josm.tools.bugreport.BugReport; … … 831 832 } 832 833 } 833 } catch ( RuntimeException e) {834 } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException e) { 834 835 Main.error(e); 835 836 } -
trunk/src/org/openstreetmap/josm/data/projection/Projections.java
r11642 r11746 338 338 try { 339 339 proj = pc.getProjection(); 340 } catch ( RuntimeException e) {340 } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException e) { 341 341 Main.warn(e, "Unable to get projection "+code+" with "+pc+':'); 342 342 } -
trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java
r11594 r11746 333 333 test.initialize(); 334 334 } 335 } catch (Exception e) { 335 } catch (Exception e) { // NOPMD 336 336 Main.error(e); 337 337 if (!GraphicsEnvironment.isHeadless()) { -
trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java
r11385 r11746 271 271 for (TaggingPresetItem i : p.data) { 272 272 if (i instanceof KeyedItem) { 273 addPresetValue( p,(KeyedItem) i);273 addPresetValue((KeyedItem) i); 274 274 } else if (i instanceof CheckGroup) { 275 275 for (Check c : ((CheckGroup) i).checks) { 276 addPresetValue( p,c);276 addPresetValue(c); 277 277 } 278 278 } … … 282 282 } 283 283 284 private static void addPresetValue( TaggingPreset p,KeyedItem ky) {284 private static void addPresetValue(KeyedItem ky) { 285 285 Collection<String> values = ky.getValues(); 286 286 if (ky.key != null && values != null) { 287 try { 288 presetsValueData.putAll(ky.key, values); 289 harmonizedKeys.put(harmonizeKey(ky.key), ky.key); 290 } catch (NullPointerException e) { 291 Main.error(e, p+": Unable to initialize "+ky+'.'); 292 } 287 presetsValueData.putAll(ky.key, values); 288 harmonizedKeys.put(harmonizeKey(ky.key), ky.key); 293 289 } 294 290 } … … 543 539 544 540 private static String harmonizeKey(String key) { 545 key = key.toLowerCase(Locale.ENGLISH).replace('-', '_').replace(':', '_').replace(' ', '_'); 546 return Utils.strip(key, "-_;:,"); 541 return Utils.strip(key.toLowerCase(Locale.ENGLISH).replace('-', '_').replace(':', '_').replace(' ', '_'), "-_;:,"); 547 542 } 548 543 549 544 private static String harmonizeValue(String value) { 550 value = value.toLowerCase(Locale.ENGLISH).replace('-', '_').replace(' ', '_'); 551 return Utils.strip(value, "-_;:,"); 545 return Utils.strip(value.toLowerCase(Locale.ENGLISH).replace('-', '_').replace(' ', '_'), "-_;:,"); 552 546 } 553 547 -
trunk/src/org/openstreetmap/josm/gui/JosmUserIdentityManager.java
r11739 r11746 20 20 import org.openstreetmap.josm.io.auth.CredentialsManager; 21 21 import org.openstreetmap.josm.tools.CheckParameterUtil; 22 import org.openstreetmap.josm.tools.JosmRuntimeException; 22 23 23 24 /** … … 66 67 try { 67 68 instance.initFromOAuth(); 68 } catch ( RuntimeException e) {69 } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException e) { 69 70 Main.error(e); 70 71 // Fall back to preferences if OAuth identification fails for any reason -
trunk/src/org/openstreetmap/josm/gui/MapStatus.java
r11620 r11746 1078 1078 try { 1079 1079 thread.interrupt(); 1080 } catch ( RuntimeException e) {1080 } catch (SecurityException e) { 1081 1081 Main.error(e); 1082 1082 } -
trunk/src/org/openstreetmap/josm/gui/MapView.java
r11713 r11746 71 71 import org.openstreetmap.josm.gui.layer.markerlayer.PlayHeadMarker; 72 72 import org.openstreetmap.josm.tools.AudioPlayer; 73 import org.openstreetmap.josm.tools.JosmRuntimeException; 73 74 import org.openstreetmap.josm.tools.Shortcut; 74 75 import org.openstreetmap.josm.tools.Utils; … … 354 355 repaint(); 355 356 } 356 } catch ( RuntimeException t) {357 } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException t) { 357 358 throw BugReport.intercept(t).put("layer", e.getAddedLayer()); 358 359 } … … 453 454 painter.paint(paintGraphics); 454 455 g.setPaintMode(); 455 } catch ( RuntimeException t) {456 } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException t) { 456 457 BugReport.intercept(t).put("layer", layer).warn(); 457 458 } … … 467 468 return; 468 469 } 469 } catch ( RuntimeException e) {470 } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException e) { 470 471 BugReport.intercept(e).put("center", this::getCenter).warn(); 471 472 return; … … 537 538 try { 538 539 drawTemporaryLayers(tempG, getLatLonBounds(g.getClipBounds())); 539 } catch ( RuntimeException e) {540 } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException e) { 540 541 BugReport.intercept(e).put("temporaryLayers", temporaryLayers).warn(); 541 542 } … … 544 545 try { 545 546 drawWorldBorders(tempG); 546 } catch ( RuntimeException e) {547 } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException e) { 547 548 // getProjection() needs to be inside lambda to catch errors. 548 549 BugReport.intercept(e).put("bounds", () -> getProjection().getWorldBoundsLatLon()).warn(); … … 593 594 try { 594 595 mvp.paint(tempG, this, box); 595 } catch ( RuntimeException e) {596 } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException e) { 596 597 throw BugReport.intercept(e).put("mvp", mvp); 597 598 } -
trunk/src/org/openstreetmap/josm/gui/MapViewState.java
r11553 r11746 27 27 import org.openstreetmap.josm.tools.CheckParameterUtil; 28 28 import org.openstreetmap.josm.tools.Geometry; 29 import org.openstreetmap.josm.tools.JosmRuntimeException; 29 30 import org.openstreetmap.josm.tools.bugreport.BugReport; 30 31 … … 145 146 try { 146 147 return position.getLocationOnScreen(); 147 } catch ( RuntimeException e) {148 } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException e) { 148 149 throw BugReport.intercept(e).put("position", position).put("parent", position::getParent); 149 150 } … … 197 198 try { 198 199 return getPointFor(node.getEastNorth(getProjection())); 199 } catch ( RuntimeException e) {200 } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException e) { 200 201 throw BugReport.intercept(e).put("node", node); 201 202 } -
trunk/src/org/openstreetmap/josm/gui/PleaseWaitRunnable.java
r10611 r11746 15 15 import org.openstreetmap.josm.io.OsmTransferException; 16 16 import org.openstreetmap.josm.tools.CheckParameterUtil; 17 import org.openstreetmap.josm.tools.JosmRuntimeException; 17 18 import org.openstreetmap.josm.tools.bugreport.BugReportExceptionHandler; 18 19 import org.xml.sax.SAXException; … … 112 113 } 113 114 } 114 } catch (final RuntimeException |115 } catch (final JosmRuntimeException | IllegalArgumentException | IllegalStateException | 115 116 OsmTransferException | IOException | SAXException | InvocationTargetException | InterruptedException e) { 116 117 if (!ignoreException) { -
trunk/src/org/openstreetmap/josm/gui/datatransfer/AbstractStackTransferHandler.java
r10936 r11746 14 14 import org.openstreetmap.josm.gui.datatransfer.importers.AbstractOsmDataPaster; 15 15 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 16 import org.openstreetmap.josm.tools.JosmRuntimeException; 16 17 import org.openstreetmap.josm.tools.bugreport.BugReport; 17 18 … … 58 59 } catch (UnsupportedFlavorException | IOException e) { 59 60 Main.warn(e); 60 } catch ( RuntimeException e) {61 } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException e) { 61 62 BugReport.intercept(e).put("paster", df).put("flavors", support::getDataFlavors).warn(); 62 63 } -
trunk/src/org/openstreetmap/josm/gui/datatransfer/ClipboardUtils.java
r11535 r11746 116 116 Thread.currentThread().interrupt(); 117 117 } 118 } catch (NullPointerException e) { 118 } catch (NullPointerException e) { // NOPMD 119 119 // JDK-6322854: On Linux/X11, NPE can happen for unknown reasons, on all versions of Java 120 120 Main.error(e); -
trunk/src/org/openstreetmap/josm/gui/datatransfer/OsmTransferHandler.java
r11554 r11746 97 97 } catch (IllegalStateException e) { 98 98 Main.debug(e); 99 } catch (NullPointerException e) { 99 } catch (NullPointerException e) { // NOPMD 100 100 // JDK-6322854: On Linux/X11, NPE can happen for unknown reasons, on all versions of Java 101 101 Main.error(e); -
trunk/src/org/openstreetmap/josm/gui/datatransfer/importers/PrimitiveDataPaster.java
r10868 r11746 26 26 import org.openstreetmap.josm.gui.datatransfer.data.PrimitiveTransferData; 27 27 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 28 import org.openstreetmap.josm.tools.JosmRuntimeException; 28 29 import org.openstreetmap.josm.tools.bugreport.BugReport; 29 30 … … 77 78 updateMembers(newIds, data); 78 79 } 79 } catch ( RuntimeException e) {80 } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException e) { 80 81 throw BugReport.intercept(e).put("data", data); 81 82 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/DialogsPanel.java
r11452 r11746 17 17 import org.openstreetmap.josm.tools.CheckParameterUtil; 18 18 import org.openstreetmap.josm.tools.Destroyable; 19 import org.openstreetmap.josm.tools.JosmRuntimeException; 19 20 import org.openstreetmap.josm.tools.bugreport.BugReport; 20 21 … … 325 326 try { 326 327 t.destroy(); 327 } catch ( RuntimeException e) {328 } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException e) { 328 329 throw BugReport.intercept(e).put("dialog", t).put("dialog-class", t.getClass()); 329 330 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetContentPanel.java
r10938 r11746 54 54 import org.openstreetmap.josm.gui.widgets.PopupMenuLauncher; 55 55 import org.openstreetmap.josm.tools.ImageProvider; 56 import org.openstreetmap.josm.tools.JosmRuntimeException; 56 57 import org.openstreetmap.josm.tools.bugreport.BugReportExceptionHandler; 57 58 … … 235 236 GuiHelper.runInEDT(() -> HistoryBrowserDialogManager.getInstance().show(h)); 236 237 } 237 } catch (final RuntimeException e) {238 } catch (final JosmRuntimeException | IllegalArgumentException | IllegalStateException e) { 238 239 GuiHelper.runInEDT(() -> BugReportExceptionHandler.handleException(e)); 239 240 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModel.java
r11684 r11746 46 46 import org.openstreetmap.josm.gui.util.GuiHelper; 47 47 import org.openstreetmap.josm.gui.widgets.OsmPrimitivesTableModel; 48 import org.openstreetmap.josm.tools.JosmRuntimeException; 48 49 import org.openstreetmap.josm.tools.bugreport.BugReport; 49 50 … … 808 809 } 809 810 return connectionType.get(i); 810 } catch ( RuntimeException e) {811 } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException e) { 811 812 throw BugReport.intercept(e).put("i", i).put("members", members).put("relation", relation); 812 813 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/sort/WayConnectionTypeCalculator.java
r11452 r11746 13 13 import org.openstreetmap.josm.data.osm.Way; 14 14 import org.openstreetmap.josm.gui.dialogs.relation.sort.WayConnectionType.Direction; 15 import org.openstreetmap.josm.tools.JosmRuntimeException; 15 16 import org.openstreetmap.josm.tools.bugreport.BugReport; 16 17 … … 44 45 try { 45 46 lastWct = updateLinksFor(con, lastWct, i); 46 } catch ( RuntimeException e) {47 } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException e) { 47 48 int index = i; 48 49 throw BugReport.intercept(e).put("i", i).put("member", () -> members.get(index)).put("con", con); -
trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserDialogManager.java
r11461 r11746 27 27 import org.openstreetmap.josm.gui.layer.LayerManager.LayerOrderChangeEvent; 28 28 import org.openstreetmap.josm.gui.layer.LayerManager.LayerRemoveEvent; 29 import org.openstreetmap.josm.tools.JosmRuntimeException; 29 30 import org.openstreetmap.josm.tools.SubclassFilteredCollection; 30 31 import org.openstreetmap.josm.tools.WindowGeometry; … … 224 225 SwingUtilities.invokeLater(() -> show(h)); 225 226 } 226 } catch (final RuntimeException e) {227 } catch (final JosmRuntimeException | IllegalArgumentException | IllegalStateException e) { 227 228 BugReportExceptionHandler.handleException(e); 228 229 } -
trunk/src/org/openstreetmap/josm/gui/io/SaveLayerTask.java
r11553 r11746 11 11 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 12 12 import org.openstreetmap.josm.tools.CheckParameterUtil; 13 import org.openstreetmap.josm.tools.JosmRuntimeException; 13 14 14 15 /** … … 55 56 layerInfo.getLayer().onPostSaveToFile(); 56 57 } 57 } catch ( RuntimeException e) {58 } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException e) { 58 59 Main.error(e); 59 60 setLastException(e); -
trunk/src/org/openstreetmap/josm/gui/layer/LayerManager.java
r11297 r11746 14 14 import org.openstreetmap.josm.Main; 15 15 import org.openstreetmap.josm.gui.util.GuiHelper; 16 import org.openstreetmap.josm.tools.JosmRuntimeException; 16 17 import org.openstreetmap.josm.tools.Utils; 17 18 import org.openstreetmap.josm.tools.bugreport.BugReport; … … 404 405 try { 405 406 l.layerAdded(e); 406 } catch ( RuntimeException t) {407 } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException t) { 407 408 throw BugReport.intercept(t).put("listener", l).put("event", e); 408 409 } … … 421 422 try { 422 423 l.layerRemoving(e); 423 } catch ( RuntimeException t) {424 } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException t) { 424 425 throw BugReport.intercept(t).put("listener", l).put("event", e).put("layer", layer); 425 426 } … … 434 435 try { 435 436 l.layerOrderChanged(e); 436 } catch ( RuntimeException t) {437 } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException t) { 437 438 throw BugReport.intercept(t).put("listener", l).put("event", e); 438 439 } -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java
r11739 r11746 83 83 import org.openstreetmap.josm.tools.GBC; 84 84 import org.openstreetmap.josm.tools.ImageProvider; 85 import org.openstreetmap.josm.tools.JosmRuntimeException; 85 86 import org.openstreetmap.josm.tools.Pair; 86 87 import org.openstreetmap.josm.tools.Utils; … … 934 935 final long deciSeconds = timezoneOffsetPair.b.getMilliseconds() / 100; 935 936 sldSeconds.setValue((int) (deciSeconds % 60)); 936 } catch ( RuntimeException e) {937 } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException e) { 937 938 Main.warn(e); 938 939 JOptionPane.showMessageDialog(Main.parent, -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageEntry.java
r11745 r11746 12 12 import org.openstreetmap.josm.data.coor.LatLon; 13 13 import org.openstreetmap.josm.tools.ExifReader; 14 import org.openstreetmap.josm.tools.JosmRuntimeException; 14 15 15 16 import com.drew.imaging.jpeg.JpegMetadataReader; … … 450 451 try { 451 452 setExifTime(ExifReader.readTime(metadata)); 452 } catch ( RuntimeException ex) {453 } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException ex) { 453 454 Main.warn(ex); 454 455 setExifTime(null); -
trunk/src/org/openstreetmap/josm/gui/layer/imagery/TileSourceDisplaySettings.java
r10603 r11746 11 11 import org.openstreetmap.josm.gui.layer.AbstractTileSourceLayer; 12 12 import org.openstreetmap.josm.tools.CheckParameterUtil; 13 import org.openstreetmap.josm.tools.JosmRuntimeException; 13 14 import org.openstreetmap.josm.tools.bugreport.BugReport; 14 15 … … 275 276 setDisplacement(new EastNorth(Double.parseDouble(dx), Double.parseDouble(dy))); 276 277 } 277 } catch ( RuntimeException e) {278 } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException e) { 278 279 throw BugReport.intercept(e).put("data", data); 279 280 } -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/AudioMarker.java
r9078 r11746 3 3 4 4 import java.awt.event.ActionEvent; 5 import java.io.IOException; 5 6 import java.net.URL; 6 7 import java.util.Collections; … … 58 59 AudioPlayer.play(audioUrl, offset + syncOffset + after); 59 60 recentlyPlayedMarker = this; 60 } catch (Exception e) { 61 } catch (IOException | InterruptedException e) { 61 62 AudioPlayer.audioMalfunction(e); 62 63 } -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/PlayHeadMarker.java
r11381 r11746 9 9 import java.awt.event.MouseAdapter; 10 10 import java.awt.event.MouseEvent; 11 import java.io.IOException; 11 12 12 13 import javax.swing.JOptionPane; … … 98 99 try { 99 100 AudioPlayer.pause(); 100 } catch (Exception ex) { 101 } catch (IOException | InterruptedException ex) { 101 102 AudioPlayer.audioMalfunction(ex); 102 103 } … … 112 113 try { 113 114 AudioPlayer.pause(); 114 } catch (Exception ex) { 115 } catch (IOException | InterruptedException ex) { 115 116 AudioPlayer.audioMalfunction(ex); 116 117 } -
trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceTabbedPane.java
r11397 r11746 599 599 } catch (SecurityException ex) { 600 600 Main.error(ex); 601 } catch (RuntimeException ex) { 601 } catch (RuntimeException ex) { // NOPMD 602 602 // allow to change most settings even if e.g. a plugin fails 603 603 BugReportExceptionHandler.handleException(ex); … … 616 616 } catch (SecurityException ex) { 617 617 Main.error(ex); 618 } catch (RuntimeException ex) { 618 } catch (RuntimeException ex) { // NOPMD 619 619 BugReportExceptionHandler.handleException(ex); 620 620 } finally { -
trunk/src/org/openstreetmap/josm/gui/preferences/map/MapPaintPreference.java
r11493 r11746 165 165 return css.title; 166 166 } 167 } catch (RuntimeException ignore) { 167 } catch (RuntimeException ignore) { // NOPMD 168 168 Main.debug(ignore); 169 169 } -
trunk/src/org/openstreetmap/josm/gui/progress/PleaseWaitProgressMonitor.java
r11673 r11746 66 66 try { 67 67 runnable.run(); 68 } catch (RuntimeException e) { 68 } catch (RuntimeException e) { // NOPMD 69 69 throw BugReport.intercept(e).put("monitor", this); 70 70 } -
trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionManager.java
r11452 r11746 15 15 import java.util.function.Function; 16 16 17 import org.openstreetmap.josm.Main;18 17 import org.openstreetmap.josm.data.osm.DataSet; 19 18 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 219 218 KeyedItem ki = (KeyedItem) item; 220 219 if (ki.key != null && ki.getValues() != null) { 221 try { 222 PRESET_TAG_CACHE.putAll(ki.key, ki.getValues()); 223 } catch (NullPointerException e) { 224 Main.error(e, p + ": Unable to cache " + ki); 225 } 220 PRESET_TAG_CACHE.putAll(ki.key, ki.getValues()); 226 221 } 227 222 } else if (item instanceof Roles) { -
trunk/src/org/openstreetmap/josm/gui/util/GuiHelper.java
r11381 r11746 159 159 try { 160 160 return callable.call(); 161 } catch (Exception e) { 161 } catch (Exception e) { // NOPMD 162 162 Main.error(e); 163 163 return null; -
trunk/src/org/openstreetmap/josm/gui/widgets/JosmPasswordField.java
r10627 r11746 125 125 try { 126 126 pasteAction.actionPerformed(e); 127 } catch (NullPointerException npe) { 127 } catch (NullPointerException npe) { // NOPMD 128 128 Main.error(npe, "NullPointerException occured because of JDK bug 6322854. " 129 129 +"Copy/Paste operation has not been performed. Please complain to Oracle: "+ -
trunk/src/org/openstreetmap/josm/io/BoundingBoxDownloader.java
r11397 r11746 17 17 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 18 18 import org.openstreetmap.josm.tools.CheckParameterUtil; 19 import org.openstreetmap.josm.tools.JosmRuntimeException; 19 20 import org.xml.sax.SAXException; 20 21 … … 114 115 } catch (OsmTransferException e) { 115 116 throw e; 116 } catch ( RuntimeException e) {117 } catch (JosmRuntimeException | IllegalStateException e) { 117 118 if (cancel) 118 119 return null; -
trunk/src/org/openstreetmap/josm/io/NameFinder.java
r11620 r11746 241 241 Main.error(ex); // SAXException does not chain correctly 242 242 throw new SAXException(ex.getMessage(), ex); 243 } catch (NullPointerException ex) { 243 } catch (NullPointerException ex) { // NOPMD 244 244 Main.error(ex); // SAXException does not chain correctly 245 245 throw new SAXException(tr("Null pointer exception, possibly some missing tags."), ex); -
trunk/src/org/openstreetmap/josm/io/NmeaReader.java
r11620 r11746 415 415 return true; 416 416 417 } catch ( RuntimeException ex) {417 } catch (IllegalArgumentException | IndexOutOfBoundsException ex) { 418 418 // out of bounds and such 419 419 Main.debug(ex); -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/ImportHandler.java
r10212 r11746 47 47 } 48 48 } 49 } catch (RuntimeException ex) { 49 } catch (RuntimeException ex) { // NOPMD 50 50 Main.warn("RemoteControl: Error parsing import remote control request:"); 51 51 Main.error(ex); -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandler.java
r10657 r11746 146 146 } 147 147 } 148 } catch (RuntimeException ex) { 148 } catch (RuntimeException ex) { // NOPMD 149 149 Main.warn("RemoteControl: Error parsing load_and_zoom remote control request:"); 150 150 Main.error(ex); -
trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
r11530 r11746 725 725 + "Delete from preferences?</html>", plugin.name, plugin.className); 726 726 } 727 } catch (RuntimeException e) { 727 } catch (RuntimeException e) { // NOPMD 728 728 pluginLoadingExceptions.put(plugin.name, e); 729 729 Main.error(e); … … 823 823 try { 824 824 task.run(); 825 } catch (RuntimeException e) { 825 } catch (RuntimeException e) { // NOPMD 826 826 Main.error(e); 827 827 return null; … … 1001 1001 plugins = SubclassFilteredCollection.filter(plugins, pi -> pluginsWantedName.contains(pi.name)); 1002 1002 } 1003 } catch (RuntimeException e) { 1003 } catch (RuntimeException e) { // NOPMD 1004 1004 Main.warn(tr("Failed to download plugin information list")); 1005 1005 Main.error(e); … … 1046 1046 try { 1047 1047 pluginDownloadTask.run(); 1048 } catch (RuntimeException e) { 1048 } catch (RuntimeException e) { // NOPMD 1049 1049 Main.error(e); 1050 1050 alertFailedPluginUpdate(parent, pluginsToUpdate); -
trunk/src/org/openstreetmap/josm/tools/AudioPlayer.java
r11472 r11746 58 58 * Called to execute the commands in the other thread 59 59 */ 60 protected void play(URL url, double offset, double speed) throws Exception { 60 protected void play(URL url, double offset, double speed) throws InterruptedException, IOException { 61 61 this.url = url; 62 62 this.offset = offset; … … 67 67 } 68 68 69 protected void pause() throws Exception { 69 protected void pause() throws InterruptedException, IOException { 70 70 command = Command.PAUSE; 71 71 send(); 72 72 } 73 73 74 private void send() throws Exception { 74 private void send() throws InterruptedException, IOException { 75 75 result = Result.WAITING; 76 76 interrupt(); … … 79 79 } 80 80 if (result == Result.FAILED) 81 throw exception; 81 throw new IOException(exception); 82 82 } 83 83 … … 121 121 * start at the beginning of the stream 122 122 * @param url The resource to play, which must be a WAV file or stream 123 * @throws Exception audio fault exception, e.g. can't open stream, unhandleable audio format 124 */ 125 public static void play(URL url) throws Exception { 123 * @throws InterruptedException thread interrupted 124 * @throws IOException audio fault exception, e.g. can't open stream, unhandleable audio format 125 */ 126 public static void play(URL url) throws InterruptedException, IOException { 126 127 AudioPlayer instance = AudioPlayer.getInstance(); 127 128 if (instance != null) … … 133 134 * @param url The resource to play, which must be a WAV file or stream 134 135 * @param seconds The number of seconds into the audio to start playing 135 * @throws Exception audio fault exception, e.g. can't open stream, unhandleable audio format 136 */ 137 public static void play(URL url, double seconds) throws Exception { 136 * @throws InterruptedException thread interrupted 137 * @throws IOException audio fault exception, e.g. can't open stream, unhandleable audio format 138 */ 139 public static void play(URL url, double seconds) throws InterruptedException, IOException { 138 140 AudioPlayer instance = AudioPlayer.getInstance(); 139 141 if (instance != null) … … 146 148 * @param seconds The number of seconds into the audio to start playing 147 149 * @param speed Rate at which audio playes (1.0 = real time, > 1 is faster) 148 * @throws Exception audio fault exception, e.g. can't open stream, unhandleable audio format 149 */ 150 public static void play(URL url, double seconds, double speed) throws Exception { 150 * @throws InterruptedException thread interrupted 151 * @throws IOException audio fault exception, e.g. can't open stream, unhandleable audio format 152 */ 153 public static void play(URL url, double seconds, double speed) throws InterruptedException, IOException { 151 154 AudioPlayer instance = AudioPlayer.getInstance(); 152 155 if (instance != null) … … 156 159 /** 157 160 * Pauses the currently playing audio stream. Does nothing if nothing playing. 158 * @throws Exception audio fault exception, e.g. can't open stream, unhandleable audio format 159 */ 160 public static void pause() throws Exception { 161 * @throws InterruptedException thread interrupted 162 * @throws IOException audio fault exception, e.g. can't open stream, unhandleable audio format 163 */ 164 public static void pause() throws InterruptedException, IOException { 161 165 AudioPlayer instance = AudioPlayer.getInstance(); 162 166 if (instance != null) … … 220 224 audioPlayer = new AudioPlayer(); 221 225 return audioPlayer; 222 } catch ( RuntimeException ex) {226 } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException ex) { 223 227 Main.error(ex); 224 228 return null; … … 233 237 try { 234 238 pause(); 235 } catch (Exception e) { 239 } catch (InterruptedException | IOException e) { 236 240 Main.warn(e); 237 241 } -
trunk/src/org/openstreetmap/josm/tools/OsmUrlToBounds.java
r11620 r11746 82 82 z == null ? 18 : Integer.parseInt(z)); 83 83 } 84 } catch (NumberFormatException | NullPointerException |ArrayIndexOutOfBoundsException ex) {84 } catch (NumberFormatException | ArrayIndexOutOfBoundsException ex) { 85 85 Main.error(ex); 86 86 } -
trunk/src/org/openstreetmap/josm/tools/WindowGeometry.java
r11381 r11746 194 194 "Cannot restore window geometry from preferences.", 195 195 preferenceKey, field, v), e); 196 } catch ( RuntimeException e) {196 } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException e) { 197 197 throw new WindowGeometryException( 198 198 tr("Failed to parse field ''{1}'' in preference with key ''{0}''. Exception was: {2}. " + -
trunk/src/org/openstreetmap/josm/tools/bugreport/BugReport.java
r10902 r11746 126 126 try { 127 127 out.println(ShowStatusReportAction.getReportHeader()); 128 } catch (RuntimeException e) { 128 } catch (RuntimeException e) { // NOPMD 129 129 out.println("Could not generate status report: " + e.getMessage()); 130 130 } -
trunk/src/org/openstreetmap/josm/tools/bugreport/BugReportDialog.java
r11196 r11746 222 222 current = current.getParent(); 223 223 } 224 } catch (RuntimeException e) { 224 } catch (RuntimeException e) { // NOPMD 225 225 BugReport.intercept(e).put("current", current).warn(); 226 226 } -
trunk/src/org/openstreetmap/josm/tools/bugreport/ReportedException.java
r11739 r11746 66 66 try { 67 67 BugReportQueue.getInstance().submit(this); 68 } catch (RuntimeException e) { 68 } catch (RuntimeException e) { // NOPMD 69 69 e.printStackTrace(); 70 70 } … … 218 218 string = value.toString(); 219 219 } 220 } catch (RuntimeException t) { 220 } catch (RuntimeException t) { // NOPMD 221 221 Main.warn(t); 222 222 string = "<Error calling toString()>"; -
trunk/tools/pmd/josm-ruleset.xml
r11739 r11746 21 21 <exclude name="LocalVariableCouldBeFinal"/> 22 22 <exclude name="MethodArgumentCouldBeFinal"/> 23 </rule>--> 24 <rule ref="rulesets/java/strictexception.xml"> 25 <exclude name="ExceptionAsFlowControl"/> 26 <exclude name="AvoidRethrowingException"/> 23 27 </rule> 24 <rule ref="rulesets/java/strictexception.xml"/> -->25 28 <rule ref="rulesets/java/strings.xml"> 26 29 <exclude name="AvoidDuplicateLiterals"/>
Note:
See TracChangeset
for help on using the changeset viewer.