Changeset 10420 in josm
- Timestamp:
- 2016-06-18T19:54:45+02:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 31 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r10412 r10420 439 439 440 440 /** 441 * Prints a debug message for the given Throwable. Useful for exceptions usually ignored 442 * @param t The throwable object causing the error 443 * @since 10419 444 */ 445 public static void debug(Throwable t) { 446 debug(getErrorMessage(t)); 447 } 448 449 /** 450 * Prints a trace message for the given Throwable. Useful for exceptions usually ignored 451 * @param t The throwable object causing the error 452 * @since 10419 453 */ 454 public static void trace(Throwable t) { 455 trace(getErrorMessage(t)); 456 } 457 458 /** 441 459 * Prints an error message for the given Throwable. 442 460 * @param t The throwable object causing the error … … 452 470 453 471 /** 472 * Prints an error message for the given Throwable. 473 * @param t The throwable object causing the error 474 * @param message additional error message 475 * @since 10419 476 */ 477 public static void error(Throwable t, String message) { 478 warn(message + ' ' + getErrorMessage(t)); 479 } 480 481 /** 454 482 * Prints a warning message for the given Throwable. 455 483 * @param t The throwable object causing the error … … 462 490 t.printStackTrace(); 463 491 } 492 } 493 494 /** 495 * Prints a warning message for the given Throwable. 496 * @param t The throwable object causing the error 497 * @param message additional error message 498 * @since 10419 499 */ 500 public static void warn(Throwable t, String message) { 501 warn(message + ' ' + getErrorMessage(t)); 464 502 } 465 503 … … 1172 1210 pref.saveDefaults(); 1173 1211 } catch (IOException ex) { 1174 Main.warn( tr("Failed to save default preferences."));1212 Main.warn(ex, tr("Failed to save default preferences.")); 1175 1213 } 1176 1214 worker.shutdownNow(); -
trunk/src/org/openstreetmap/josm/actions/SessionSaveAsAction.java
r10318 r10420 81 81 saveSession(); 82 82 } catch (UserCancelException ignore) { 83 if (Main.isTraceEnabled()) { 84 Main.trace(ignore.getMessage()); 85 } 83 Main.trace(ignore); 86 84 } 87 85 } -
trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java
r10409 r10420 82 82 unglue(e); 83 83 } catch (UserCancelException ignore) { 84 Main. debug(ignore.getMessage());84 Main.trace(ignore); 85 85 } finally { 86 86 cleanup(); … … 300 300 */ 301 301 private void unglueOneNodeAtMostOneWay(ActionEvent e) { 302 List<Command> cmds = new LinkedList<>();303 304 302 final PropertiesMembershipDialog dialog; 305 303 try { 306 304 dialog = PropertiesMembershipDialog.showIfNecessary(Collections.singleton(selectedNode), true); 307 } catch (UserCancelException e1) { 305 } catch (UserCancelException ex) { 306 Main.trace(ex); 308 307 return; 309 308 } … … 311 310 final Node n = new Node(selectedNode, true); 312 311 312 List<Command> cmds = new LinkedList<>(); 313 313 cmds.add(new AddCommand(n)); 314 314 if (dialog != null) { … … 513 513 */ 514 514 private void unglueWays() { 515 List<Command> cmds = new LinkedList<>();516 List<Node> newNodes = new LinkedList<>();517 518 515 final PropertiesMembershipDialog dialog; 519 516 try { 520 517 dialog = PropertiesMembershipDialog.showIfNecessary(Collections.singleton(selectedNode), false); 521 518 } catch (UserCancelException e) { 519 Main.trace(e); 522 520 return; 523 521 } 524 522 523 List<Command> cmds = new LinkedList<>(); 524 List<Node> newNodes = new LinkedList<>(); 525 525 if (selectedWay == null) { 526 526 Way wayWithSelectedNode = null; … … 573 573 private boolean unglueSelfCrossingWay() { 574 574 // According to previous check, only one valid way through that node 575 List<Command> cmds = new LinkedList<>();576 575 Way way = null; 577 576 for (Way w: OsmPrimitive.getFilteredList(selectedNode.getReferrers(), Way.class)) { … … 583 582 return false; 584 583 } 584 List<Command> cmds = new LinkedList<>(); 585 585 List<Node> oldNodes = way.getNodes(); 586 586 List<Node> newNodes = new ArrayList<>(oldNodes.size()); … … 617 617 return true; 618 618 } catch (UserCancelException ignore) { 619 Main. debug(ignore.getMessage());619 Main.trace(ignore); 620 620 } 621 621 return false; … … 627 627 */ 628 628 private void unglueOneWayAnyNodes() { 629 List<Command> cmds = new LinkedList<>();630 List<Node> allNewNodes = new LinkedList<>();631 629 Way tmpWay = selectedWay; 632 630 … … 635 633 dialog = PropertiesMembershipDialog.showIfNecessary(selectedNodes, false); 636 634 } catch (UserCancelException e) { 635 Main.trace(e); 637 636 return; 638 637 } 639 638 639 List<Command> cmds = new LinkedList<>(); 640 List<Node> allNewNodes = new LinkedList<>(); 640 641 for (Node n : selectedNodes) { 641 642 List<Node> newNodes = new LinkedList<>(); -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/ChangesetContentDownloadTask.java
r10250 r10420 76 76 // the download was canceled by the user. This exception is caught if the user canceled the authentication dialog. 77 77 setCanceled(true); 78 Main.trace(e); 78 79 return; 79 80 } catch (OsmTransferException e) { -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/ChangesetQueryTask.java
r10378 r10420 71 71 // thrown if user cancel the authentication dialog 72 72 setCanceled(true); 73 Main.trace(e); 73 74 } catch (OsmTransferException e) { 74 75 if (isCanceled()) -
trunk/src/org/openstreetmap/josm/data/Version.java
r10378 r10420 59 59 properties.load(revisionInfo); 60 60 } catch (IOException e) { 61 Main.warn( tr("Error reading revision info from revision file: {0}", e.getMessage()));61 Main.warn(e, tr("Error reading revision info from revision file: {0}", e.getMessage())); 62 62 } 63 63 String value = properties.getProperty("Revision"); -
trunk/src/org/openstreetmap/josm/data/cache/HostLimitQueue.java
r10378 r10420 63 63 url = job.getUrl(); 64 64 } catch (IOException e) { 65 if (Main.isDebugEnabled()) { 66 Main.debug(e.getMessage()); 67 } 65 Main.debug(e); 68 66 } 69 67 Main.debug("TMS - Skipping job {0} because host limit reached", url); -
trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoaderJob.java
r10378 r10420 25 25 import org.openstreetmap.gui.jmapviewer.interfaces.TileSource; 26 26 import org.openstreetmap.gui.jmapviewer.tilesources.AbstractTMSTileSource; 27 import org.openstreetmap.josm.Main; 27 28 import org.openstreetmap.josm.data.cache.BufferedImageCacheEntry; 28 29 import org.openstreetmap.josm.data.cache.CacheEntry; … … 154 155 } catch (IOException e) { 155 156 // if we fail to submit the job, mark tile as loaded and set error message 157 Main.warn(e, false); 156 158 tile.finishLoading(); 157 159 tile.setError(e.getMessage()); -
trunk/src/org/openstreetmap/josm/data/preferences/ParametrizedEnumProperty.java
r9743 r10420 28 28 return Enum.valueOf(enumClass, s); 29 29 } catch (IllegalArgumentException e) { 30 Main.trace(e); 30 31 return defaultValue; 31 32 } -
trunk/src/org/openstreetmap/josm/data/validation/routines/DomainValidator.java
r10411 r10420 20 20 import java.util.Arrays; 21 21 import java.util.Locale; 22 23 import org.openstreetmap.josm.Main; 22 24 23 25 /** … … 1847 1849 } 1848 1850 } catch (IllegalArgumentException e) { // input is not valid 1851 Main.trace(e); 1849 1852 return input; 1850 1853 } -
trunk/src/org/openstreetmap/josm/data/validation/routines/UrlValidator.java
r10338 r10420 27 27 import java.util.regex.Matcher; 28 28 import java.util.regex.Pattern; 29 30 import org.openstreetmap.josm.Main; 29 31 30 32 /** … … 454 456 String norm = uri.normalize().getPath(); 455 457 if (norm.startsWith("/../") // Trying to go via the parent dir 456 || norm.equals("/..")) { // Trying to go to the parent dir458 || "/..".equals(norm)) { // Trying to go to the parent dir 457 459 return false; 458 460 } 459 461 } catch (URISyntaxException e) { 462 Main.trace(e); 460 463 return false; 461 464 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r10413 r10420 1428 1428 tagRowSorter.convertRowIndexToModel(tagTable.getSelectedRow()); 1429 1429 } catch (IndexOutOfBoundsException ignore) { 1430 Main.debug("Clearing tagTable selection, {0}", ignore.toString()); 1430 Main.debug(ignore); 1431 Main.debug("Clearing tagTable selection"); 1431 1432 tagTable.clearSelection(); 1432 1433 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/AddSelectedAfterSelection.java
r9665 r10420 8 8 import org.openstreetmap.josm.Main; 9 9 import org.openstreetmap.josm.gui.dialogs.relation.GenericRelationEditor.AddAbortException; 10 import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor; 10 11 import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel; 11 import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;12 12 import org.openstreetmap.josm.gui.dialogs.relation.SelectionTableModel; 13 13 import org.openstreetmap.josm.tools.ImageProvider; … … 43 43 memberTableModel.getSelectionModel().getMaxSelectionIndex()); 44 44 } catch (AddAbortException ex) { 45 if (Main.isTraceEnabled()) { 46 Main.trace(ex.getMessage()); 47 } 45 Main.trace(ex); 48 46 } 49 47 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/AddSelectedAtEndAction.java
r9665 r10420 8 8 import org.openstreetmap.josm.Main; 9 9 import org.openstreetmap.josm.gui.dialogs.relation.GenericRelationEditor.AddAbortException; 10 import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor; 10 11 import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel; 11 import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;12 12 import org.openstreetmap.josm.gui.dialogs.relation.SelectionTableModel; 13 13 import org.openstreetmap.josm.tools.ImageProvider; … … 42 42 memberTableModel.addMembersAtEnd(filterConfirmedPrimitives(selectionTableModel.getSelection())); 43 43 } catch (AddAbortException ex) { 44 if (Main.isTraceEnabled()) { 45 Main.trace(ex.getMessage()); 46 } 44 Main.trace(ex); 47 45 } 48 46 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/AddSelectedAtStartAction.java
r9665 r10420 8 8 import org.openstreetmap.josm.Main; 9 9 import org.openstreetmap.josm.gui.dialogs.relation.GenericRelationEditor.AddAbortException; 10 import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor; 10 11 import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel; 11 import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;12 12 import org.openstreetmap.josm.gui.dialogs.relation.SelectionTableModel; 13 13 import org.openstreetmap.josm.tools.ImageProvider; … … 42 42 memberTableModel.addMembersAtBeginning(filterConfirmedPrimitives(selectionTableModel.getSelection())); 43 43 } catch (AddAbortException ex) { 44 if (Main.isTraceEnabled()) { 45 Main.trace(ex.getMessage()); 46 } 44 Main.trace(ex); 47 45 } 48 46 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/AddSelectedBeforeSelection.java
r9665 r10420 8 8 import org.openstreetmap.josm.Main; 9 9 import org.openstreetmap.josm.gui.dialogs.relation.GenericRelationEditor.AddAbortException; 10 import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor; 10 11 import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel; 11 import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;12 12 import org.openstreetmap.josm.gui.dialogs.relation.SelectionTableModel; 13 13 import org.openstreetmap.josm.tools.ImageProvider; … … 43 43 memberTableModel.getSelectionModel().getMinSelectionIndex()); 44 44 } catch (AddAbortException ex) { 45 if (Main.isTraceEnabled()) { 46 Main.trace(ex.getMessage()); 47 } 45 Main.trace(ex); 48 46 } 49 47 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/PasteMembersAction.java
r9665 r10420 15 15 import org.openstreetmap.josm.data.osm.PrimitiveData; 16 16 import org.openstreetmap.josm.gui.dialogs.relation.GenericRelationEditor.AddAbortException; 17 import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor; 17 18 import org.openstreetmap.josm.gui.dialogs.relation.MemberTableModel; 18 import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor;19 19 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 20 20 … … 71 71 72 72 } catch (AddAbortException ex) { 73 if (Main.isTraceEnabled()) { 74 Main.trace(ex.getMessage()); 75 } 73 Main.trace(ex); 76 74 } 77 75 } -
trunk/src/org/openstreetmap/josm/gui/io/SaveLayersDialog.java
r10378 r10420 374 374 closeDialog(); 375 375 } catch (UserCancelException ignore) { 376 if (Main.isTraceEnabled()) { 377 Main.trace(ignore.getMessage()); 378 } 376 Main.trace(ignore); 379 377 } 380 378 } -
trunk/src/org/openstreetmap/josm/gui/layer/ImageryLayer.java
r10378 r10420 295 295 } 296 296 } catch (IllegalArgumentException ignore) { 297 if (Main.isTraceEnabled()) { 298 Main.trace(ignore.getMessage()); 299 } 297 Main.trace(ignore); 300 298 } 301 299 final int type = image.getTransparency() == Transparency.OPAQUE ? BufferedImage.TYPE_INT_RGB : BufferedImage.TYPE_INT_ARGB; -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java
r10378 r10420 1032 1032 delta = r.b; 1033 1033 } catch (IndexOutOfBoundsException ex) { 1034 Main.debug(ex); 1034 1035 JOptionPane.showMessageDialog(Main.parent, 1035 1036 tr("The selected photos do not contain time information."), … … 1037 1038 return; 1038 1039 } catch (NoGpxTimestamps ex) { 1040 Main.debug(ex); 1039 1041 JOptionPane.showMessageDialog(Main.parent, 1040 1042 tr("The selected GPX track does not contain timestamps. Please select another one."), -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageEntry.java
r10309 r10420 447 447 setExifTime(ExifReader.readTime(file)); 448 448 } catch (RuntimeException ex) { 449 Main.warn(ex); 449 450 setExifTime(null); 450 451 } … … 467 468 } 468 469 } catch (MetadataException ex) { 469 if (Main.isDebugEnabled()) { 470 Main.debug(ex.getMessage()); 471 } 470 Main.debug(ex); 472 471 } 473 472 … … 491 490 setSpeed(speed); 492 491 } catch (MetadataException ex) { 493 if (Main.isDebugEnabled()) { 494 Main.debug(ex.getMessage()); 495 } 492 Main.debug(ex); 496 493 } 497 494 … … 504 501 setElevation(ele); 505 502 } catch (MetadataException ex) { 506 if (Main.isDebugEnabled()) { 507 Main.debug(ex.getMessage()); 508 } 503 Main.debug(ex); 509 504 } 510 505 … … 526 521 } 527 522 } catch (IndexOutOfBoundsException ex) { // (other exceptions, e.g. #5271) 528 if (Main.isDebugEnabled()) { 529 Main.debug(ex.getMessage()); 530 } 523 Main.debug(ex); 531 524 } 532 525 -
trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java
r10358 r10420 329 329 entry.url); 330 330 Main.error(msg); 331 Main.debug(e); 331 332 HelpAwareOptionPane.showOptionDialog(Main.parent, msg, tr("Warning"), JOptionPane.WARNING_MESSAGE, 332 333 HelpUtil.ht("/Styles/MapCSSImplementation")); -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/NodeElement.java
r10378 r10420 128 128 rotationAngle = RotationAngle.buildStaticRotation(rotationKW.val); 129 129 } catch (IllegalArgumentException ignore) { 130 if (Main.isTraceEnabled()) { 131 Main.trace(ignore.getMessage()); 132 } 130 Main.trace(ignore); 133 131 } 134 132 } -
trunk/src/org/openstreetmap/josm/gui/preferences/map/MapPaintPreference.java
r10114 r10420 167 167 } 168 168 } catch (RuntimeException ignore) { 169 if (Main.isTraceEnabled()) { 170 Main.trace(ignore.getMessage()); 171 } 169 Main.debug(ignore); 172 170 } 173 171 return null; -
trunk/src/org/openstreetmap/josm/gui/preferences/server/OAuthAuthenticationPreferencesPanel.java
r10180 r10420 324 324 wizard.showDialog(); 325 325 } catch (UserCancelException ignore) { 326 Main.trace(ignore .toString());326 Main.trace(ignore); 327 327 return; 328 328 } -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/ComboMultiSelect.java
r10212 r10420 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())); 452 Main.debug(e); 452 453 } 453 454 } -
trunk/src/org/openstreetmap/josm/gui/util/GuiHelper.java
r10372 r10420 578 578 return JOptionPane.getFrameForComponent(parentComponent); 579 579 } catch (HeadlessException e) { 580 if (Main.isDebugEnabled()) { 581 Main.debug(e.getMessage()); 582 } 580 Main.debug(e); 583 581 return null; 584 582 } -
trunk/src/org/openstreetmap/josm/gui/widgets/CompileSearchTextDecorator.java
r9981 r10420 9 9 import javax.swing.text.JTextComponent; 10 10 11 import org.openstreetmap.josm.Main; 11 12 import org.openstreetmap.josm.actions.search.SearchCompiler; 12 13 … … 46 47 textComponent.setToolTipText(ex.getMessage()); 47 48 filter = SearchCompiler.Always.INSTANCE; 49 Main.debug(ex); 48 50 } 49 51 textComponent.firePropertyChange("filter", 0, 1); -
trunk/src/org/openstreetmap/josm/io/OsmServerReader.java
r10378 r10420 160 160 if (response.getResponseCode() != HttpURLConnection.HTTP_OK) { 161 161 String errorHeader = response.getHeaderField("Error"); 162 String errorBody; 163 try { 164 errorBody = response.fetchContent(); 165 } catch (IOException e) { 166 errorBody = tr("Reading error text failed."); 167 } 162 String errorBody = fetchResponseText(response); 168 163 throw new OsmApiException(response.getResponseCode(), errorHeader, errorBody, url.toString()); 169 164 } … … 178 173 } finally { 179 174 progressMonitor.invalidate(); 175 } 176 } 177 178 private static String fetchResponseText(final HttpClient.Response response) { 179 try { 180 return response.fetchContent(); 181 } catch (IOException e) { 182 Main.error(e); 183 return tr("Reading error text failed."); 180 184 } 181 185 } -
trunk/src/org/openstreetmap/josm/tools/HttpClient.java
r10302 r10420 262 262 in = connection.getInputStream(); 263 263 } catch (IOException ioe) { 264 Main.debug(ioe); 264 265 in = connection.getErrorStream(); 265 266 } -
trunk/src/org/openstreetmap/josm/tools/bugreport/BugReportExceptionHandler.java
r10285 r10420 103 103 } 104 104 } catch (IOException | NumberFormatException ex) { 105 Main.warn( "Unable to detect latest version of JOSM: "+ex.getMessage());105 Main.warn(ex, "Unable to detect latest version of JOSM:"); 106 106 } 107 107 } … … 137 137 Main.platform.openUrl(Main.getJOSMWebsite()); 138 138 } catch (IOException ex) { 139 Main.warn( "Unable to access JOSM website: "+ex.getMessage());139 Main.warn(ex, "Unable to access JOSM website:"); 140 140 } 141 141 } else {
Note:
See TracChangeset
for help on using the changeset viewer.