Changeset 11070 in josm for trunk


Ignore:
Timestamp:
2016-10-01T23:11:11+02:00 (8 years ago)
Author:
simon04
Message:

see #13724 - refactor constructors and add parameters validation to detect root cause

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/command/MoveCommand.java

    r10663 r11070  
    9393        this.x = x;
    9494        this.y = y;
     95        Objects.requireNonNull(objects, "objects");
    9596        this.nodes = AllNodesVisitor.getAllNodes(objects);
    9697        for (Node n : this.nodes) {
     
    106107     */
    107108    public MoveCommand(Collection<OsmPrimitive> objects, EastNorth start, EastNorth end) {
    108         this(objects, end.getX()-start.getX(), end.getY()-start.getY());
     109        this(
     110                Objects.requireNonNull(objects, "objects"),
     111                Objects.requireNonNull(end, "end").getX() - Objects.requireNonNull(start, "start").getX(),
     112                Objects.requireNonNull(end, "end").getY() - Objects.requireNonNull(start, "start").getY());
    109113        startEN = start;
    110114    }
     
    117121     */
    118122    public MoveCommand(OsmPrimitive p, EastNorth start, EastNorth end) {
    119         this(Collections.singleton(p), end.getX()-start.getX(), end.getY()-start.getY());
     123        this(
     124                Collections.singleton(Objects.requireNonNull(p, "p")),
     125                Objects.requireNonNull(end, "end").getX() - Objects.requireNonNull(start, "start").getX(),
     126                Objects.requireNonNull(end, "end").getY() - Objects.requireNonNull(start, "start").getY());
    120127        startEN = start;
    121128    }
Note: See TracChangeset for help on using the changeset viewer.