Changeset 36130 in osm for applications


Ignore:
Timestamp:
2023-09-07T15:32:08+02:00 (10 months ago)
Author:
taylor.smock
Message:

Fix #23159: utilsplugin2 Split Object command could cause DataIntegrityProblemException when the split way was part of a relation

Location:
applications/editors/josm/plugins/utilsplugin2
Files:
7 added
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/utilsplugin2/src/org/openstreetmap/josm/plugins/utilsplugin2/actions/SplitObjectAction.java

    r35842 r36130  
    4747import org.openstreetmap.josm.spi.preferences.Config;
    4848import org.openstreetmap.josm.tools.CheckParameterUtil;
     49import org.openstreetmap.josm.tools.Logging;
    4950import org.openstreetmap.josm.tools.Pair;
    5051import org.openstreetmap.josm.tools.Shortcut;
     
    5253/**
    5354 * Splits a closed way (polygon) into two closed ways or a multipolygon into two separate multipolygons.
    54  *
     55 * <p>
    5556 * The closed ways are just split at the selected nodes (which must be exactly two).
    5657 * The nodes remain in their original order.
    57  *
     58 * <p>
    5859 * This is similar to SplitWayAction with the addition that the split ways are closed
    5960 * immediately.
     
    7475    /**
    7576     * Called when the action is executed.
    76      *
     77     * <p>
    7778     * This method performs an expensive check whether the selection clearly defines one
    7879     * of the split actions outlined above, and if yes, calls the splitObject method.
     
    259260            if (splitWay != null) {
    260261                result.executeCommand();
    261                 DeleteCommand delCmd = new DeleteCommand(splitWay);
     262                Command delCmd = DeleteCommand.delete(Collections.singletonList(splitWay));
    262263                delCmd.executeCommand();
    263264                UndoRedoHandler.getInstance().add(new SplitObjectCommand(Arrays.asList(result, delCmd)), false);
     
    337338
    338339        } catch (IllegalArgumentException e) {
     340            Logging.trace(e);
    339341            // Changes were already undone in splitMultipolygonAtWay
    340342            showWarningNotification(e.getMessage());
Note: See TracChangeset for help on using the changeset viewer.