Ignore:
Timestamp:
2016-12-12T17:29:27+01:00 (3 years ago)
Author:
Don-vip
Message:

findbugs - BC_UNCONFIRMED_CAST

Location:
trunk/src/org/openstreetmap/josm/data/osm
Files:
4 edited

Legend:

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

    r11292 r11383  
    238238    @Override
    239239    public void cloneFrom(OsmPrimitive osm) {
     240        if (!(osm instanceof Node))
     241            throw new IllegalArgumentException("Not a node: " + osm);
    240242        boolean locked = writeLock();
    241243        try {
     
    260262    @Override
    261263    public void mergeFrom(OsmPrimitive other) {
     264        if (!(other instanceof Node))
     265            throw new IllegalArgumentException("Not a node: " + other);
    262266        boolean locked = writeLock();
    263267        try {
     
    271275    }
    272276
    273     @Override public void load(PrimitiveData data) {
     277    @Override
     278    public void load(PrimitiveData data) {
     279        if (!(data instanceof NodeData))
     280            throw new IllegalArgumentException("Not a node data: " + data);
    274281        boolean locked = writeLock();
    275282        try {
     
    281288    }
    282289
    283     @Override public NodeData save() {
     290    @Override
     291    public NodeData save() {
    284292        NodeData data = new NodeData();
    285293        saveCommonAttributes(data);
  • trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java

    r11373 r11383  
    10881088     *
    10891089     * Both this and other must be new, or both must be assigned an OSM ID. If both this and <code>other</code>
    1090      * have an assigend OSM id, the IDs have to be the same.
     1090     * have an assigned OSM id, the IDs have to be the same.
    10911091     *
    10921092     * @param other the other primitive. Must not be null.
  • trunk/src/org/openstreetmap/josm/data/osm/Relation.java

    r11316 r11383  
    240240    @Override
    241241    public void cloneFrom(OsmPrimitive osm) {
     242        if (!(osm instanceof Relation))
     243            throw new IllegalArgumentException("Not a relation: " + osm);
    242244        boolean locked = writeLock();
    243245        try {
     
    252254    @Override
    253255    public void load(PrimitiveData data) {
     256        if (!(data instanceof RelationData))
     257            throw new IllegalArgumentException("Not a relation data: " + data);
    254258        boolean locked = writeLock();
    255259        try {
     
    271275    }
    272276
    273     @Override public RelationData save() {
     277    @Override
     278    public RelationData save() {
    274279        RelationData data = new RelationData();
    275280        saveCommonAttributes(data);
  • trunk/src/org/openstreetmap/josm/data/osm/Way.java

    r11292 r11383  
    277277    @Override
    278278    public void load(PrimitiveData data) {
     279        if (!(data instanceof WayData))
     280            throw new IllegalArgumentException("Not a way data: " + data);
    279281        boolean locked = writeLock();
    280282        try {
     
    314316    @Override
    315317    public void cloneFrom(OsmPrimitive osm) {
     318        if (!(osm instanceof Way))
     319            throw new IllegalArgumentException("Not a way: " + osm);
    316320        boolean locked = writeLock();
    317321        try {
     
    326330    @Override
    327331    public String toString() {
    328         String nodesDesc = isIncomplete() ? "(incomplete)" : "nodes=" + Arrays.toString(nodes);
     332        String nodesDesc = isIncomplete() ? "(incomplete)" : ("nodes=" + Arrays.toString(nodes));
    329333        return "{Way id=" + getUniqueId() + " version=" + getVersion()+ ' ' + getFlagsAsString() + ' ' + nodesDesc + '}';
    330334    }
Note: See TracChangeset for help on using the changeset viewer.