Changeset 10212 in josm for trunk/src/org/openstreetmap/josm/actions
- Timestamp:
- 2016-05-15T00:51:10+02:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/actions
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
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 error81 * 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);
Note:
See TracChangeset
for help on using the changeset viewer.