- Timestamp:
- 2009-07-11T06:38:06+02:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/UploadAction.java
r1750 r1760 530 530 return; 531 531 } 532 // any other API exception 533 // 534 else { 535 ex.printStackTrace(); 536 String msg = tr("<html>Uploading <strong>failed</strong>." 537 + "<br>" 538 + "{0}" 539 + "</html>", 540 ex.getDisplayMessage() 541 ); 542 JOptionPane.showMessageDialog( 543 Main.map, 544 msg, 545 tr("Upload to OSM API failed"), 546 JOptionPane.ERROR_MESSAGE 547 ); 548 return; 549 } 532 550 } 533 551 534 552 // For any other exception just notify the user 535 553 // 536 String msg ;537 if ( e.getMessage()== null) {554 String msg = e.getMessage(); 555 if (msg == null) { 538 556 msg = e.toString(); 539 } else {540 msg = e.getMessage();541 557 } 542 558 e.printStackTrace(); 543 559 JOptionPane.showMessageDialog( 544 null,560 Main.map, 545 561 msg, 546 562 tr("Upload to OSM API failed"), -
trunk/src/org/openstreetmap/josm/io/OsmApiException.java
r1749 r1760 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.io; 3 import static org.openstreetmap.josm.tools.I18n.tr; 3 4 4 5 public class OsmApiException extends OsmTransferException { … … 65 66 } 66 67 if (errorBody != null) { 67 errorBody = errorBody. replaceAll("^[ \n\t\r]+", "").replaceAll("[ \n\t\r]+$", "");68 errorBody = errorBody.trim(); 68 69 if(!errorBody.equals(errorHeader)) { 69 70 sb.append(", Error Body=<") … … 74 75 return sb.toString(); 75 76 } 77 78 /** 79 * Replies a message suitable to be displayed in a message dialog 80 * 81 * @return a message which is suitable to be displayed in a message dialog 82 */ 83 public String getDisplayMessage() { 84 StringBuilder sb = new StringBuilder(); 85 if (errorHeader != null) { 86 sb.append(tr(errorHeader)); 87 sb.append(tr("(Code={0})", responseCode)); 88 } else if (errorBody != null) { 89 errorBody = errorBody.trim(); 90 sb.append(tr(errorBody)); 91 sb.append(tr("(Code={0})", responseCode)); 92 } else { 93 sb.append(tr("The server replied an error with code {0}", responseCode)); 94 } 95 return sb.toString(); 96 } 76 97 }
Note:
See TracChangeset
for help on using the changeset viewer.