Ignore:
Timestamp:
2022-12-12T19:28:40+01:00 (3 years ago)
Author:
taylor.smock
Message:

Fix #22520: IllegalStateException: Missing merge target for node (patch by GerdP, modified to add tests)

The added test is essentially an integration test instead of a unit test, mostly
due to having no good way to do a test specifically for the method at issue.
The test uses wiremock to (a) speed up the test and (b) avoid adding a test-time
dependency on the OSM API servers. The test required a custom wiremock response
transformer for the OSM multi-fetch API, since it is not guaranteed that the
order of objects will remain the same, which will lead to stub misses, failing
the test.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/reverter/src/reverter/ChangesetReverter.java

    r35980 r36042  
    424424            ChangesetDataSetEntry entry = it.next();
    425425            if (!checkOsmChangeEntry(entry)) continue;
     426            if (entry.getModificationType() == ChangesetModificationType.DELETED
     427                    && revertType == RevertType.SELECTION_WITH_UNDELETE) {
     428                // see #22520: missing merge target when object is first created and then
     429                // deleted in the same changeset
     430                ChangesetDataSetEntry first = cds.getFirstEntry(entry.getPrimitive().getPrimitiveId());
     431                if (first.getModificationType() == ChangesetModificationType.CREATED)
     432                    continue;
     433            }
    426434            HistoryOsmPrimitive hp = entry.getPrimitive();
    427435            OsmPrimitive dp = ds.getPrimitiveById(hp.getPrimitiveId());
Note: See TracChangeset for help on using the changeset viewer.