Changeset 9876 in josm
- Timestamp:
- 2016-02-24T11:14:39+01:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/ExceptionUtil.java
r9474 r9876 356 356 + "Communication with the OSM server ''{0}'' timed out. Please retry later." 357 357 + "</html>", 358 OsmApi.getOsmApi().getBaseUrl()358 getUrlFromException(e) 359 359 ); 360 360 } … … 381 381 + "<strong>Error message (untranslated)</strong>: {2}" 382 382 + "</html>", 383 OsmApi.getOsmApi().getBaseUrl(),383 getUrlFromException(e), 384 384 e.getResponseCode(), 385 385 errMsg … … 572 572 */ 573 573 public static String explainBadRequest(OsmApiException e) { 574 String url = null; 575 if (e.getAccessedUrl() != null) { 576 try { 577 url = new URL(e.getAccessedUrl()).getHost(); 578 } catch (MalformedURLException e1) { 579 Main.warn(e1); 580 } 581 } 582 if (url == null && e.getUrl() != null) { 583 url = e.getUrl(); 584 } else if (url == null) { 585 url = OsmApi.getOsmApi().getBaseUrl(); 586 } 587 String message = tr("The OSM server ''{0}'' reported a bad request.<br>", url); 574 String message = tr("The OSM server ''{0}'' reported a bad request.<br>", getUrlFromException(e)); 588 575 String errorHeader = e.getErrorHeader(); 589 576 if (errorHeader != null && (errorHeader.startsWith("The maximum bbox") || … … 619 606 */ 620 607 public static String explainNotFound(OsmApiException e) { 621 String apiUrl = OsmApi.getOsmApi().getBaseUrl();622 608 String message = tr("The OSM server ''{0}'' does not know about an object<br>" 623 609 + "you tried to read, update, or delete. Either the respective object<br>" 624 610 + "does not exist on the server or you are using an invalid URL to access<br>" 625 611 + "it. Please carefully check the server''s address ''{0}'' for typos.", 626 apiUrl);612 getUrlFromException(e)); 627 613 Main.error(e); 628 614 return "<html>" + message + "</html>"; … … 747 733 } 748 734 } 735 736 static String getUrlFromException(OsmApiException e) { 737 if (e.getAccessedUrl() != null) { 738 try { 739 return new URL(e.getAccessedUrl()).getHost(); 740 } catch (MalformedURLException e1) { 741 Main.warn(e1); 742 } 743 } 744 if (e.getUrl() != null) { 745 return e.getUrl(); 746 } else { 747 return OsmApi.getOsmApi().getBaseUrl(); 748 } 749 } 749 750 }
Note:
See TracChangeset
for help on using the changeset viewer.