- Timestamp:
- 2018-10-09T20:04:07+02:00 (6 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/cache/JCSCachedTileLoaderJob.java
r14273 r14311 360 360 String data = urlConn.fetchContent(); 361 361 if (!data.isEmpty()) { 362 Matcher m = HttpClient.getTomcatErrorMatcher(data);363 if ( m.matches()) {364 attributes.setErrorMessage( m.group(1).replace("'", "''"));362 String detectErrorMessage = detectErrorMessage(data); 363 if (detectErrorMessage != null) { 364 attributes.setErrorMessage(detectErrorMessage); 365 365 } 366 366 } … … 418 418 Logging.warn("JCS - Silent failure during download: {0}", getUrlNoException()); 419 419 return false; 420 } 421 422 protected String detectErrorMessage(String data) { 423 Matcher m = HttpClient.getTomcatErrorMatcher(data); 424 return m.matches() ? m.group(1).replace("'", "''") : null; 420 425 } 421 426 -
trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoaderJob.java
r14270 r14311 50 50 public static final LongProperty MINIMUM_EXPIRES = new LongProperty("imagery.generic.minimum_expires", TimeUnit.HOURS.toMillis(1)); 51 51 static final Pattern SERVICE_EXCEPTION_PATTERN = Pattern.compile("(?s).+<ServiceException[^>]*>(.+)</ServiceException>.+"); 52 static final Pattern CDATA_PATTERN = Pattern.compile("(?s)\\s*<!\\[CDATA\\[(.+)\\]\\]>\\s*"); 52 53 protected final Tile tile; 53 54 private volatile URL url; … … 318 319 return true; 319 320 } 321 322 @Override 323 protected String detectErrorMessage(String data) { 324 Matcher m = SERVICE_EXCEPTION_PATTERN.matcher(data); 325 return m.matches() ? removeCdata(Utils.strip(m.group(1))) : super.detectErrorMessage(data); 326 } 327 328 private static String removeCdata(String msg) { 329 Matcher m = CDATA_PATTERN.matcher(msg); 330 return m.matches() ? Utils.strip(m.group(1)) : msg; 331 } 320 332 } -
trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java
r14288 r14311 1167 1167 1168 1168 if (tile.hasError() && getDisplaySettings().isShowErrors()) { 1169 myDrawString(g, tr("Error") + ": " + tr(tile.getErrorMessage()), x + 2, texty); 1169 String errorMessage = tr(tile.getErrorMessage()); 1170 if (errorMessage != null && !errorMessage.startsWith("Error") && !errorMessage.startsWith(tr("Error"))) { 1171 errorMessage = tr("Error") + ": " + errorMessage; 1172 } 1173 myDrawString(g, errorMessage, x + 2, texty); 1170 1174 //texty += 1 + fontHeight; 1171 1175 }
Note:
See TracChangeset
for help on using the changeset viewer.