diff --git a/src/org/openstreetmap/josm/gui/io/UploadPrimitivesTask.java b/src/org/openstreetmap/josm/gui/io/UploadPrimitivesTask.java index 05357d73352..2f682649179 100644 --- a/src/org/openstreetmap/josm/gui/io/UploadPrimitivesTask.java +++ b/src/org/openstreetmap/josm/gui/io/UploadPrimitivesTask.java @@ -50,12 +50,15 @@ public class UploadPrimitivesTask extends AbstractUploadTask { private boolean uploadCanceled; private Exception lastException; + /** The objects to upload. Successfully uploaded objects are removed. */ private final APIDataSet toUpload; private OsmServerWriter writer; private final OsmDataLayer layer; private Changeset changeset; private final Set processedPrimitives; private final UploadStrategySpecification strategy; + /** Initial number of objects to be uploaded */ + private final int numObjectsToUpload; /** * Creates the task @@ -76,6 +79,7 @@ public UploadPrimitivesTask(UploadStrategySpecification strategy, OsmDataLayer l ensureParameterNotNull(strategy, "strategy"); ensureParameterNotNull(changeset, "changeset"); this.toUpload = toUpload; + this.numObjectsToUpload = toUpload.getSize(); this.layer = layer; this.changeset = changeset; this.strategy = strategy; @@ -108,7 +112,7 @@ protected MaxChangesetSizeExceededPolicy promptUserForPolicy() { null /* no specific help text */ ) }; - int numObjectsToUploadLeft = toUpload.getSize() - processedPrimitives.size(); + int numObjectsToUploadLeft = numObjectsToUpload - processedPrimitives.size(); String msg1 = tr("The server reported that the current changeset was closed.
" + "This is most likely because the changesets size exceeded the max. size
" + "of {0} objects on the server ''{1}''.", @@ -160,7 +164,7 @@ protected MaxChangesetSizeExceededPolicy promptUserForPolicy() { * @throws OsmTransferException "if something goes wrong." */ protected boolean handleChangesetFullResponse() throws OsmTransferException { - if (processedPrimitives.size() == toUpload.getSize()) { + if (processedPrimitives.size() >= numObjectsToUpload) { strategy.setPolicy(MaxChangesetSizeExceededPolicy.ABORT); return false; }