Changeset 18433 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2022-04-19T22:29:22+02:00 (2 years ago)
Author:
taylor.smock
Message:

Fix #22024: DataIntegrityProblemException during data upload

This is caused by a race condition between the upload methods and updates to
the relation editor. If the upload takes long enough, the user can cause an
update to the relation editor, which can trigger the problem.

This works around the problem by returning the original relation when the
dataset is locked. This keeps compatibility with the interface method javadocs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/IRelationEditorActionAccess.java

    r18413 r18433  
    7575    default IRelation<?> getChangedRelation() {
    7676        final Relation newRelation;
    77         if (getEditor().getRelation() != null) {
    78             newRelation = new Relation(getEditor().getRelation());
     77        final Relation oldRelation = getEditor().getRelation();
     78        if (oldRelation != null && oldRelation.getDataSet() != null && oldRelation.getDataSet().isLocked()) {
     79            // If the dataset is locked, then we cannot change the relation. See JOSM #22024.
     80            // This is due to the `setMembers` -> `addReferrer` call chain requires that the dataset is not read only.
     81            return oldRelation;
     82        } else if (oldRelation != null) {
     83            newRelation = new Relation(oldRelation);
    7984        } else {
    8085            newRelation = new Relation();
Note: See TracChangeset for help on using the changeset viewer.