Changeset 15324 in josm


Ignore:
Timestamp:
2019-08-27T20:34:29+02:00 (5 years ago)
Author:
Don-vip
Message:

see #18035 - validate arguments in SelectCommand constructor

Location:
trunk
Files:
2 edited

Legend:

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

    r13173 r15324  
    3535        if (newSelection == null || newSelection.isEmpty()) {
    3636            this.newSelection = Collections.emptySet();
     37        } else if (newSelection.contains(null)) {
     38            throw new IllegalArgumentException("null primitive in selection");
    3739        } else {
    3840            this.newSelection = new HashSet<>(newSelection);
  • trunk/test/unit/org/openstreetmap/josm/command/SelectCommandTest.java

    r13616 r15324  
    161161            .verify();
    162162    }
     163
     164    /**
     165     * Unit test of {@link SelectCommand#SelectCommand}.
     166     */
     167    @Test(expected = IllegalArgumentException.class)
     168    public void testConstructorIAE() {
     169        new SelectCommand(new DataSet(), Arrays.asList(new OsmPrimitive[] {null}));
     170    }
    163171}
Note: See TracChangeset for help on using the changeset viewer.