Ticket #13400: patch-test-13395.patch

File patch-test-13395.patch, 3.9 KB (added by michael2402, 3 years ago)
  • src/org/openstreetmap/josm/data/osm/PrimitiveData.java

    diff --git a/src/org/openstreetmap/josm/data/osm/PrimitiveData.java b/src/org/openstreetmap/josm/data/osm/PrimitiveData.java
    index 693d277..7c02278 100644
    a b public abstract class PrimitiveData extends AbstractPrimitive implements Seriali 
    5454    @Override
    5555    public String toString() {
    5656        StringBuilder builder = new StringBuilder();
    57         builder.append(id).append(Arrays.toString(keys)).append(getFlagsAsString());
     57        builder.append(id).append(' ').append(Arrays.toString(keys)).append(' ').append(getFlagsAsString());
    5858        return builder.toString();
    5959    }
    6060
  • src/org/openstreetmap/josm/gui/datatransfer/data/PrimitiveTransferData.java

    diff --git a/src/org/openstreetmap/josm/gui/datatransfer/data/PrimitiveTransferData.java b/src/org/openstreetmap/josm/gui/datatransfer/data/PrimitiveTransferData.java
    index 1acd354..91a235c 100644
    a b public final class PrimitiveTransferData implements Serializable { 
    149149     * @return <code>true</code> if invalid data is contained in this set.
    150150     */
    151151    public boolean hasIncompleteData() {
    152         for (PrimitiveData pd : getAll()) {
    153             if (pd.isIncomplete()) {
    154                 return true;
    155             }
    156         }
    157         return false;
     152        return getAll().stream().anyMatch(p -> p.isIncomplete() || !p.isVisible());
    158153    }
    159154}
  • src/org/openstreetmap/josm/gui/datatransfer/importers/PrimitiveDataPaster.java

    diff --git a/src/org/openstreetmap/josm/gui/datatransfer/importers/PrimitiveDataPaster.java b/src/org/openstreetmap/josm/gui/datatransfer/importers/PrimitiveDataPaster.java
    index 804b209..a6d0841 100644
    a b import org.openstreetmap.josm.data.osm.WayData; 
    2525import org.openstreetmap.josm.gui.ExtendedDialog;
    2626import org.openstreetmap.josm.gui.datatransfer.data.PrimitiveTransferData;
    2727import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     28import org.openstreetmap.josm.tools.bugreport.BugReport;
    2829
    2930/**
    3031 * This transfer support allows us to transfer primitives. This is the default paste action when primitives were copied.
    public final class PrimitiveDataPaster extends AbstractOsmDataPaster { 
    6667
    6768        // Update references in copied buffer
    6869        for (PrimitiveData data : bufferCopy) {
    69             if (data instanceof NodeData) {
    70                 NodeData nodeData = (NodeData) data;
    71                 nodeData.setEastNorth(nodeData.getEastNorth().add(offset));
    72             } else if (data instanceof WayData) {
    73                 updateNodes(newIds.get(OsmPrimitiveType.NODE), data);
    74             } else if (data instanceof RelationData) {
    75                 updateMembers(newIds, data);
     70            try {
     71                if (data instanceof NodeData) {
     72                    NodeData nodeData = (NodeData) data;
     73                    nodeData.setEastNorth(nodeData.getEastNorth().add(offset));
     74                } else if (data instanceof WayData) {
     75                    updateNodes(newIds.get(OsmPrimitiveType.NODE), data);
     76                } else if (data instanceof RelationData) {
     77                    updateMembers(newIds, data);
     78                }
     79            } catch (RuntimeException e) {
     80                throw BugReport.intercept(e).put("data", data);
    7681            }
    7782        }
    7883        return new AddPrimitivesCommand(bufferCopy, toSelect, layer);
    public final class PrimitiveDataPaster extends AbstractOsmDataPaster { 
    8691        newIds.put(OsmPrimitiveType.RELATION, new HashMap<Long, Long>());
    8792
    8893        for (PrimitiveData data : pasteBuffer.getAll()) {
    89             if (data.isIncomplete()) {
     94            if (data.isIncomplete() || !data.isVisible()) {
    9095                continue;
    9196            }
    9297            PrimitiveData copy = data.makeCopy();