- Timestamp:
- 2016-06-24T01:27:35+02:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/AutosaveTask.java
r10444 r10469 187 187 } 188 188 } catch (IOException e) { 189 Main.error( tr("IOError while creating file, autosave will be skipped: {0}", e.getMessage()));189 Main.error(e, tr("IOError while creating file, autosave will be skipped: {0}", e.getMessage())); 190 190 return null; 191 191 } -
trunk/src/org/openstreetmap/josm/data/CustomConfigurator.java
r10404 r10469 96 96 97 97 /** 98 * Log an exception. 99 * @param e exception to log 100 * @param s message prefix 101 * @since 10469 102 */ 103 public static void log(Exception e, String s) { 104 summary.append(s + ' ' + Main.getErrorMessage(e)); 105 summary.append('\n'); 106 } 107 108 /** 98 109 * Returns the log. 99 110 * @return the log … … 273 284 root = document.getDocumentElement(); 274 285 } catch (SAXException | IOException | ParserConfigurationException ex) { 275 Main.warn( "Error getting preferences to save:" +ex.getMessage());286 Main.warn(ex, "Error getting preferences to save:"); 276 287 } 277 288 if (root == null || exportDocument == null) … … 454 465 } 455 466 } catch (ScriptException | IOException | SecurityException ex) { 456 log( "Error reading custom preferences: " + ex.getMessage());467 log(ex, "Error reading custom preferences:"); 457 468 } 458 469 } … … 465 476 } 466 477 } catch (SAXException | IOException | ParserConfigurationException ex) { 467 log( "Error reading custom preferences: "+ex.getMessage());478 log(ex, "Error reading custom preferences:"); 468 479 } 469 480 log("-- Reading complete --"); … … 580 591 // we store this fragment as API.fragments['id'] 581 592 } catch (ScriptException ex) { 582 log( "Error: can not load preferences fragment : "+ex.getMessage());593 log(ex, "Error: can not load preferences fragment:"); 583 594 } 584 595 } … … 664 675 engine.eval(name+"='"+value+"';"); 665 676 } catch (ScriptException ex) { 666 log( "Error: Can not assign variable: %s=%s : %s\n", name, value, ex.getMessage());677 log(ex, String.format("Error: Can not assign variable: %s=%s :", name, value)); 667 678 } 668 679 } … … 707 718 } catch (ScriptException ex) { 708 719 messageBox("e", ex.getMessage()); 709 log( "JS error: "+ex.getMessage());720 log(ex, "JS error:"); 710 721 } 711 722 log("Script finished"); … … 725 736 mr.appendReplacement(sb, result); 726 737 } catch (ScriptException ex) { 727 log( "Error: Can not evaluate expression %s : %s", mr.group(1), ex.getMessage());738 log(ex, String.format("Error: Can not evaluate expression %s :", mr.group(1))); 728 739 } 729 740 } … … 746 757 tmpPref.fromXML(reader); 747 758 } catch (TransformerException | XMLStreamException | IOException ex) { 748 log( "Error: can not read XML fragment :" + ex.getMessage());759 log(ex, "Error: can not read XML fragment:"); 749 760 } 750 761 -
trunk/src/org/openstreetmap/josm/data/Preferences.java
r10380 r10469 909 909 save(); 910 910 } catch (IOException e) { 911 Main.warn( tr("Failed to persist preferences to ''{0}''", getPreferenceFile().getAbsoluteFile()));911 Main.warn(e, tr("Failed to persist preferences to ''{0}''", getPreferenceFile().getAbsoluteFile())); 912 912 } 913 913 } … … 1251 1251 struct = klass.getConstructor().newInstance(); 1252 1252 } catch (ReflectiveOperationException ex) { 1253 throw new RuntimeException(ex);1253 throw new IllegalArgumentException(ex); 1254 1254 } 1255 1255 for (Entry<String, String> key_value : hash.entrySet()) { … … 1259 1259 f = klass.getDeclaredField(key_value.getKey().replace('-', '_')); 1260 1260 } catch (NoSuchFieldException ex) { 1261 Main.trace(ex); 1261 1262 continue; 1262 1263 } -
trunk/src/org/openstreetmap/josm/data/cache/CacheEntryAttributes.java
r10378 r10469 188 188 189 189 /** 190 * @param error error related to this object 191 * @since 10469 192 */ 193 public void setError(Exception error) { 194 setErrorMessage(Main.getErrorMessage(error)); 195 } 196 197 /** 190 198 * @param message error message related to this object 191 199 */ -
trunk/src/org/openstreetmap/josm/data/cache/JCSCachedTileLoaderJob.java
r10408 r10469 378 378 log.log(Level.FINE, "JCS - Caching empty object as server returned 404 for: {0}", getUrlNoException()); 379 379 attributes.setResponseCode(404); 380 attributes.setError Message(e.toString());380 attributes.setError(e); 381 381 boolean doCache = isResponseLoadable(null, 404, null) || cacheAsEmpty(); 382 382 if (doCache) { … … 387 387 } catch (IOException e) { 388 388 log.log(Level.FINE, "JCS - IOExecption during communication with server for: {0}", getUrlNoException()); 389 attributes.setError Message(e.toString());389 attributes.setError(e); 390 390 attributes.setResponseCode(499); // set dummy error code 391 391 boolean doCache = isResponseLoadable(null, 499, null) || cacheAsEmpty(); //generic 499 error code returned … … 396 396 return doCache; 397 397 } catch (InterruptedException e) { 398 attributes.setError Message(e.toString());398 attributes.setError(e); 399 399 log.log(Level.WARNING, "JCS - Exception during download {0}", getUrlNoException()); 400 400 Main.warn(e); -
trunk/src/org/openstreetmap/josm/data/imagery/CachedAttributionBingAerialTileSource.java
r9970 r10469 77 77 return ret; 78 78 } catch (IOException ex) { 79 Main.warn( "Could not connect to Bing API. Will retry in " + waitTimeSec + " seconds.");79 Main.warn(ex, "Could not connect to Bing API. Will retry in " + waitTimeSec + " seconds."); 80 80 Thread.sleep(waitTimeSec * 1000L); 81 81 waitTimeSec *= 2; -
trunk/src/org/openstreetmap/josm/data/imagery/ImageryLayerInfo.java
r10000 r10469 143 143 OnlineResource.JOSM_WEBSITE.checkOfflineAccess(source, Main.getJOSMWebsite()); 144 144 } catch (OfflineAccessException e) { 145 Main.warn(e .getMessage());145 Main.warn(e, false); 146 146 online = false; 147 147 } -
trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoaderJob.java
r10420 r10469 210 210 } catch (IOException e) { 211 211 LOG.log(Level.WARNING, "JCS TMS - error loading object for tile {0}: {1}", new Object[] {tile.getKey(), e.getMessage()}); 212 tile.setError(e .toString());212 tile.setError(e); 213 213 tile.setLoaded(false); 214 214 if (listeners != null) { // listeners might be null, if some other thread notified already about success -
trunk/src/org/openstreetmap/josm/data/osm/MultipolygonBuilder.java
r9774 r10469 19 19 import java.util.concurrent.RecursiveTask; 20 20 21 import org.openstreetmap.josm.Main; 21 22 import org.openstreetmap.josm.tools.Geometry; 22 23 import org.openstreetmap.josm.tools.Geometry.PolygonIntersection; … … 144 145 return makeFromPolygons(joinedWays); 145 146 } catch (JoinedPolygonCreationException ex) { 147 Main.debug(ex); 146 148 return ex.getMessage(); 147 149 } -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r10378 r10469 875 875 return SearchCompiler.compile(Main.pref.get(prefName, defaultValue)); 876 876 } catch (ParseError e) { 877 Main.error( "Unable to compile pattern for " + prefName + ", trying default pattern: " + e.getMessage());877 Main.error(e, "Unable to compile pattern for " + prefName + ", trying default pattern:"); 878 878 } 879 879 -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/AbstractMapRenderer.java
r10303 r10469 145 145 // On read, it would first check, if the way still has firstIdx+2 nodes, then check if the corresponding way nodes are still 146 146 // the same and report changes in a more controlled manner. 147 if (Main.isTraceEnabled()) { 148 Main.trace(e.getMessage()); 149 } 147 Main.trace(e); 150 148 } 151 149 } -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/MapRendererFactory.java
r10378 r10469 101 101 return Class.forName(className, true, cl); 102 102 } catch (final NoClassDefFoundError | ClassNotFoundException e) { 103 Main.trace(e .getMessage());103 Main.trace(e); 104 104 } 105 105 } … … 266 266 * @see AbstractMapRenderer#AbstractMapRenderer(Graphics2D, NavigatableComponent, boolean) 267 267 */ 268 public AbstractMapRenderer createActiveRenderer(Graphics2D g, NavigatableComponent viewport, boolean isInactiveMode) 269 throws MapRendererFactoryException { 268 public AbstractMapRenderer createActiveRenderer(Graphics2D g, NavigatableComponent viewport, boolean isInactiveMode) { 270 269 try { 271 270 Constructor<?> c = activeRenderer.getConstructor(new Class<?>[]{Graphics2D.class, NavigatableComponent.class, boolean.class}); … … 274 273 throw new MapRendererFactoryException(e); 275 274 } catch (InvocationTargetException e) { 275 Main.debug(e); 276 276 throw new MapRendererFactoryException(e.getCause()); 277 277 } -
trunk/src/org/openstreetmap/josm/data/projection/CustomProjection.java
r10378 r10469 205 205 update(pref); 206 206 } catch (ProjectionConfigurationException ex) { 207 Main.trace(ex); 207 208 try { 208 209 update(null); -
trunk/src/org/openstreetmap/josm/data/projection/Projections.java
r10212 r10469 324 324 proj = pc.getProjection(); 325 325 } catch (RuntimeException e) { 326 String cause = e.getMessage(); 327 Main.warn("Unable to get projection "+code+" with "+pc + (cause != null ? ". "+cause : "")); 326 Main.warn(e, "Unable to get projection "+code+" with "+pc+':'); 328 327 } 329 328 } -
trunk/src/org/openstreetmap/josm/data/validation/TestError.java
r9989 r10469 361 361 primitives = Collections.emptyList(); 362 362 } else { 363 Main.warn( "Unable to remove primitives from "+this);363 Main.warn(e, "Unable to remove primitives from "+this+'.'); 364 364 } 365 365 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/ConditionalKeys.java
r10300 r10469 13 13 import java.util.regex.Pattern; 14 14 15 import org.openstreetmap.josm.Main; 15 16 import org.openstreetmap.josm.data.osm.OsmPrimitive; 16 17 import org.openstreetmap.josm.data.validation.Severity; … … 141 142 } 142 143 } catch (ConditionalParsingException ex) { 144 Main.debug(ex); 143 145 return ex.getMessage(); 144 146 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/InternetTags.java
r9921 r10469 7 7 import java.util.regex.Pattern; 8 8 9 import org.openstreetmap.josm.Main; 9 10 import org.openstreetmap.josm.data.osm.Node; 10 11 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 107 108 error = doValidateTag(p, k, protocol+IDN.toASCII(domain)+ending, validator, code); 108 109 } catch (IllegalArgumentException e) { 110 Main.trace(e); 109 111 error.setMessage(error.getMessage() + 110 112 tr(" URL cannot be converted to ASCII: {0}", e.getMessage())); -
trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java
r10212 r10469 301 301 check.errors.put(ai, severity); 302 302 } catch (IllegalArgumentException e) { 303 Main.warn( "Unsupported "+ai.key+" instruction. Allowed instructions are "+POSSIBLE_THROWS);303 Main.warn(e, "Unsupported "+ai.key+" instruction. Allowed instructions are "+POSSIBLE_THROWS+'.'); 304 304 } 305 305 } else if ("fixAdd".equals(ai.key)) { … … 436 436 } 437 437 } catch (IndexOutOfBoundsException ignore) { 438 if (Main.isDebugEnabled()) { 439 Main.debug(ignore.getMessage()); 440 } 438 Main.debug(ignore); 441 439 } 442 440 return null; … … 466 464 m.appendReplacement(sb, String.valueOf(argument).replace("^(", "").replace(")$", "")); 467 465 } catch (IndexOutOfBoundsException | IllegalArgumentException e) { 468 Main.error( tr("Unable to replace argument {0} in {1}: {2}", argument, sb, e.getMessage()));466 Main.error(e, tr("Unable to replace argument {0} in {1}: {2}", argument, sb, e.getMessage())); 469 467 } 470 468 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java
r10378 r10469 245 245 } 246 246 } catch (IOException e) { 247 Main.error(e); 247 248 errorSources.append(source).append('\n'); 248 249 } … … 294 295 harmonizedKeys.put(harmonizeKey(ky.key), ky.key); 295 296 } catch (NullPointerException e) { 296 Main.error( p+": Unable to initialize "+ky);297 Main.error(e, p+": Unable to initialize "+ky+'.'); 297 298 } 298 299 } … … 783 784 } 784 785 } catch (IllegalStateException e) { 786 Main.error(e); 785 787 description = null; 786 788 } … … 825 827 data.add(new CheckerElement(exp)); 826 828 } catch (IllegalStateException e) { 829 Main.trace(e); 827 830 return tr("Illegal expression ''{0}''", exp); 828 831 } catch (PatternSyntaxException e) { 832 Main.trace(e); 829 833 return tr("Illegal regular expression ''{0}''", exp); 830 834 }
Note:
See TracChangeset
for help on using the changeset viewer.