Changeset 2025 in josm for trunk/src/org/openstreetmap/josm/io/OsmServerWriter.java
- Timestamp:
- 2009-09-02T21:17:52+02:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/OsmServerWriter.java
r2004 r2025 95 95 String msg = ""; 96 96 switch(OsmPrimitiveType.from(osm)) { 97 case NODE: msg = marktr("{0}% ({1}/{2}), {3} left. Uploading node ''{4}'' (id: {5})"); break;98 case WAY: msg = marktr("{0}% ({1}/{2}), {3} left. Uploading way ''{4}'' (id: {5})"); break;99 case RELATION: msg = marktr("{0}% ({1}/{2}), {3} left. Uploading relation ''{4}'' (id: {5})"); break;97 case NODE: msg = marktr("{0}% ({1}/{2}), {3} left. Uploading node ''{4}'' (id: {5})"); break; 98 case WAY: msg = marktr("{0}% ({1}/{2}), {3} left. Uploading way ''{4}'' (id: {5})"); break; 99 case RELATION: msg = marktr("{0}% ({1}/{2}), {3} left. Uploading relation ''{4}'' (id: {5})"); break; 100 100 } 101 101 progressMonitor.subTask( … … 105 105 primitives.size(), 106 106 time_left_str, 107 osm.getName() == null ? osm. id: osm.getName(),108 osm. id));107 osm.getName() == null ? osm.getId() : osm.getName(), 108 osm.getId())); 109 109 makeApiRequest(osm,progressMonitor); 110 110 processed.add(osm); … … 117 117 } finally { 118 118 try { 119 api.stopChangeset(progressMonitor.createSubTaskMonitor(0, false)); 119 // starting the changeset may have failed, for instance because the user 120 // cancelled the upload task. Only close the changeset if we currently have 121 // an open changeset 122 123 if (api.getCurrentChangeset() != null && api.getCurrentChangeset().getId() > 0) { 124 api.stopChangeset(progressMonitor.createSubTaskMonitor(0, false)); 125 } 120 126 } catch(Exception e) { 121 127 Changeset changeset = api.getCurrentChangeset(); 122 String changesetId = (changeset == null ? tr("unknown") : Long.toString(changeset. id));128 String changesetId = (changeset == null ? tr("unknown") : Long.toString(changeset.getId())); 123 129 logger.warning(tr("Failed to close changeset {0}, will be closed by server after timeout. Exception was: {1}", 124 130 changesetId, e.toString())); … … 149 155 } catch (Exception ee) { 150 156 Changeset changeset = api.getCurrentChangeset(); 151 String changesetId = (changeset == null ? tr("unknown") : Long.toString(changeset. id));157 String changesetId = (changeset == null ? tr("unknown") : Long.toString(changeset.getId())); 152 158 logger.warning(tr("Failed to close changeset {0}, will be closed by server after timeout. Exception was: {1}", 153 159 changesetId, ee.toString())); … … 166 172 167 173 api.initialize(); 168 169 progressMonitor.beginTask("");170 174 171 175 try { … … 180 184 181 185 if (useChangeset) { 186 progressMonitor.beginTask(tr("Starting to upload in one request ...")); 182 187 uploadChangesAsDiffUpload(primitives, progressMonitor); 183 188 } else { 189 progressMonitor.beginTask(tr("Starting to upload with one request per primitive ...")); 184 190 uploadChangesIndividually(primitives, progressMonitor); 185 191 } … … 190 196 191 197 void makeApiRequest(OsmPrimitive osm, ProgressMonitor progressMonitor) throws OsmTransferException { 192 if (osm. deleted) {198 if (osm.isDeleted()) { 193 199 api.deletePrimitive(osm, progressMonitor); 194 } else if (osm. id== 0) {200 } else if (osm.getId() == 0) { 195 201 api.createPrimitive(osm); 196 202 } else {
Note:
See TracChangeset
for help on using the changeset viewer.