Changeset 7024 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2014-04-29T02:38:59+02:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/ExceptionUtil.java
r7005 r7024 50 50 public static String explainOsmApiInitializationException(OsmApiInitializationException e) { 51 51 Main.error(e); 52 String msg =tr(52 return tr( 53 53 "<html>Failed to initialize communication with the OSM server {0}.<br>" 54 54 + "Check the server URL in your preferences and your internet connection.", 55 55 Main.pref.get("osm-server.url", OsmApi.DEFAULT_API_URL)); 56 return msg;57 56 } 58 57 … … 65 64 public static String explainMissingOAuthAccessTokenException(MissingOAuthAccessTokenException e) { 66 65 Main.error(e); 67 String msg =tr(66 return tr( 68 67 "<html>Failed to authenticate at the OSM server ''{0}''.<br>" 69 68 + "You are using OAuth to authenticate but currently there is no<br>" … … 73 72 Main.pref.get("osm-server.url", OsmApi.DEFAULT_API_URL) 74 73 ); 75 return msg;76 74 } 77 75 … … 411 409 */ 412 410 public static String explainChangesetClosedException(ChangesetClosedException e) { 413 String msg;414 411 SimpleDateFormat dateFormat = new SimpleDateFormat(); 415 msg = tr( 412 Main.error(e); 413 return tr( 416 414 "<html>Failed to upload to changeset <strong>{0}</strong><br>" 417 415 +"because it has already been closed on {1}.", … … 419 417 e.getClosedOn() == null ? "?" : dateFormat.format(e.getClosedOn()) 420 418 ); 421 Main.error(e);422 return msg;423 419 } 424 420 … … 454 450 } 455 451 456 String message =tr("<html>Failed to open a connection to the remote server<br>" + "''{0}''<br>"452 return tr("<html>Failed to open a connection to the remote server<br>" + "''{0}''<br>" 457 453 + "for security reasons. This is most likely because you are running<br>" 458 454 + "in an applet and because you did not load your applet from ''{1}''.", apiUrl, host); 459 return message;460 455 } 461 456 … … 467 462 * @param e the exception 468 463 */ 469 470 464 public static String explainNestedSocketException(OsmTransferException e) { 471 String apiUrl = e.getUrl(); 472 String message = tr("<html>Failed to open a connection to the remote server<br>" + "''{0}''.<br>" 473 + "Please check your internet connection.", apiUrl); 474 Main.error(e); 475 return message; 465 Main.error(e); 466 return tr("<html>Failed to open a connection to the remote server<br>" + "''{0}''.<br>" 467 + "Please check your internet connection.", e.getUrl()); 476 468 } 477 469 … … 483 475 * @param e the exception 484 476 */ 485 486 477 public static String explainNestedIOException(OsmTransferException e) { 487 478 IOException ioe = getNestedException(e, IOException.class); 488 String apiUrl = e.getUrl();489 String message =tr("<html>Failed to upload data to or download data from<br>" + "''{0}''<br>"479 Main.error(e); 480 return tr("<html>Failed to upload data to or download data from<br>" + "''{0}''<br>" 490 481 + "due to a problem with transferring data.<br>" 491 + "Details (untranslated): {1}</html>", apiUrl, ioe482 + "Details (untranslated): {1}</html>", e.getUrl(), ioe 492 483 .getMessage()); 493 Main.error(e);494 return message;495 484 } 496 485 … … 503 492 public static String explainNestedIllegalDataException(OsmTransferException e) { 504 493 IllegalDataException ide = getNestedException(e, IllegalDataException.class); 505 String message = tr("<html>Failed to download data. " 494 Main.error(e); 495 return tr("<html>Failed to download data. " 506 496 + "Its format is either unsupported, ill-formed, and/or inconsistent.<br>" 507 497 + "<br>Details (untranslated): {0}</html>", ide.getMessage()); 508 Main.error(e);509 return message;510 498 } 511 499 … … 516 504 * @param e the exception 517 505 */ 518 519 506 public static String explainInternalServerError(OsmTransferException e) { 520 String apiUrl = e.getUrl(); 521 String message = tr("<html>The OSM server<br>" + "''{0}''<br>" + "reported an internal server error.<br>" 522 + "This is most likely a temporary problem. Please try again later.", apiUrl); 523 Main.error(e); 524 return message; 507 Main.error(e); 508 return tr("<html>The OSM server<br>" + "''{0}''<br>" + "reported an internal server error.<br>" 509 + "This is most likely a temporary problem. Please try again later.", e.getUrl()); 525 510 } 526 511 … … 543 528 message += tr("<br>Error message(untranslated): {0}", e.getErrorHeader()); 544 529 } 545 message = "<html>" + message + "</html>"; 546 Main.error(e); 547 return message; 530 Main.error(e); 531 return "<html>" + message + "</html>"; 548 532 } 549 533 … … 555 539 */ 556 540 public static String explainBandwidthLimitExceeded(OsmApiException e) { 541 Main.error(e); 557 542 // TODO: Write a proper error message 558 String message = explainGenericOsmApiException(e); 559 Main.error(e); 560 return message; 561 } 562 543 return explainGenericOsmApiException(e); 544 } 563 545 564 546 /** … … 574 556 + "it. Please carefully check the server''s address ''{0}'' for typos." 575 557 , apiUrl); 576 message = "<html>" + message + "</html>"; 577 Main.error(e); 578 return message; 558 Main.error(e); 559 return "<html>" + message + "</html>"; 579 560 } 580 561 … … 596 577 } 597 578 598 String message = tr("<html>Failed to open a connection to the remote server<br>" + "''{0}''.<br>" 579 Main.error(e); 580 return tr("<html>Failed to open a connection to the remote server<br>" + "''{0}''.<br>" 599 581 + "Host name ''{1}'' could not be resolved. <br>" 600 582 + "Please check the API URL in your preferences and your internet connection.", apiUrl, host); 601 Main.error(e);602 return message;603 583 } 604 584 … … 669 649 */ 670 650 public static String explainGoneForUnknownPrimitive(OsmApiException e) { 671 String msg =tr(651 return tr( 672 652 "<html>The server reports that an object is deleted.<br>" 673 653 + "<strong>Uploading failed</strong> if you tried to update or delete this object.<br> " … … 676 656 + "The error message is:<br>" + "{0}" 677 657 + "</html>", escapeReservedCharactersHTML(e.getMessage())); 678 return msg;679 680 658 } 681 659 … … 686 664 */ 687 665 public static String explainException(Exception e) { 688 String msg = "";666 Main.error(e); 689 667 if (e instanceof OsmTransferException) { 690 msg =explainOsmTransferException((OsmTransferException) e);668 return explainOsmTransferException((OsmTransferException) e); 691 669 } else { 692 msg = explainGeneric(e); 693 } 694 Main.error(e); 695 return msg; 670 return explainGeneric(e); 671 } 696 672 } 697 673 -
trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
r7012 r7024 804 804 img = overlay(img, ImageProvider.get("cursor/modifier/" + overlay), OverlayPosition.SOUTHEAST); 805 805 } 806 Cursor c =Toolkit.getDefaultToolkit().createCustomCursor(img.getImage(),806 return Toolkit.getDefaultToolkit().createCustomCursor(img.getImage(), 807 807 "crosshair".equals(name) ? new Point(10, 10) : new Point(3, 2), "Cursor"); 808 return c;809 808 } 810 809
Note:
See TracChangeset
for help on using the changeset viewer.