Ignore:
Timestamp:
2013-09-11T00:32:31+02:00 (11 years ago)
Author:
Don-vip
Message:

Sonar - Avoid throwing NullPointerException

File:
1 edited

Legend:

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

    r2986 r6229  
    33
    44import org.openstreetmap.josm.data.Bounds;
     5import org.openstreetmap.josm.tools.CheckParameterUtil;
    56
     7/**
     8 * A data source, defined by bounds and textual description for the origin.
     9 * @since 247
     10 */
    611public class DataSource {
     12    /**
     13     * The bounds of this data source
     14     */
    715    public final Bounds bounds;
     16    /**
     17     * The textual description of the origin (example: "OpenStreetMap Server")
     18     */
    819    public final String origin;
    920
     21    /**
     22     * Constructs a new {@code DataSource}.
     23     * @param bounds The bounds of this data source
     24     * @param origin The textual description of the origin (example: "OpenStreetMap Server")
     25     * @throws IllegalArgumentException if bounds is {@code null}
     26     */
    1027    public DataSource(Bounds bounds, String origin) {
     28        CheckParameterUtil.ensureParameterNotNull(bounds, "bounds");
    1129        this.bounds = bounds;
    1230        this.origin = origin;
    13         if (bounds == null)
    14             throw new NullPointerException();
    1531    }
    1632}
Note: See TracChangeset for help on using the changeset viewer.