- Timestamp:
- 2009-09-14T21:13:06+02:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/UploadAction.java
r2115 r2134 8 8 import java.io.IOException; 9 9 import java.net.HttpURLConnection; 10 import java.text.SimpleDateFormat; 10 11 import java.util.Collection; 12 import java.util.Date; 11 13 import java.util.LinkedList; 12 14 import java.util.logging.Logger; … … 33 35 import org.openstreetmap.josm.io.OsmChangesetCloseException; 34 36 import org.openstreetmap.josm.io.OsmServerWriter; 37 import org.openstreetmap.josm.tools.DateUtils; 35 38 import org.openstreetmap.josm.tools.Shortcut; 36 39 import org.xml.sax.SAXException; … … 293 296 294 297 /** 298 * Handles the case that a conflict was detected while uploading where we don't 299 * know what {@see OsmPrimitive} actually caused the conflict (for whatever reason) 300 * 301 */ 302 protected void handleUploadConflictForClosedChangeset(long changsetId, Date d) { 303 String msg = tr("<html>Uploading <strong>failed</strong> because you've been using<br>" 304 + "changeset {0} which was already closed at {1}.<br>" 305 + "Please upload again with a new or an existing open changeset.", 306 changsetId, new SimpleDateFormat().format(d) 307 ); 308 JOptionPane.showMessageDialog( 309 Main.parent, 310 msg, 311 tr("Changeset closed"), 312 JOptionPane.ERROR_MESSAGE 313 ); 314 } 315 316 /** 295 317 * handles an upload conflict, i.e. an error indicated by a HTTP return code 409. 296 318 * … … 303 325 if (m.matches()) { 304 326 handleUploadConflictForKnownConflict(OsmPrimitiveType.from(m.group(3)), Long.parseLong(m.group(4)), m.group(2),m.group(1)); 305 } else { 306 logger.warning(tr("Warning: error header \"{0}\" did not match expected pattern \"{1}\"", e.getErrorHeader(),pattern)); 307 handleUploadConflictForUnknownConflict(); 308 } 327 return; 328 } 329 pattern ="The changeset (\\d+) was closed at (.*)"; 330 m = p.matcher(e.getErrorHeader()); 331 if (m.matches()) { 332 handleUploadConflictForClosedChangeset(Long.parseLong(m.group(1)), DateUtils.fromString(m.group(2))); 333 return; 334 } 335 logger.warning(tr("Warning: error header \"{0}\" did not match expected pattern \"{1}\"", e.getErrorHeader(),pattern)); 336 handleUploadConflictForUnknownConflict(); 309 337 } 310 338
Note:
See TracChangeset
for help on using the changeset viewer.