Changeset 2480 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2009-11-19T13:30:09+01:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/ExceptionUtil.java
r2387 r2480 14 14 import java.text.SimpleDateFormat; 15 15 import java.util.Date; 16 import java.util.Locale; 16 17 import java.util.regex.Matcher; 17 18 import java.util.regex.Pattern; 18 19 19 20 import org.openstreetmap.josm.Main; 21 import org.openstreetmap.josm.io.ChangesetClosedException; 20 22 import org.openstreetmap.josm.io.OsmApi; 21 23 import org.openstreetmap.josm.io.OsmApiException; 22 24 import org.openstreetmap.josm.io.OsmApiInitializationException; 23 import org.openstreetmap.josm.io.OsmChangesetCloseException;24 25 import org.openstreetmap.josm.io.OsmTransferException; 25 26 … … 39 40 + "Check the server URL in your preferences and your internet connection.</html>", Main.pref.get( 40 41 "osm-server.url", "http://api.openstreetmap.org/api")); 41 return msg;42 }43 44 /**45 * handles an exception caught during OSM API initialization46 *47 * @param e the exception48 */49 public static String explainOsmChangesetCloseException(OsmChangesetCloseException e) {50 e.printStackTrace();51 String changsetId = e.getChangeset() == null ? tr("unknown") : Long.toString(e.getChangeset().getId());52 String msg = tr(53 "<html>Failed to close changeset ''{0}'' on the OSM server ''{1}''.<br>"54 + "The changeset will automatically be closed by the server after a timeout.</html>", changsetId,55 Main.pref.get("osm-server.url", "http://api.openstreetmap.org/api"));56 42 return msg; 57 43 } … … 115 101 if (m.matches()) { 116 102 long changesetId = Long.parseLong(m.group(1)); 117 // Example: Tue Oct 15 10:00:00 UTC 2009 118 DateFormat formatter = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy"); 103 // Example: Tue Oct 15 10:00:00 UTC 2009. Always parsed with english locale, regardless 104 // of the current locale in JOSM 105 DateFormat formatter = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.ENGLISH); 119 106 Date closeDate = null; 120 107 try { … … 153 140 154 141 /** 142 * Explains an exception thrown during upload because the changeset which data is 143 * uploaded to is already closed. 144 * 145 * @param e the exception 146 */ 147 public static String explainChangesetClosedException(ChangesetClosedException e) { 148 String msg; 149 SimpleDateFormat dateFormat = new SimpleDateFormat(); 150 msg = tr( 151 "<html>Failed to upload to changeset <strong>{0}</strong><br>" 152 +"because it has already been closed on {1}.</html>", 153 e.getChangesetId(), 154 dateFormat.format(e.getClosedOn()) 155 ); 156 e.printStackTrace(); 157 return msg; 158 } 159 160 /** 155 161 * Explains an exception with a generic message dialog 156 162 * … … 338 344 if (e instanceof OsmApiInitializationException) 339 345 return explainOsmApiInitializationException((OsmApiInitializationException) e); 340 if (e instanceof OsmChangesetCloseException) 341 return explainOsmChangesetCloseException((OsmChangesetCloseException) e); 346 347 if (e instanceof ChangesetClosedException) 348 return explainChangesetClosedException((ChangesetClosedException)e); 342 349 343 350 if (e instanceof OsmApiException) {
Note:
See TracChangeset
for help on using the changeset viewer.