Skip to content

Commit

Permalink
fix #23754: JOSM fails to upload exactly 30000 changes in chunks of 1…
Browse files Browse the repository at this point in the history
…0000

- don't compare collection sizes() because they are changed in different situations

git-svn-id: https://josm.openstreetmap.de/svn/trunk@19135 0c6e7542-c601-0410-84e7-c038aed88b3b
  • Loading branch information
GerdP authored and GerdP committed Jul 10, 2024
1 parent fddc73f commit 081b55a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/org/openstreetmap/josm/gui/io/UploadPrimitivesTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<IPrimitive> processedPrimitives;
private final UploadStrategySpecification strategy;
/** Initial number of objects to be uploaded */
private final int numObjectsToUpload;

/**
* Creates the task
Expand All @@ -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;
Expand Down Expand Up @@ -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.<br>"
+ "This is most likely because the changesets size exceeded the max. size<br>"
+ "of {0} objects on the server ''{1}''.",
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 081b55a

Please sign in to comment.