Changeset 10212 in josm
- Timestamp:
- 2016-05-15T00:51:10+02:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 104 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r10208 r10212 35 35 import java.util.StringTokenizer; 36 36 import java.util.concurrent.Callable; 37 import java.util.concurrent.ExecutionException; 37 38 import java.util.concurrent.ExecutorService; 38 39 import java.util.concurrent.Executors; … … 106 107 import org.openstreetmap.josm.io.OnlineResource; 107 108 import org.openstreetmap.josm.io.OsmApi; 109 import org.openstreetmap.josm.io.OsmApiInitializationException; 110 import org.openstreetmap.josm.io.OsmTransferCanceledException; 108 111 import org.openstreetmap.josm.plugins.PluginHandler; 109 112 import org.openstreetmap.josm.tools.CheckParameterUtil; … … 594 597 try { 595 598 OsmApi.getOsmApi().initialize(null, true); 596 } catch (Exception e) { 599 } catch (OsmTransferCanceledException | OsmApiInitializationException e) { 597 600 Main.warn(getErrorMessage(Utils.getRootCause(e))); 598 601 } … … 640 643 } 641 644 service.shutdown(); 642 } catch (Exception ex) { 645 } catch (InterruptedException | ExecutionException ex) { 643 646 throw new RuntimeException(ex); 644 647 } … … 933 936 ProjectionPreference.setProjection(); 934 937 938 String defaultlaf = platform.getDefaultStyle(); 939 String laf = Main.pref.get("laf", defaultlaf); 935 940 try { 936 String defaultlaf = platform.getDefaultStyle(); 937 String laf = Main.pref.get("laf", defaultlaf); 938 try { 939 UIManager.setLookAndFeel(laf); 940 } catch (final NoClassDefFoundError | ClassNotFoundException e) { 941 // Try to find look and feel in plugin classloaders 942 Class<?> klass = null; 943 for (ClassLoader cl : PluginHandler.getResourceClassLoaders()) { 944 try { 945 klass = cl.loadClass(laf); 946 break; 947 } catch (ClassNotFoundException ex) { 948 // Do nothing 949 if (Main.isTraceEnabled()) { 950 Main.trace(ex.getMessage()); 951 } 941 UIManager.setLookAndFeel(laf); 942 } catch (final NoClassDefFoundError | ClassNotFoundException e) { 943 // Try to find look and feel in plugin classloaders 944 Class<?> klass = null; 945 for (ClassLoader cl : PluginHandler.getResourceClassLoaders()) { 946 try { 947 klass = cl.loadClass(laf); 948 break; 949 } catch (ClassNotFoundException ex) { 950 if (Main.isTraceEnabled()) { 951 Main.trace(ex.getMessage()); 952 952 } 953 953 } 954 if (klass != null && LookAndFeel.class.isAssignableFrom(klass)) {955 try{956 UIManager.setLookAndFeel((LookAndFeel) klass.getConstructor().newInstance());957 } catch (ReflectiveOperationException ex) {958 warn("Cannot set Look and Feel: " + laf + ": "+ex.getMessage());959 }960 } else{961 info("Look and Feel not found: " + laf);954 } 955 if (klass != null && LookAndFeel.class.isAssignableFrom(klass)) { 956 try { 957 UIManager.setLookAndFeel((LookAndFeel) klass.getConstructor().newInstance()); 958 } catch (ReflectiveOperationException ex) { 959 warn("Cannot set Look and Feel: " + laf + ": "+ex.getMessage()); 960 } catch (UnsupportedLookAndFeelException ex) { 961 info("Look and Feel not supported: " + laf); 962 962 Main.pref.put("laf", defaultlaf); 963 963 } 964 } catch (final UnsupportedLookAndFeelException e){965 info("Look and Feel not supported: " + laf);964 } else { 965 info("Look and Feel not found: " + laf); 966 966 Main.pref.put("laf", defaultlaf); 967 967 } 968 toolbar = new ToolbarPreferences();969 contentPanePrivate.updateUI();970 panel.updateUI();971 } catch ( finalException e) {968 } catch (UnsupportedLookAndFeelException e) { 969 info("Look and Feel not supported: " + laf); 970 Main.pref.put("laf", defaultlaf); 971 } catch (InstantiationException | IllegalAccessException e) { 972 972 error(e); 973 973 } 974 toolbar = new ToolbarPreferences(); 975 contentPanePrivate.updateUI(); 976 panel.updateUI(); 977 974 978 UIManager.put("OptionPane.okIcon", ImageProvider.get("ok")); 975 979 UIManager.put("OptionPane.yesIcon", UIManager.get("OptionPane.okIcon")); -
trunk/src/org/openstreetmap/josm/actions/AddImageryLayerAction.java
r9918 r10212 54 54 55 55 // change toolbar icon from if specified 56 try { 57 String icon = info.getIcon(); 58 if (icon != null) { 59 new ImageProvider(icon).setOptional(true).getInBackground(new ImageResourceCallback() { 60 @Override 61 public void finished(final ImageResource result) { 62 if (result != null) { 63 GuiHelper.runInEDT(new Runnable() { 64 @Override 65 public void run() { 66 result.getImageIcon(AddImageryLayerAction.this); 67 } 68 }); 69 } 56 String icon = info.getIcon(); 57 if (icon != null) { 58 new ImageProvider(icon).setOptional(true).getInBackground(new ImageResourceCallback() { 59 @Override 60 public void finished(final ImageResource result) { 61 if (result != null) { 62 GuiHelper.runInEDT(new Runnable() { 63 @Override 64 public void run() { 65 result.getImageIcon(AddImageryLayerAction.this); 66 } 67 }); 70 68 } 71 }); 72 } 73 } catch (Exception ex) { 74 throw new RuntimeException(ex.getMessage(), ex); 69 } 70 }); 75 71 } 76 72 } -
trunk/src/org/openstreetmap/josm/actions/CloseChangesetAction.java
r9519 r10212 137 137 getProgressMonitor().createSubTaskMonitor(1, false /* not internal */) 138 138 ); 139 } catch (Exception e) { 139 } catch (OsmTransferException | IllegalArgumentException e) { 140 140 if (canceled) 141 141 return; -
trunk/src/org/openstreetmap/josm/actions/JosmAction.java
r10074 r10212 6 6 import java.awt.event.KeyEvent; 7 7 import java.util.Collection; 8 import java.util.concurrent.CancellationException; 9 import java.util.concurrent.ExecutionException; 8 10 import java.util.concurrent.Future; 9 11 … … 239 241 try { 240 242 future.get(); 241 } catch (Exception e) { 243 } catch (InterruptedException | ExecutionException | CancellationException e) { 242 244 Main.error(e); 243 245 return; -
trunk/src/org/openstreetmap/josm/actions/OpenFileAction.java
r9972 r10212 25 25 import java.util.regex.Matcher; 26 26 import java.util.regex.Pattern; 27 import java.util.regex.PatternSyntaxException; 27 28 28 29 import javax.swing.JOptionPane; … … 328 329 } 329 330 } 330 } catch (Exception e) { 331 } catch (IOException | PatternSyntaxException | IllegalStateException | IndexOutOfBoundsException e) { 331 332 Main.error(e); 332 333 } -
trunk/src/org/openstreetmap/josm/actions/OpenLocationAction.java
r9972 r10212 153 153 result.add(task); 154 154 } 155 } catch (Exception e) { 155 } catch (ReflectiveOperationException e) { 156 156 Main.error(e); 157 157 } … … 173 173 DownloadTask task = taskClass.getConstructor().newInstance(); 174 174 result.append(task.acceptsDocumentationSummary()); 175 } catch (Exception e) { 175 } catch (ReflectiveOperationException e) { 176 176 Main.error(e); 177 177 } -
trunk/src/org/openstreetmap/josm/actions/RestartAction.java
r9238 r10212 79 79 80 80 /** 81 * Restarts the current Java application 82 * @throws IOException in case of any error 81 * Restarts the current Java application. 82 * @throws IOException in case of any I/O error 83 83 */ 84 84 public static void restartJOSM() throws IOException { 85 85 if (isRestartSupported() && !Main.exitJosm(false, 0)) return; 86 86 final List<String> cmd; 87 try { 88 // special handling for OSX .app package 89 if (Main.isPlatformOsx() && System.getProperty("java.library.path").contains("/JOSM.app/Contents/MacOS")) { 90 cmd = getAppleCommands(); 91 } else { 92 cmd = getCommands(); 93 } 94 Main.info("Restart "+cmd); 95 if (Main.isDebugEnabled() && Main.pref.getBoolean("restart.debug.simulation")) { 96 Main.debug("Restart cancelled to get debug info"); 97 return; 98 } 99 // execute the command in a shutdown hook, to be sure that all the 100 // resources have been disposed before restarting the application 101 Runtime.getRuntime().addShutdownHook(new Thread("josm-restarter") { 102 @Override 103 public void run() { 104 try { 105 Runtime.getRuntime().exec(cmd.toArray(new String[cmd.size()])); 106 } catch (IOException e) { 107 Main.error(e); 108 } 87 // special handling for OSX .app package 88 if (Main.isPlatformOsx() && System.getProperty("java.library.path").contains("/JOSM.app/Contents/MacOS")) { 89 cmd = getAppleCommands(); 90 } else { 91 cmd = getCommands(); 92 } 93 Main.info("Restart "+cmd); 94 if (Main.isDebugEnabled() && Main.pref.getBoolean("restart.debug.simulation")) { 95 Main.debug("Restart cancelled to get debug info"); 96 return; 97 } 98 // execute the command in a shutdown hook, to be sure that all the 99 // resources have been disposed before restarting the application 100 Runtime.getRuntime().addShutdownHook(new Thread("josm-restarter") { 101 @Override 102 public void run() { 103 try { 104 Runtime.getRuntime().exec(cmd.toArray(new String[cmd.size()])); 105 } catch (IOException e) { 106 Main.error(e); 109 107 } 110 }); 111 // exit 112 System.exit(0); 113 } catch (Exception e) { 114 // something went wrong 115 throw new IOException("Error while trying to restart the application", e); 116 } 108 } 109 }); 110 // exit 111 System.exit(0); 117 112 } 118 113 -
trunk/src/org/openstreetmap/josm/actions/SessionLoadAction.java
r10192 r10212 183 183 } catch (IOException e) { 184 184 handleException(tr("IO Error"), e); 185 } catch (Exception e) { 185 } catch (RuntimeException e) { 186 186 cancel(); 187 187 throw e; -
trunk/src/org/openstreetmap/josm/actions/UpdateSelectionAction.java
r9241 r10212 23 23 import org.openstreetmap.josm.io.MultiFetchServerObjectReader; 24 24 import org.openstreetmap.josm.io.OnlineResource; 25 import org.openstreetmap.josm.io.OsmTransferException; 25 26 import org.openstreetmap.josm.tools.Shortcut; 26 27 … … 44 45 DataSet ds = reader.parseOsm(NullProgressMonitor.INSTANCE); 45 46 Main.main.getEditLayer().mergeFrom(ds); 46 } catch (Exception e) { 47 } catch (OsmTransferException e) { 47 48 ExceptionDialogUtil.explainException(e); 48 49 } -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadGpsTask.java
r9509 r10212 115 115 ProgressMonitor subMonitor = progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false); 116 116 rawData = reader.parseRawGps(subMonitor); 117 } catch (Exception e) { 117 } catch (OsmTransferException e) { 118 118 if (isCanceled()) 119 119 return; 120 if (e instanceof OsmTransferException) { 121 rememberException(e); 122 } else { 123 rememberException(new OsmTransferException(e)); 124 } 120 rememberException(e); 125 121 } 126 122 } -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadNotesTask.java
r10032 r10212 160 160 + "</html>", 161 161 tr("More notes to download"), JOptionPane.INFORMATION_MESSAGE); 162 } catch (Exception e) { 162 } catch (OsmTransferException e) { 163 163 if (isCanceled()) 164 164 return; 165 if (e instanceof OsmTransferException) { 166 rememberException(e); 167 } else { 168 rememberException(new OsmTransferException(e)); 169 } 165 rememberException(e); 170 166 } 171 167 } … … 186 182 try { 187 183 notesData = reader.parseRawNotes(subMonitor); 188 } catch (Exception e) { 184 } catch (OsmTransferException e) { 189 185 if (isCanceled()) 190 186 return; 191 if (e instanceof OsmTransferException) { 192 rememberException(e); 193 } else { 194 rememberException(new OsmTransferException(e)); 195 } 187 rememberException(e); 196 188 } 197 189 } … … 212 204 try { 213 205 notesData = reader.parseRawNotesBzip2(subMonitor); 214 } catch (Exception e) { 206 } catch (OsmTransferException e) { 215 207 if (isCanceled()) 216 208 return; 217 if (e instanceof OsmTransferException) { 218 rememberException(e); 219 } else { 220 rememberException(new OsmTransferException(e)); 221 } 209 rememberException(e); 222 210 } 223 211 } -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java
r9732 r10212 332 332 return; 333 333 dataSet = parseDataSet(); 334 } catch (Exception e) { 334 } catch (OsmTransferException e) { 335 335 if (isCanceled()) { 336 336 Main.info(tr("Ignoring exception because download has been canceled. Exception was: {0}", e.toString())); … … 340 340 setCanceled(true); 341 341 return; 342 } else if (e instanceof OsmTransferException){342 } else { 343 343 rememberException(e); 344 } else {345 rememberException(new OsmTransferException(e));346 344 } 347 345 DownloadOsmTask.this.setFailed(true); -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadReferrersTask.java
r9881 r10212 194 194 i++; 195 195 } 196 } catch (Exception e) { 196 } catch (OsmTransferException e) { 197 197 if (canceled) 198 198 return; -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadTaskList.java
r10135 r10212 16 16 import java.util.List; 17 17 import java.util.Set; 18 import java.util.concurrent.CancellationException; 19 import java.util.concurrent.ExecutionException; 18 20 import java.util.concurrent.Future; 19 21 … … 249 251 try { 250 252 future.get(); 251 } catch (Exception e) { 253 } catch (InterruptedException | ExecutionException | CancellationException e) { 252 254 Main.error(e); 253 255 return; -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/PostDownloadHandler.java
r9905 r10212 9 9 import java.util.LinkedHashSet; 10 10 import java.util.Set; 11 import java.util.concurrent.CancellationException; 12 import java.util.concurrent.ExecutionException; 11 13 import java.util.concurrent.Future; 12 14 … … 40 42 try { 41 43 future.get(); 42 } catch (Exception e) { 44 } catch (InterruptedException | ExecutionException | CancellationException e) { 43 45 Main.error(e); 44 46 return; -
trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java
r9981 r10212 598 598 } catch (PatternSyntaxException e) { 599 599 throw new ParseError(tr(rxErrorMsg, e.getPattern(), e.getIndex(), e.getMessage()), e); 600 } catch (Exception e) { 600 } catch (IllegalArgumentException e) { 601 601 throw new ParseError(tr(rxErrorMsgNoPos, key, e.getMessage()), e); 602 602 } … … 605 605 } catch (PatternSyntaxException e) { 606 606 throw new ParseError(tr(rxErrorMsg, e.getPattern(), e.getIndex(), e.getMessage()), e); 607 } catch (Exception e) { 607 } catch (IllegalArgumentException e) { 608 608 throw new ParseError(tr(rxErrorMsgNoPos, value, e.getMessage()), e); 609 609 } … … 795 795 } catch (PatternSyntaxException e) { 796 796 throw new ParseError(tr(rxErrorMsg, e.getPattern(), e.getIndex(), e.getMessage()), e); 797 } catch (Exception e) { 797 } catch (IllegalArgumentException e) { 798 798 throw new ParseError(tr(rxErrorMsgNoPos, key, e.getMessage()), e); 799 799 } … … 806 806 } catch (PatternSyntaxException e) { 807 807 throw new ParseError(tr(rxErrorMsg, e.getPattern(), e.getIndex(), e.getMessage()), e); 808 } catch (Exception e) { 808 } catch (IllegalArgumentException e) { 809 809 throw new ParseError(tr(rxErrorMsgNoPos, value, e.getMessage()), e); 810 810 } … … 885 885 } catch (PatternSyntaxException e) { 886 886 throw new ParseError(tr(rxErrorMsg, e.getPattern(), e.getIndex(), e.getMessage()), e); 887 } catch (Exception e) { 887 } catch (IllegalArgumentException e) { 888 888 throw new ParseError(tr(rxErrorMsgNoPos, s, e.getMessage()), e); 889 889 } -
trunk/src/org/openstreetmap/josm/actions/upload/UploadNotesTask.java
r10134 r10212 117 117 } 118 118 updatedNotes.put(note, newNote); 119 } catch (Exception e) { 119 } catch (OsmTransferException e) { 120 120 Main.error("Failed to upload note to server: " + note.getId()); 121 121 Main.error(e); -
trunk/src/org/openstreetmap/josm/data/AutosaveTask.java
r10043 r10212 165 165 try (PrintStream ps = new PrintStream(pidFile, "UTF-8")) { 166 166 ps.println(ManagementFactory.getRuntimeMXBean().getName()); 167 } catch (Exception t) { 167 } catch (IOException | SecurityException t) { 168 168 Main.error(t); 169 169 } … … 213 213 displayNotification(); 214 214 } 215 } catch (Exception t) { 215 } catch (RuntimeException t) { 216 216 // Don't let exception stop time thread 217 217 Main.error("Autosave failed:"); … … 312 312 skipFile = jvmPerfDataFileExists(pid); 313 313 } 314 } catch (Exception t) { 314 } catch (IOException | SecurityException t) { 315 315 Main.error(t); 316 316 } -
trunk/src/org/openstreetmap/josm/data/CustomConfigurator.java
r10179 r10212 10 10 import java.io.File; 11 11 import java.io.FileInputStream; 12 import java.io.IOException; 12 13 import java.io.InputStream; 13 14 import java.nio.charset.StandardCharsets; … … 35 36 import javax.xml.parsers.DocumentBuilder; 36 37 import javax.xml.parsers.DocumentBuilderFactory; 38 import javax.xml.parsers.ParserConfigurationException; 39 import javax.xml.stream.XMLStreamException; 37 40 import javax.xml.transform.OutputKeys; 38 41 import javax.xml.transform.Transformer; 42 import javax.xml.transform.TransformerException; 39 43 import javax.xml.transform.TransformerFactory; 44 import javax.xml.transform.TransformerFactoryConfigurationError; 40 45 import javax.xml.transform.dom.DOMSource; 41 46 import javax.xml.transform.stream.StreamResult; … … 53 58 import org.openstreetmap.josm.tools.LanguageInfo; 54 59 import org.openstreetmap.josm.tools.Utils; 60 import org.w3c.dom.DOMException; 55 61 import org.w3c.dom.Document; 56 62 import org.w3c.dom.Element; 57 63 import org.w3c.dom.Node; 58 64 import org.w3c.dom.NodeList; 65 import org.xml.sax.SAXException; 59 66 60 67 /** … … 270 277 exportDocument = builder.newDocument(); 271 278 root = document.getDocumentElement(); 272 } catch (Exception ex) { 279 } catch (SAXException | IOException | ParserConfigurationException ex) { 273 280 Main.warn("Error getting preferences to save:" +ex.getMessage()); 274 281 } 275 if (root == null) 282 if (root == null || exportDocument == null) 276 283 return; 277 284 try { … … 299 306 ts.setOutputProperty(OutputKeys.INDENT, "yes"); 300 307 ts.transform(new DOMSource(exportDocument), new StreamResult(f.toURI().getPath())); 301 } catch (Exception ex) { 308 } catch (DOMException | TransformerFactoryConfigurationError | TransformerException ex) { 302 309 Main.warn("Error saving preferences part:"); 303 310 Main.error(ex); … … 451 458 openAndReadXML(is); 452 459 } 453 } catch (Exception ex) { 460 } catch (ScriptException | IOException | SecurityException ex) { 454 461 log("Error reading custom preferences: " + ex.getMessage()); 455 462 } … … 466 473 processXML(document); 467 474 } 468 } catch (Exception ex) { 475 } catch (SAXException | IOException | ParserConfigurationException ex) { 469 476 log("Error reading custom preferences: "+ex.getMessage()); 470 477 } … … 492 499 engine.eval("API.pluginUninstall = function(names) { "+className+".pluginOperation('',names,'');}"); 493 500 engine.eval("API.pluginDelete = function(names) { "+className+".pluginOperation('','',names);}"); 494 } catch (Exception ex) { 501 } catch (ScriptException ex) { 495 502 log("Error: initializing script engine: "+ex.getMessage()); 496 503 Main.error(ex); … … 747 754 CharArrayReader reader = new CharArrayReader(fragmentWithReplacedVars.toCharArray()); 748 755 tmpPref.fromXML(reader); 749 } catch (Exception ex) { 756 } catch (TransformerException | XMLStreamException | IOException ex) { 750 757 log("Error: can not read XML fragment :" + ex.getMessage()); 751 758 } -
trunk/src/org/openstreetmap/josm/data/Preferences.java
r10208 r10212 731 731 /* only for preferences */ 732 732 public synchronized String getColorName(String o) { 733 try { 734 Matcher m = Pattern.compile("mappaint\\.(.+?)\\.(.+)").matcher(o); 735 if (m.matches()) { 736 return tr("Paint style {0}: {1}", tr(I18n.escape(m.group(1))), tr(I18n.escape(m.group(2)))); 737 } 738 } catch (Exception e) { 739 Main.warn(e); 740 } 741 try { 742 Matcher m = Pattern.compile("layer (.+)").matcher(o); 743 if (m.matches()) { 744 return tr("Layer: {0}", tr(I18n.escape(m.group(1)))); 745 } 746 } catch (Exception e) { 747 Main.warn(e); 733 Matcher m = Pattern.compile("mappaint\\.(.+?)\\.(.+)").matcher(o); 734 if (m.matches()) { 735 return tr("Paint style {0}: {1}", tr(I18n.escape(m.group(1))), tr(I18n.escape(m.group(2)))); 736 } 737 m = Pattern.compile("layer (.+)").matcher(o); 738 if (m.matches()) { 739 return tr("Layer: {0}", tr(I18n.escape(m.group(1)))); 748 740 } 749 741 return tr(I18n.escape(colornames.containsKey(o) ? colornames.get(o) : o)); … … 1336 1328 field.setAccessible(true); 1337 1329 field.set(null, ResourceBundle.getBundle("sun.awt.resources.awt")); 1338 } catch (Exception | InternalError e) { 1339 // Ignore all exceptions, including internal error raised by Java 9 Jigsaw EA: 1340 // java.lang.InternalError: legacy getBundle can't be used to find sun.awt.resources.awt in module java.desktop 1341 // InternalError catch to remove when https://bugs.openjdk.java.net/browse/JDK-8136804 is resolved 1330 } catch (ReflectiveOperationException e) { 1342 1331 if (Main.isTraceEnabled()) { 1343 1332 Main.trace(e.getMessage()); -
trunk/src/org/openstreetmap/josm/data/cache/JCSCachedTileLoaderJob.java
r10185 r10212 297 297 * @return true if object was successfully downloaded, false, if there was a loading failure 298 298 */ 299 300 299 private boolean loadObject() { 301 300 if (attributes == null) { … … 396 395 } 397 396 return doCache; 398 } catch (Exception e) { 397 } catch (InterruptedException e) { 399 398 attributes.setErrorMessage(e.toString()); 400 399 log.log(Level.WARNING, "JCS - Exception during download {0}", getUrlNoException()); … … 403 402 log.log(Level.WARNING, "JCS - Silent failure during download: {0}", getUrlNoException()); 404 403 return false; 405 406 404 } 407 405 -
trunk/src/org/openstreetmap/josm/data/gpx/WayPoint.java
r9738 r10212 12 12 import org.openstreetmap.josm.data.coor.LatLon; 13 13 import org.openstreetmap.josm.data.projection.Projections; 14 import org.openstreetmap.josm.tools.UncheckedParseException; 14 15 import org.openstreetmap.josm.tools.date.DateUtils; 15 16 import org.openstreetmap.josm.tools.template_engine.TemplateEngineDataProvider; … … 124 125 this.time = time.getTime() / 1000.; 125 126 return time; 126 } catch (Exception e) { 127 } catch (UncheckedParseException e) { 127 128 Main.warn(e); 128 129 time = 0; -
trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java
r9989 r10212 665 665 666 666 if (serverProjections == null || serverProjections.isEmpty()) { 667 try { 668 serverProjections = new ArrayList<>(); 669 Matcher m = Pattern.compile(".*\\{PROJ\\(([^)}]+)\\)\\}.*").matcher(url.toUpperCase(Locale.ENGLISH)); 670 if (m.matches()) { 671 for (String p : m.group(1).split(",")) { 672 serverProjections.add(p); 673 } 667 serverProjections = new ArrayList<>(); 668 Matcher m = Pattern.compile(".*\\{PROJ\\(([^)}]+)\\)\\}.*").matcher(url.toUpperCase(Locale.ENGLISH)); 669 if (m.matches()) { 670 for (String p : m.group(1).split(",")) { 671 serverProjections.add(p); 674 672 } 675 } catch (Exception e) {676 Main.warn(e);677 673 } 678 674 } -
trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoaderJob.java
r10087 r10212 152 152 try { 153 153 super.submit(this, force); 154 } catch (Exception e) { 154 } catch (IOException e) { 155 155 // if we fail to submit the job, mark tile as loaded and set error message 156 156 tile.finishLoading(); -
trunk/src/org/openstreetmap/josm/data/imagery/WMTSTileSource.java
r10043 r10212 252 252 * @param info imagery info 253 253 * @throws IOException if any I/O error occurs 254 * @throws IllegalArgumentException if any other error happens for the given imagery info 254 255 */ 255 256 public WMTSTileSource(ImageryInfo info) throws IOException { … … 290 291 } 291 292 292 private Collection<Layer> getCapabilities() { 293 /** 294 * @return capabilities 295 * @throws IOException in case of any I/O error 296 * @throws IllegalArgumentException in case of any other error 297 */ 298 private Collection<Layer> getCapabilities() throws IOException { 293 299 XMLInputFactory factory = XMLInputFactory.newFactory(); 294 300 // do not try to load external entities, nor validate the XML … … 320 326 } 321 327 return ret; 322 } catch (Exception e) { 328 } catch (XMLStreamException e) { 323 329 throw new IllegalArgumentException(e); 324 330 } -
trunk/src/org/openstreetmap/josm/data/osm/DatasetConsistencyTest.java
r8846 r10212 212 212 } 213 213 214 } catch (Exception e) { 214 } catch (RuntimeException e) { 215 215 writer.println("Exception during dataset integrity test:"); 216 216 e.printStackTrace(writer); -
trunk/src/org/openstreetmap/josm/data/projection/CustomProjection.java
r10181 r10212 814 814 } 815 815 } 816 } catch (Exception e) { 816 } catch (RuntimeException e) { 817 817 Main.error(e); 818 818 } -
trunk/src/org/openstreetmap/josm/data/projection/Projections.java
r9950 r10212 323 323 try { 324 324 proj = pc.getProjection(); 325 } catch (Exception e) { 325 } catch (RuntimeException e) { 326 326 String cause = e.getMessage(); 327 327 Main.warn("Unable to get projection "+code+" with "+pc + (cause != null ? ". "+cause : "")); -
trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2GridShiftFileWrapper.java
r9639 r10212 2 2 package org.openstreetmap.josm.data.projection.datum; 3 3 4 import java.io.IOException; 4 5 import java.io.InputStream; 5 6 … … 55 56 instance = new NTV2GridShiftFile(); 56 57 instance.loadGridShiftFile(is, false); 57 } catch (Exception e) { 58 } catch (IOException e) { 58 59 throw new RuntimeException(e); 59 60 } -
trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java
r10208 r10212 162 162 163 163 /** 164 * Check if plugindirectory exists (store ignored errors file)164 * Check if validator directory exists (store ignored errors file) 165 165 */ 166 166 private static void checkValidatorDir() { 167 try { 168 File pathDir = new File(getValidatorDir()); 169 if (!pathDir.exists()) { 170 Utils.mkDirs(pathDir); 171 } 172 } catch (Exception e) { 173 Main.error(e); 167 File pathDir = new File(getValidatorDir()); 168 if (!pathDir.exists()) { 169 Utils.mkDirs(pathDir); 174 170 } 175 171 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java
r9799 r10212 750 750 Main.warn(tr("Failed to add {0} to tag checker", i)); 751 751 Main.warn(ex, false); 752 } catch (Exception ex) { 752 } catch (ParseException ex) { 753 753 Main.warn(tr("Failed to add {0} to tag checker", i)); 754 754 Main.warn(ex); -
trunk/src/org/openstreetmap/josm/data/validation/tests/OpeningHourTest.java
r10043 r10212 207 207 try { 208 208 prettifiedValue = (String) ((Invocable) ENGINE).invokeMethod(r, "prettifyValue"); 209 } catch (Exception e) { 210 Main. debug(e.getMessage());209 } catch (ScriptException | NoSuchMethodException e) { 210 Main.warn(e); 211 211 } 212 212 for (final Object i : getList(((Invocable) ENGINE).invokeMethod(r, "getErrors"))) { -
trunk/src/org/openstreetmap/josm/gui/FileDrop.java
r9992 r10212 23 23 import java.io.Reader; 24 24 import java.net.URI; 25 import java.net.URISyntaxException; 25 26 import java.util.ArrayList; 26 27 import java.util.Arrays; … … 34 35 import org.openstreetmap.josm.Main; 35 36 import org.openstreetmap.josm.actions.OpenFileAction; 37 import org.openstreetmap.josm.gui.FileDrop.TransferableObject; 36 38 37 39 // CHECKSTYLE.OFF: HideUtilityClassConstructor … … 138 140 try { 139 141 List<File> list = new ArrayList<>(); 140 String line = null;142 String line; 141 143 while ((line = bReader.readLine()) != null) { 142 144 try { … … 146 148 } 147 149 148 File file = new File(new URI(line)); 149 list.add(file); 150 } catch (Exception ex) { 150 list.add(new File(new URI(line))); 151 } catch (URISyntaxException ex) { 151 152 Main.warn("Error with " + line + ": " + ex.getMessage()); 152 153 } -
trunk/src/org/openstreetmap/josm/gui/JosmUserIdentityManager.java
r9759 r10212 66 66 try { 67 67 instance.initFromOAuth(); 68 } catch (Exception e) { 68 } catch (RuntimeException e) { 69 69 Main.error(e); 70 70 // Fall back to preferences if OAuth identification fails for any reason … … 304 304 accessTokenSecretChanged = false; 305 305 if (OsmApi.isUsingOAuth()) { 306 try { 307 getInstance().initFromOAuth(); 308 } catch (Exception e) { 309 Main.error(e); 310 } 306 getInstance().initFromOAuth(); 311 307 } 312 308 } -
trunk/src/org/openstreetmap/josm/gui/MainApplication.java
r10200 r10212 403 403 try (InputStream is = HttpClient.create(new URL(i)).connect().getContent()) { 404 404 config.openAndReadXML(is); 405 } catch (Exception ex) { 405 } catch (IOException ex) { 406 406 throw new RuntimeException(ex); 407 407 } -
trunk/src/org/openstreetmap/josm/gui/MapStatus.java
r10191 r10212 1097 1097 try { 1098 1098 thread.interrupt(); 1099 } catch (Exception e) { 1099 } catch (RuntimeException e) { 1100 1100 Main.error(e); 1101 1101 } -
trunk/src/org/openstreetmap/josm/gui/PleaseWaitRunnable.java
r10055 r10212 5 5 import java.awt.EventQueue; 6 6 import java.io.IOException; 7 import java.lang.reflect.InvocationTargetException; 7 8 8 9 import javax.swing.SwingUtilities; … … 122 123 } 123 124 } 124 } catch (final Exception e) { 125 } catch (final RuntimeException | 126 OsmTransferException | IOException | SAXException | InvocationTargetException | InterruptedException e) { 125 127 if (!ignoreException) { 126 128 // Exception has to thrown in EDT to be shown to user -
trunk/src/org/openstreetmap/josm/gui/bbox/SlippyMapBBoxChooser.java
r10001 r10212 199 199 @Override 200 200 public void paint(Graphics g) { 201 try { 202 super.paint(g); 203 204 // draw selection rectangle 205 if (iSelectionRectStart != null && iSelectionRectEnd != null) { 206 Rectangle box = new Rectangle(getMapPosition(iSelectionRectStart, false)); 207 box.add(getMapPosition(iSelectionRectEnd, false)); 208 209 g.setColor(new Color(0.9f, 0.7f, 0.7f, 0.6f)); 210 g.fillRect(box.x, box.y, box.width, box.height); 211 212 g.setColor(Color.BLACK); 213 g.drawRect(box.x, box.y, box.width, box.height); 214 } 215 } catch (Exception e) { 216 Main.error(e); 201 super.paint(g); 202 203 // draw selection rectangle 204 if (iSelectionRectStart != null && iSelectionRectEnd != null) { 205 Rectangle box = new Rectangle(getMapPosition(iSelectionRectStart, false)); 206 box.add(getMapPosition(iSelectionRectEnd, false)); 207 208 g.setColor(new Color(0.9f, 0.7f, 0.7f, 0.6f)); 209 g.fillRect(box.x, box.y, box.width, box.height); 210 211 g.setColor(Color.BLACK); 212 g.drawRect(box.x, box.y, box.width, box.height); 217 213 } 218 214 } -
trunk/src/org/openstreetmap/josm/gui/bbox/TileSelectionBBoxChooser.java
r10179 r10212 45 45 import org.openstreetmap.gui.jmapviewer.interfaces.MapMarker; 46 46 import org.openstreetmap.gui.jmapviewer.interfaces.TileLoader; 47 import org.openstreetmap.josm.Main;48 47 import org.openstreetmap.josm.data.Bounds; 49 48 import org.openstreetmap.josm.data.Version; … … 694 693 @Override 695 694 public void paint(Graphics g) { 696 try { 697 super.paint(g); 698 if (min == null || max == null) return; 699 int zoomDiff = MAX_ZOOM - zoom; 700 Point tlc = getTopLeftCoordinates(); 701 int xMin = (min.x >> zoomDiff) - tlc.x; 702 int yMin = (min.y >> zoomDiff) - tlc.y; 703 int xMax = (max.x >> zoomDiff) - tlc.x; 704 int yMax = (max.y >> zoomDiff) - tlc.y; 705 706 int w = xMax - xMin; 707 int h = yMax - yMin; 708 g.setColor(new Color(0.9f, 0.7f, 0.7f, 0.6f)); 709 g.fillRect(xMin, yMin, w, h); 710 711 g.setColor(Color.BLACK); 712 g.drawRect(xMin, yMin, w, h); 713 } catch (Exception e) { 714 Main.error(e); 715 } 695 super.paint(g); 696 if (min == null || max == null) return; 697 int zoomDiff = MAX_ZOOM - zoom; 698 Point tlc = getTopLeftCoordinates(); 699 int xMin = (min.x >> zoomDiff) - tlc.x; 700 int yMin = (min.y >> zoomDiff) - tlc.y; 701 int xMax = (max.x >> zoomDiff) - tlc.x; 702 int yMax = (max.y >> zoomDiff) - tlc.y; 703 704 int w = xMax - xMin; 705 int h = yMax - yMin; 706 g.setColor(new Color(0.9f, 0.7f, 0.7f, 0.6f)); 707 g.fillRect(xMin, yMin, w, h); 708 709 g.setColor(Color.BLACK); 710 g.drawRect(xMin, yMin, w, h); 716 711 } 717 712 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetContentPanel.java
r10124 r10212 235 235 }); 236 236 } 237 } catch (final Exception e) { 237 } catch (final RuntimeException e) { 238 238 GuiHelper.runInEDT(new Runnable() { 239 239 @Override -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r10106 r10212 16 16 import java.beans.PropertyChangeEvent; 17 17 import java.beans.PropertyChangeListener; 18 import java.io.IOException; 18 19 import java.net.URI; 19 20 import java.net.URISyntaxException; … … 1216 1217 } 1217 1218 } 1218 } catch (Exception e) { 1219 } catch (URISyntaxException | IOException e) { 1219 1220 Main.error(e); 1220 1221 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/ChildRelationBrowser.java
r9543 r10212 426 426 } 427 427 }); 428 } catch (Exception e) { 428 } catch (OsmTransferException e) { 429 429 if (canceled) { 430 430 Main.warn(tr("Ignoring exception because task was canceled. Exception: {0}", e.toString())); … … 475 475 refreshView(r); 476 476 } 477 } catch (Exception e) { 477 } catch (OsmTransferException e) { 478 478 if (canceled) { 479 479 Main.warn(tr("Ignoring exception because task was canceled. Exception: {0}", e.toString())); -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/DownloadRelationMemberTask.java
r9241 r10212 143 143 ); 144 144 145 } catch (Exception e) { 145 } catch (OsmTransferException e) { 146 146 if (canceled) { 147 147 Main.warn(tr("Ignoring exception because task was canceled. Exception: {0}", e.toString())); -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/DownloadRelationTask.java
r9078 r10212 5 5 6 6 import java.io.IOException; 7 import java.lang.reflect.InvocationTargetException; 7 8 import java.util.Collection; 8 9 … … 107 108 } 108 109 ); 109 } catch (Exception e) { 110 } catch (OsmTransferException | InvocationTargetException | InterruptedException e) { 110 111 if (canceled) { 111 112 Main.warn(tr("Ignoring exception because task was canceled. Exception: {0}", e.toString())); -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTransferHandler.java
r9993 r10212 54 54 importPrimitiveData(support, destination, insertRow); 55 55 } 56 } catch (Exception e) { 56 } catch (IOException | UnsupportedFlavorException e) { 57 57 Main.warn(e); 58 58 return false; -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/ParentRelationLoadingTask.java
r9999 r10212 188 188 ); 189 189 } 190 } catch (Exception e) { 190 } catch (OsmTransferException e) { 191 191 if (canceled) { 192 192 Main.warn(tr("Ignoring exception because task was canceled. Exception: {0}", e.toString())); -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationEditor.java
r10113 r10212 106 106 return e.getConstructor(Relation.class, Collection.class).newInstance(layer, r, selectedMembers); 107 107 } 108 } catch (Exception ex) { 108 } catch (ReflectiveOperationException ex) { 109 109 Main.warn(ex); 110 110 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationTree.java
r9078 r10212 157 157 ds = reader.parseOsm(progressMonitor 158 158 .createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false)); 159 } catch (Exception e) { 159 } catch (OsmTransferException e) { 160 160 if (canceled) { 161 161 Main.warn(tr("Ignoring exception because task was canceled. Exception: {0}", e.toString())); -
trunk/src/org/openstreetmap/josm/gui/download/BookmarkList.java
r9371 r10212 147 147 try { 148 148 bookmarks.add(new Bookmark(entry)); 149 } catch (Exception e) { 149 } catch (IllegalArgumentException e) { 150 150 Main.error(tr("Error reading bookmark entry: %s", e.getMessage())); 151 151 } -
trunk/src/org/openstreetmap/josm/gui/download/DownloadDialog.java
r10179 r10212 144 144 try { 145 145 tpDownloadAreaSelectors.setSelectedIndex(Main.pref.getInteger("download.tab", 0)); 146 } catch (Exception ex) { 146 } catch (IndexOutOfBoundsException ex) { 147 147 Main.pref.putInteger("download.tab", 0); 148 148 } -
trunk/src/org/openstreetmap/josm/gui/download/PlaceSelection.java
r9972 r10212 41 41 import javax.swing.table.TableCellRenderer; 42 42 import javax.swing.table.TableColumn; 43 import javax.xml.parsers.ParserConfigurationException; 43 44 44 45 import org.openstreetmap.josm.Main; … … 396 397 }); 397 398 } 398 } catch (Exception e) { 399 } catch (IOException | ParserConfigurationException e) { 399 400 if (!canceled) { 400 401 OsmTransferException ex = new OsmTransferException(e); -
trunk/src/org/openstreetmap/josm/gui/help/HelpBrowser.java
r10210 r10212 16 16 import java.awt.event.WindowEvent; 17 17 import java.io.BufferedReader; 18 import java.io.IOException; 18 19 import java.io.InputStreamReader; 19 20 import java.io.StringReader; … … 155 156 css.append('\n'); 156 157 } 157 } catch (Exception e) { 158 } catch (IOException e) { 158 159 Main.error(tr("Failed to read CSS file ''help-browser.css''. Exception is: {0}", e.toString())); 159 160 Main.error(e); … … 239 240 try { 240 241 help.getEditorKit().read(new StringReader(content), document, 0); 241 } catch (Exception e) { 242 } catch (IOException | BadLocationException e) { 242 243 Main.error(e); 243 244 } … … 376 377 history.setCurrentUrl(url); 377 378 this.url = url; 378 } catch (Exception e) { 379 } catch (HelpContentReaderException e) { 379 380 Main.warn(e); 380 381 HelpAwareOptionPane.showOptionDialog( -
trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserDialogManager.java
r10173 r10212 211 211 }); 212 212 } 213 } catch (final Exception e) { 213 } catch (final RuntimeException e) { 214 214 BugReportExceptionHandler.handleException(e); 215 215 } -
trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserModel.java
r10210 r10212 143 143 try { 144 144 HistoryOsmPrimitive.forOsmPrimitive(primitive); 145 } catch (Exception ign) { 145 } catch (IllegalArgumentException ign) { 146 146 return false; 147 147 } -
trunk/src/org/openstreetmap/josm/gui/io/AbstractPrimitiveTask.java
r10129 r10212 113 113 114 114 loadIncompleteNodes(); 115 } catch (Exception e) { 115 } catch (OsmTransferException e) { 116 116 if (canceled) 117 117 return; -
trunk/src/org/openstreetmap/josm/gui/io/CloseChangesetTask.java
r9078 r10212 80 80 closedChangesets.add(cs); 81 81 } 82 } catch (Exception e) { 82 } catch (OsmTransferException e) { 83 83 if (canceled) 84 84 return; -
trunk/src/org/openstreetmap/josm/gui/io/DownloadOpenChangesetsTask.java
r10035 r10212 154 154 getProgressMonitor().createSubTaskMonitor(1, false /* not internal */) 155 155 ); 156 } catch (Exception e) { 156 } catch (OsmTransferException e) { 157 157 if (canceled) 158 158 return; -
trunk/src/org/openstreetmap/josm/gui/io/SaveLayerTask.java
r9078 r10212 56 56 layerInfo.getLayer().onPostSaveToFile(); 57 57 } 58 } catch (Exception e) { 58 } catch (RuntimeException e) { 59 59 Main.error(e); 60 60 setLastException(e); -
trunk/src/org/openstreetmap/josm/gui/io/SaveLayersDialog.java
r10190 r10212 21 21 import java.util.List; 22 22 import java.util.concurrent.CancellationException; 23 import java.util.concurrent.ExecutionException; 23 24 import java.util.concurrent.ExecutorService; 24 25 import java.util.concurrent.Executors; … … 496 497 } catch (CancellationException e) { 497 498 model.setUploadState(layer, UploadOrSaveState.CANCELED); 498 } catch (Exception e) { 499 } catch (InterruptedException | ExecutionException e) { 499 500 Main.error(e); 500 501 model.setUploadState(layer, UploadOrSaveState.FAILED); … … 537 538 } catch (CancellationException e) { 538 539 model.setSaveState(layerInfo.getLayer(), UploadOrSaveState.CANCELED); 539 } catch (Exception e) { 540 } catch (InterruptedException | ExecutionException e) { 540 541 Main.error(e); 541 542 model.setSaveState(layerInfo.getLayer(), UploadOrSaveState.FAILED); -
trunk/src/org/openstreetmap/josm/gui/io/UploadLayerTask.java
r9543 r10212 137 137 } 138 138 } 139 } catch (Exception sxe) { 139 } catch (OsmTransferException sxe) { 140 140 if (isCanceled()) { 141 141 Main.info("Ignoring exception caught because upload is canceled. Exception is: " + sxe); -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java
r10209 r10212 465 465 public void valueChanged(ListSelectionEvent arg0) { 466 466 int index = imgList.getSelectedIndex(); 467 Integer orientation = null; 468 try { 469 orientation = ExifReader.readOrientation(yLayer.data.get(index).getFile()); 470 } catch (Exception e) { 471 Main.warn(e); 472 } 467 Integer orientation = ExifReader.readOrientation(yLayer.data.get(index).getFile()); 473 468 imgDisp.setImage(yLayer.data.get(index).getFile(), orientation); 474 469 Date date = yLayer.data.get(index).getExifTime(); … … 500 495 File sel = fc.getSelectedFile(); 501 496 502 Integer orientation = null; 503 try { 504 orientation = ExifReader.readOrientation(sel); 505 } catch (Exception e) { 506 Main.warn(e); 507 } 497 Integer orientation = ExifReader.readOrientation(sel); 508 498 imgDisp.setImage(sel, orientation); 509 499 510 Date date = null; 511 try { 512 date = ExifReader.readTime(sel); 513 } catch (Exception e) { 514 Main.warn(e); 515 } 500 Date date = ExifReader.readTime(sel); 516 501 if (date != null) { 517 502 lbExifTime.setText(DateUtils.getDateTimeFormat(DateFormat.SHORT, DateFormat.MEDIUM).format(date)); … … 967 952 final long deciSeconds = timezoneOffsetPair.b.getMilliseconds() / 100; 968 953 sldSeconds.setValue((int) (deciSeconds % 60)); 969 } catch (Exception e) { 954 } catch (RuntimeException e) { 970 955 JOptionPane.showMessageDialog(Main.parent, 971 956 tr("An error occurred while trying to match the photos to the GPX track." … … 1015 1000 for (GpxTrackSegment segment : trk.getSegments()) { 1016 1001 for (WayPoint curWp : segment.getWayPoints()) { 1017 try { 1018 final Date parsedTime = curWp.setTimeFromAttribute(); 1019 if (parsedTime != null) { 1020 firstGPXDate = parsedTime.getTime(); 1021 break outer; 1022 } 1023 } catch (Exception e) { 1024 Main.warn(e); 1002 final Date parsedTime = curWp.setTimeFromAttribute(); 1003 if (parsedTime != null) { 1004 firstGPXDate = parsedTime.getTime(); 1005 break outer; 1025 1006 } 1026 1007 } … … 1150 1131 1151 1132 for (WayPoint curWp : segment.getWayPoints()) { 1152 try { 1153 final Date parsedTime = curWp.setTimeFromAttribute(); 1154 if (parsedTime != null) { 1155 final long curWpTime = parsedTime.getTime() + offset; 1156 ret += matchPoints(images, prevWp, prevWpTime, curWp, curWpTime, offset); 1157 1158 prevWp = curWp; 1159 prevWpTime = curWpTime; 1160 continue; 1161 } 1162 } catch (Exception e) { 1163 Main.warn(e); 1133 final Date parsedTime = curWp.setTimeFromAttribute(); 1134 if (parsedTime != null) { 1135 final long curWpTime = parsedTime.getTime() + offset; 1136 ret += matchPoints(images, prevWp, prevWpTime, curWp, curWpTime, offset); 1137 1138 prevWp = curWp; 1139 prevWpTime = curWpTime; 1140 continue; 1164 1141 } 1165 1142 prevWp = null; -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageEntry.java
r9383 r10212 492 492 // default is K (km/h) 493 493 setSpeed(speed); 494 } catch (Exception ex) { 494 } catch (MetadataException ex) { 495 495 if (Main.isDebugEnabled()) { 496 496 Main.debug(ex.getMessage()); … … 516 516 setPos(getExifCoor()); 517 517 518 } catch (Exception ex) { // (other exceptions, e.g. #5271) 518 } catch (MetadataException | IndexOutOfBoundsException ex) { // (other exceptions, e.g. #5271) 519 519 Main.error("Error reading EXIF from file: " + ex); 520 520 setExifCoor(null); … … 527 527 setExifImgDir(direction); 528 528 } 529 } catch (Exception ex) { // ( CompoundException andother exceptions, e.g. #5271)529 } catch (IndexOutOfBoundsException ex) { // (other exceptions, e.g. #5271) 530 530 if (Main.isDebugEnabled()) { 531 531 Main.debug(ex.getMessage()); -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java
r10186 r10212 164 164 int i = Main.pref.getInteger("draw.rawgps.colors", specName(layerName), 0); 165 165 return ColorMode.fromIndex(i); 166 } catch (Exception e) { 166 } catch (IndexOutOfBoundsException e) { 167 167 Main.warn(e); 168 168 } -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/PlayHeadMarker.java
r9779 r10212 51 51 public static PlayHeadMarker create() { 52 52 if (playHead == null) { 53 try { 54 playHead = new PlayHeadMarker(); 55 } catch (Exception ex) { 56 Main.error(ex); 57 return null; 58 } 53 playHead = new PlayHeadMarker(); 59 54 } 60 55 return playHead; -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/WebMarker.java
r8846 r10212 66 66 try { 67 67 setErroneous(path.isEmpty() || !new File(path).exists()); 68 } catch (Exception e) { 68 } catch (SecurityException e) { 69 69 Main.warn(e); 70 70 setErroneous(true); -
trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceTabbedPane.java
r10055 r10212 622 622 } catch (SecurityException ex) { 623 623 Main.error(ex); 624 } catch (Exception ex) { 624 } catch (RuntimeException ex) { 625 625 BugReportExceptionHandler.handleException(ex); 626 626 } finally { … … 636 636 } catch (SecurityException ex) { 637 637 Main.error(ex); 638 } catch (Exception ex) { 638 } catch (RuntimeException ex) { 639 639 // allow to change most settings even if e.g. a plugin fails 640 640 BugReportExceptionHandler.handleException(ex); -
trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java
r10179 r10212 504 504 loader.realRun(); 505 505 return loader.sources; 506 } catch (Exception ex) { 506 } catch (IOException | SAXException | OsmTransferException ex) { 507 507 throw new RuntimeException(ex); 508 508 } -
trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java
r10179 r10212 575 575 movingComponent = ""; 576 576 return true; 577 } catch (Exception e) { 577 } catch (IOException | UnsupportedFlavorException e) { 578 578 Main.error(e); 579 579 } … … 594 594 } 595 595 } 596 } catch (Exception e) { 596 } catch (IOException | UnsupportedFlavorException e) { 597 597 Main.error(e); 598 598 } -
trunk/src/org/openstreetmap/josm/gui/preferences/display/LafPreference.java
r10001 r10212 84 84 new UIManager.LookAndFeelInfo(((LookAndFeel) oquaqua).getName(), "ch.randelshofer.quaqua.QuaquaLookAndFeel") 85 85 ); 86 } catch (Exception ex) { 86 } catch (ReflectiveOperationException ex) { 87 87 // just debug, Quaqua may not even be installed... 88 88 Main.debug(ex.getMessage()); -
trunk/src/org/openstreetmap/josm/gui/preferences/server/OsmApiUrlInputPanel.java
r10179 r10212 36 36 import org.openstreetmap.josm.gui.widgets.SelectAllOnFocusGainedDecorator; 37 37 import org.openstreetmap.josm.io.OsmApi; 38 import org.openstreetmap.josm.io.OsmApiInitializationException; 39 import org.openstreetmap.josm.io.OsmTransferCanceledException; 38 40 import org.openstreetmap.josm.tools.ImageProvider; 39 41 import org.openstreetmap.josm.tools.Utils; … … 157 159 try { 158 160 OsmApi.getOsmApi().initialize(null); 159 } catch (Exception x) { 161 } catch (OsmTransferCanceledException | OsmApiInitializationException x) { 160 162 Main.warn(x); 161 163 } -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetItem.java
r10001 r10212 118 118 try { 119 119 return Integer.valueOf(str); 120 } catch (Exception e) { 120 } catch (NumberFormatException e) { 121 121 if (Main.isTraceEnabled()) { 122 122 Main.trace(e.getMessage()); -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/ComboMultiSelect.java
r9996 r10212 447 447 "public static String[] methodName()")); 448 448 } 449 } catch (Exception e) { 449 } catch (ReflectiveOperationException e) { 450 450 Main.error(tr("Broken tagging preset \"{0}-{1}\" - Java method given in ''values_from'' threw {2} ({3})", key, text, 451 451 e.getClass().getName(), e.getMessage())); -
trunk/src/org/openstreetmap/josm/gui/widgets/AbstractIdTextField.java
r8308 r10212 38 38 validator = klass.getConstructor(JTextComponent.class).newInstance(this); 39 39 } 40 } catch (Exception e) { 40 } catch (ReflectiveOperationException e) { 41 41 Main.error(e); 42 42 } finally { -
trunk/src/org/openstreetmap/josm/io/BoundingBoxDownloader.java
r10194 r10212 192 192 } catch (OsmTransferException e) { 193 193 throw e; 194 } catch (Exception e) { 194 } catch (IllegalDataException | IOException e) { 195 195 throw new OsmTransferException(e); 196 196 } finally { -
trunk/src/org/openstreetmap/josm/io/CachedFile.java
r10194 r10212 352 352 Utils.close(zipFile); 353 353 } 354 } catch (Exception e) { 354 } catch (IOException e) { 355 355 if (file.getName().endsWith(".zip")) { 356 356 Main.warn(tr("Failed to open file with extension ''{2}'' and namepart ''{3}'' in zip file ''{0}''. Exception was: {1}", -
trunk/src/org/openstreetmap/josm/io/FileImporter.java
r9231 r10212 99 99 } 100 100 return false; 101 } catch (Exception e) { 101 } catch (IOException e) { 102 102 displayError(f, e); 103 103 return false; … … 138 138 importData(files, progressMonitor); 139 139 return true; 140 } catch (Exception e) { 140 } catch (IOException | IllegalDataException e) { 141 141 Main.error(e); 142 142 HelpAwareOptionPane.showMessageDialogInEDT( -
trunk/src/org/openstreetmap/josm/io/GpxReader.java
r10045 r10212 409 409 try { 410 410 currentWayPoint.put(localName, Float.valueOf(accumulator.toString())); 411 } catch (Exception e) { 411 } catch (NumberFormatException e) { 412 412 currentWayPoint.put(localName, 0f); 413 413 } -
trunk/src/org/openstreetmap/josm/io/MultiFetchServerObjectReader.java
r9325 r10212 522 522 try { 523 523 result = new FetchResult(OsmReader.parseDataSet(in, progressMonitor.createSubTaskMonitor(pkg.size(), false)), null); 524 } catch (Exception e) { 524 } catch (IllegalDataException e) { 525 525 throw new OsmTransferException(e); 526 526 } … … 550 550 try { 551 551 result = OsmReader.parseDataSet(in, progressMonitor.createSubTaskMonitor(1, false)); 552 } catch (Exception e) { 552 } catch (IllegalDataException e) { 553 553 throw new OsmTransferException(e); 554 554 } -
trunk/src/org/openstreetmap/josm/io/OsmApi.java
r10051 r10212 263 263 Main.addNetworkError(url, Utils.getRootCause(e)); 264 264 throw new OsmApiInitializationException(e); 265 } catch (Exception e) { 265 } catch (SAXException | IOException | ParserConfigurationException e) { 266 266 initialized = false; 267 267 throw new OsmApiInitializationException(e); -
trunk/src/org/openstreetmap/josm/io/OsmApiException.java
r8513 r10212 144 144 .append('>'); 145 145 } 146 } catch (Exception e) { 146 } catch (IllegalArgumentException e) { 147 147 // Ignored 148 148 if (Main.isTraceEnabled()) { … … 157 157 .append('>'); 158 158 } 159 } catch (Exception e) { 159 } catch (IllegalArgumentException e) { 160 160 // Ignored 161 161 if (Main.isTraceEnabled()) { -
trunk/src/org/openstreetmap/josm/io/OsmChangesetParser.java
r10001 r10212 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.io.IOException; 6 7 import java.io.InputStream; 7 8 import java.io.InputStreamReader; … … 283 284 } catch (ParserConfigurationException | SAXException e) { 284 285 throw new IllegalDataException(e.getMessage(), e); 285 } catch (Exception e) { 286 } catch (IOException e) { 286 287 throw new IllegalDataException(e); 287 288 } finally { -
trunk/src/org/openstreetmap/josm/io/OsmReader.java
r9326 r10212 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.io.IOException; 6 7 import java.io.InputStream; 7 8 import java.io.InputStreamReader; … … 651 652 else 652 653 throw new IllegalDataException(msg, e); 653 } catch (Exception e) { 654 } catch (IOException e) { 654 655 throw new IllegalDataException(e); 655 656 } finally { -
trunk/src/org/openstreetmap/josm/io/OsmServerBackreferenceReader.java
r9231 r10212 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.io.IOException; 6 7 import java.io.InputStream; 7 8 import java.text.MessageFormat; … … 135 136 } catch (OsmTransferException e) { 136 137 throw e; 137 } catch (Exception e) { 138 } catch (IOException | IllegalDataException e) { 138 139 if (cancel) 139 140 return null; -
trunk/src/org/openstreetmap/josm/io/OsmServerHistoryReader.java
r9231 r10212 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.io.IOException; 6 7 import java.io.InputStream; 7 8 import java.text.MessageFormat; … … 12 13 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 13 14 import org.openstreetmap.josm.tools.CheckParameterUtil; 15 import org.xml.sax.SAXException; 14 16 15 17 /** … … 72 74 } catch (OsmTransferException e) { 73 75 throw e; 74 } catch (Exception e) { 76 } catch (IOException | SAXException e) { 75 77 if (cancel) 76 78 return null; -
trunk/src/org/openstreetmap/josm/io/OsmServerLocationReader.java
r9990 r10212 52 52 } catch (OsmTransferException e) { 53 53 throw e; 54 } catch (Exception e) { 54 } catch (IOException | SAXException | IllegalDataException e) { 55 55 if (cancel) 56 56 return null; -
trunk/src/org/openstreetmap/josm/io/OsmServerObjectReader.java
r8510 r10212 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.io.IOException; 6 7 import java.io.InputStream; 7 8 import java.text.MessageFormat; … … 134 135 if (cancel) return null; 135 136 throw e; 136 } catch (Exception e) { 137 } catch (IOException | IllegalDataException e) { 137 138 if (cancel) return null; 138 139 throw new OsmTransferException(e); -
trunk/src/org/openstreetmap/josm/io/OsmServerReader.java
r9732 r10212 144 144 try { 145 145 response = client.connect(progressMonitor); 146 } catch (Exception e) { 146 } catch (IOException e) { 147 147 Main.error(e); 148 148 OsmTransferException ote = new OsmTransferException( … … 163 163 try { 164 164 errorBody = response.fetchContent(); 165 } catch (Exception e) { 165 } catch (IOException e) { 166 166 errorBody = tr("Reading error text failed."); 167 167 } … … 173 173 } catch (OsmTransferException e) { 174 174 throw e; 175 } catch (Exception e) { 175 } catch (IOException e) { 176 176 throw new OsmTransferException(e); 177 177 } -
trunk/src/org/openstreetmap/josm/io/OsmServerUserInfoReader.java
r8540 r10212 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.io.IOException; 6 7 import java.io.InputStream; 7 8 import java.util.LinkedList; … … 9 10 10 11 import javax.xml.parsers.DocumentBuilderFactory; 12 import javax.xml.parsers.ParserConfigurationException; 11 13 import javax.xml.xpath.XPath; 12 14 import javax.xml.xpath.XPathConstants; … … 23 25 import org.w3c.dom.Node; 24 26 import org.w3c.dom.NodeList; 27 import org.xml.sax.SAXException; 25 28 26 29 public class OsmServerUserInfoReader extends OsmServerReader { … … 178 181 } catch (OsmTransferException e) { 179 182 throw e; 180 } catch (Exception e) { 183 } catch (IOException | ParserConfigurationException | SAXException e) { 181 184 throw new OsmTransferException(e); 182 185 } finally { -
trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java
r9171 r10212 19 19 import javax.xml.parsers.DocumentBuilder; 20 20 import javax.xml.parsers.DocumentBuilderFactory; 21 import javax.xml.parsers.ParserConfigurationException; 21 22 22 23 import org.openstreetmap.josm.Main; … … 142 143 builderFactory.setValidating(false); 143 144 builderFactory.setNamespaceAware(true); 144 DocumentBuilder builder = null; 145 builder = builderFactory.newDocumentBuilder(); 145 DocumentBuilder builder = builderFactory.newDocumentBuilder(); 146 146 builder.setEntityResolver(new EntityResolver() { 147 147 @Override … … 151 151 } 152 152 }); 153 Document document = null; 154 document = builder.parse(new InputSource(new StringReader(incomingData))); 153 Document document = builder.parse(new InputSource(new StringReader(incomingData))); 155 154 156 155 // Some WMS service URLs specify a different base URL for their GetMap service … … 193 192 List<Element> children = getChildren(capabilityElem, "Layer"); 194 193 layers = parseLayers(children, new HashSet<String>()); 195 } catch (Exception e) { 194 } catch (MalformedURLException | ParserConfigurationException | SAXException e) { 196 195 throw new WMSGetCapabilitiesException(e, incomingData); 197 196 } -
trunk/src/org/openstreetmap/josm/io/remotecontrol/RemoteControlHttpServer.java
r9078 r10212 36 36 instance4 = new RemoteControlHttpServer(port, false); 37 37 instance4.start(); 38 } catch (Exception ex) { 38 } catch (IOException ex) { 39 39 Main.warn(marktr("Cannot start IPv4 remotecontrol server on port {0}: {1}"), 40 40 Integer.toString(port), ex.getLocalizedMessage()); … … 43 43 instance6 = new RemoteControlHttpServer(port, true); 44 44 instance6.start(); 45 } catch (Exception ex) { 45 } catch (IOException ex) { 46 46 /* only show error when we also have no IPv4 */ 47 47 if (instance4 == null) { -
trunk/src/org/openstreetmap/josm/io/remotecontrol/RemoteControlHttpsServer.java
r10060 r10212 333 333 instance4 = new RemoteControlHttpsServer(port, false); 334 334 instance4.start(); 335 } catch (Exception ex) { 335 } catch (IOException | GeneralSecurityException ex) { 336 336 Main.warn(marktr("Cannot start IPv4 remotecontrol https server on port {0}: {1}"), 337 337 Integer.toString(port), ex.getLocalizedMessage()); … … 340 340 instance6 = new RemoteControlHttpsServer(port, true); 341 341 instance6.start(); 342 } catch (Exception ex) { 342 } catch (IOException | GeneralSecurityException ex) { 343 343 /* only show error when we also have no IPv4 */ 344 344 if (instance4 == null) { -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/ImportHandler.java
r9732 r10212 47 47 } 48 48 } 49 } catch (Exception ex) { 49 } catch (RuntimeException ex) { 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
r10131 r10212 145 145 } 146 146 } 147 } catch (Exception ex) { 147 } catch (RuntimeException ex) { 148 148 Main.warn("RemoteControl: Error parsing load_and_zoom remote control request:"); 149 149 Main.error(ex); -
trunk/src/org/openstreetmap/josm/io/session/SessionWriter.java
r9746 r10212 9 9 import java.io.OutputStream; 10 10 import java.io.OutputStreamWriter; 11 import java.lang.reflect.Constructor;12 11 import java.nio.charset.StandardCharsets; 13 12 import java.util.ArrayList; … … 97 96 return null; 98 97 try { 99 Constructor<? extends SessionLayerExporter> constructor = exporterClass.getConstructor(layerClass); 100 return constructor.newInstance(layer); 101 } catch (Exception e) { 98 return exporterClass.getConstructor(layerClass).newInstance(layer); 99 } catch (ReflectiveOperationException e) { 102 100 throw new RuntimeException(e); 103 101 } -
trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
r10179 r10212 15 15 import java.io.File; 16 16 import java.io.FilenameFilter; 17 import java.io.IOException; 17 18 import java.net.URL; 18 19 import java.net.URLClassLoader; … … 723 724 + "Delete from preferences?</html>", plugin.name, plugin.className); 724 725 } 725 } catch (Exception e) { 726 } catch (RuntimeException e) { 726 727 pluginLoadingExceptions.put(plugin.name, e); 727 728 Main.error(e); … … 1193 1194 // Check the plugin is a valid and accessible JAR file before installing it (fix #7754) 1194 1195 new JarFile(updatedPlugin).close(); 1195 } catch (Exception e) { 1196 } catch (IOException e) { 1196 1197 if (dowarn) { 1197 1198 Main.warn(tr("Failed to install plugin ''{0}'' from temporary download file ''{1}''. {2}", … … 1221 1222 try { 1222 1223 new JarFile(jar).close(); 1223 } catch (Exception e) { 1224 } catch (IOException e) { 1224 1225 Main.warn(e); 1225 1226 return false; -
trunk/src/org/openstreetmap/josm/plugins/PluginInformation.java
r9983 r10212 273 273 } 274 274 } 275 } catch (Exception e) { 275 } catch (NumberFormatException e) { 276 276 Main.error(e); 277 277 } -
trunk/src/org/openstreetmap/josm/plugins/PluginProxy.java
r10055 r10212 2 2 package org.openstreetmap.josm.plugins; 3 3 4 import java.lang.reflect.InvocationTargetException; 4 5 import java.util.List; 5 6 … … 45 46 } catch (NoSuchMethodException e) { 46 47 Main.debug("Plugin "+plugin+" does not define mapFrameInitialized"); 47 } catch (Exception e) { 48 } catch (InvocationTargetException | IllegalAccessException | IllegalArgumentException e) { 48 49 handlePluginException(e); 49 50 } … … 57 58 Main.debug("Plugin "+plugin+" does not define getPreferenceSetting"); 58 59 return null; 59 } catch (Exception e) { 60 } catch (InvocationTargetException | IllegalAccessException | IllegalArgumentException e) { 60 61 handlePluginException(e); 61 62 } … … 69 70 } catch (NoSuchMethodException e) { 70 71 Main.debug("Plugin "+plugin+" does not define addDownloadSelection"); 71 } catch (Exception e) { 72 } catch (InvocationTargetException | IllegalAccessException | IllegalArgumentException e) { 72 73 handlePluginException(e); 73 74 } -
trunk/src/org/openstreetmap/josm/tools/AudioPlayer.java
r9814 r10212 207 207 audioPlayer = new AudioPlayer(); 208 208 return audioPlayer; 209 } catch (Exception ex) { 209 } catch (RuntimeException ex) { 210 210 Main.error(ex); 211 211 return null; … … 249 249 AudioInputStream audioInputStream = null; 250 250 SourceDataLine audioOutputLine = null; 251 AudioFormat audioFormat = null;251 AudioFormat audioFormat; 252 252 byte[] abData = new byte[(int) chunk]; 253 253 … … 266 266 command.possiblyInterrupt(); 267 267 for (;;) { 268 int nBytesRead = 0;268 int nBytesRead; 269 269 nBytesRead = audioInputStream.read(abData, 0, abData.length); 270 270 position += nBytesRead / bytesPerSecond; … … 362 362 command.failed(startPlayingException); // sets state 363 363 } 364 } catch (Exception e) { 364 } catch (IOException e) { 365 365 state = State.NOTPLAYING; 366 Main.error(e); 366 367 } 367 368 } -
trunk/src/org/openstreetmap/josm/tools/ExifReader.java
r9970 r10212 78 78 return date; 79 79 } 80 } catch (Exception e) { 80 } catch (UncheckedParseException | JpegProcessingException | IOException e) { 81 81 Main.error(e); 82 82 } -
trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
r10179 r10212 83 83 84 84 import com.kitfox.svg.SVGDiagram; 85 import com.kitfox.svg.SVGException; 85 86 import com.kitfox.svg.SVGUniverse; 86 87 … … 986 987 } 987 988 } 988 } catch (Exception e) { 989 } catch (IOException e) { 989 990 Main.warn(tr("Failed to handle zip file ''{0}''. Exception was: {1}", archive.getName(), e.toString())); 990 991 } … … 1153 1154 } catch (SAXReturnException r) { 1154 1155 return r.getResult(); 1155 } catch (Exception e) { 1156 } catch (IOException | SAXException e) { 1156 1157 Main.warn("Parsing " + base + fn + " failed:\n" + e); 1157 1158 return null; … … 1427 1428 svg.render(g); 1428 1429 } 1429 } catch (Exception ex) { 1430 } catch (SVGException ex) { 1430 1431 Main.error("Unable to load svg: {0}", ex.getMessage()); 1431 1432 return null; -
trunk/src/org/openstreetmap/josm/tools/OpenBrowser.java
r8540 r10212 7 7 import java.io.IOException; 8 8 import java.net.URI; 9 import java.net.URISyntaxException; 9 10 10 11 import org.openstreetmap.josm.Main; … … 62 63 } 63 64 } 64 } catch (Exception e) { 65 } catch (IOException e) { 65 66 Main.warn(e); 66 67 return e.getMessage(); … … 88 89 try { 89 90 return displayUrl(new URI(url)); 90 } catch (Exception e) { 91 } catch (URISyntaxException e) { 91 92 return e.getMessage(); 92 93 } -
trunk/src/org/openstreetmap/josm/tools/XmlObjectParser.java
r10208 r10212 8 8 import java.io.Reader; 9 9 import java.lang.reflect.Field; 10 import java.lang.reflect.InvocationTargetException; 10 11 import java.lang.reflect.Method; 11 12 import java.lang.reflect.Modifier; … … 156 157 } 157 158 } 158 } catch (Exception e) { 159 } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { 159 160 Main.error(e); // SAXException does not dump inner exceptions. 160 161 throwException(e); -
trunk/src/org/openstreetmap/josm/tools/bugreport/BugReportExceptionHandler.java
r10067 r10212 144 144 JPanel p = buildPanel(e); 145 145 JOptionPane.showMessageDialog(Main.parent, p, tr("You have encountered a bug in JOSM"), JOptionPane.ERROR_MESSAGE); 146 } catch (Exception ex) { 146 } catch (RuntimeException ex) { 147 147 Main.error(ex); 148 148 } -
trunk/src/org/openstreetmap/josm/tools/date/DateUtils.java
r10133 r10212 136 136 try { 137 137 return XML_DATE.newXMLGregorianCalendar(str).toGregorianCalendar().getTimeInMillis(); 138 } catch (Exception ex) { 138 } catch (IllegalArgumentException ex) { 139 139 throw new UncheckedParseException("The date string (" + str + ") could not be parsed.", ex); 140 140 }
Note:
See TracChangeset
for help on using the changeset viewer.