Changeset 14810 in josm for trunk/src/org
- Timestamp:
- 2019-02-24T23:31:36+01:00 (6 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/ExceptionDialogUtil.java
r14340 r14810 335 335 String body = e.getErrorBody(); 336 336 Object msg = null; 337 if ( "text/html".equals(e.getContentType()) && body != null && body.startsWith("<") && body.contains("<html>")) {337 if (e.isHtml() && body != null && body.startsWith("<") && body.contains("<html>")) { 338 338 msg = new HtmlPanel(body); 339 339 } else { -
trunk/src/org/openstreetmap/josm/io/OsmApiException.java
r14273 r14810 4 4 5 5 import org.openstreetmap.josm.tools.Logging; 6 import org.openstreetmap.josm.tools.Utils; 6 7 7 8 /** … … 32 33 this.responseCode = responseCode; 33 34 this.errorHeader = errorHeader; 34 this.errorBody = errorBody;35 this.errorBody = Utils.strip(errorBody); 35 36 this.accessedUrl = accessedUrl; 36 37 this.login = login; 37 38 this.contentType = contentType; 39 checkHtmlBody(); 38 40 } 39 41 … … 111 113 public OsmApiException(String message, Throwable cause) { 112 114 super(message, cause); 115 } 116 117 private void checkHtmlBody() { 118 if (errorBody != null && errorBody.matches("^<.*>.*<.*>$")) { 119 setContentType("text/html"); 120 if (!errorBody.contains("<html>")) { 121 errorBody = "<html>" + errorBody + "</html>"; 122 } 123 } 113 124 } 114 125 … … 268 279 return contentType; 269 280 } 281 282 /** 283 * Determines if the exception has {@code text/html} as content type. 284 * @return {@code true} if the exception has {@code text/html} as content type. 285 * @since xxx 286 */ 287 public final boolean isHtml() { 288 return "text/html".equals(contentType); 289 } 270 290 }
Note:
See TracChangeset
for help on using the changeset viewer.