Changeset 13100 in josm for trunk/src/org


Ignore:
Timestamp:
2017-11-08T22:58:48+01:00 (7 years ago)
Author:
Don-vip
Message:

see #15534 - ensure user names are never null, as expected

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/User.java

    r12865 r13100  
    159159     *
    160160     * @param name User name
     161     * @throws NullPointerException if name is null
    161162     */
    162163    public void addName(String name) {
    163         names.add(name);
     164        names.add(Objects.requireNonNull(name, "name"));
    164165    }
    165166
     
    170171     * data files it is unclear which is the up-to-date user name.
    171172     * @param name the preferred user name to set
     173     * @throws NullPointerException if name is null
    172174     */
    173175    public void setPreferredName(String name) {
     
    177179        final Collection<String> allNames = new LinkedHashSet<>(names);
    178180        names.clear();
    179         names.add(name);
     181        names.add(Objects.requireNonNull(name, "name"));
    180182        names.addAll(allNames);
    181183    }
Note: See TracChangeset for help on using the changeset viewer.