Ignore:
Timestamp:
2016-12-09T23:31:13+01:00 (3 years ago)
Author:
Don-vip
Message:

sonar - squid:S00112 - Generic exceptions should never be thrown: define JosmRuntimeException

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

Legend:

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

    r11269 r11374  
    4646import org.openstreetmap.josm.gui.progress.ProgressMonitor;
    4747import org.openstreetmap.josm.gui.tagging.ac.AutoCompletionManager;
     48import org.openstreetmap.josm.tools.JosmRuntimeException;
    4849import org.openstreetmap.josm.tools.SubclassFilteredCollection;
    4950import org.openstreetmap.josm.tools.Utils;
     
    516517            }
    517518            if (!success)
    518                 throw new RuntimeException("failed to add primitive: "+primitive);
     519                throw new JosmRuntimeException("failed to add primitive: "+primitive);
    519520            firePrimitivesAdded(Collections.singletonList(primitive), false);
    520521        } finally {
     
    547548            }
    548549            if (!success)
    549                 throw new RuntimeException("failed to remove primitive: "+primitive);
     550                throw new JosmRuntimeException("failed to remove primitive: "+primitive);
    550551            synchronized (selectionLock) {
    551552                selectedPrimitives.remove(primitive);
     
    10631064    private void reindexNode(Node node, LatLon newCoor, EastNorth eastNorth) {
    10641065        if (!nodes.remove(node))
    1065             throw new RuntimeException("Reindexing node failed to remove");
     1066            throw new JosmRuntimeException("Reindexing node failed to remove");
    10661067        node.setCoorInternal(newCoor, eastNorth);
    10671068        if (!nodes.add(node))
    1068             throw new RuntimeException("Reindexing node failed to add");
     1069            throw new JosmRuntimeException("Reindexing node failed to add");
    10691070        for (OsmPrimitive primitive: node.getReferrers()) {
    10701071            if (primitive instanceof Way) {
     
    10791080        BBox before = way.getBBox();
    10801081        if (!ways.remove(way))
    1081             throw new RuntimeException("Reindexing way failed to remove");
     1082            throw new JosmRuntimeException("Reindexing way failed to remove");
    10821083        way.updatePosition();
    10831084        if (!ways.add(way))
    1084             throw new RuntimeException("Reindexing way failed to add");
     1085            throw new JosmRuntimeException("Reindexing way failed to add");
    10851086        if (!way.getBBox().equals(before)) {
    10861087            for (OsmPrimitive primitive: way.getReferrers()) {
  • trunk/src/org/openstreetmap/josm/data/osm/DataSetMerger.java

    r10308 r11374  
    1818import org.openstreetmap.josm.gui.progress.ProgressMonitor;
    1919import org.openstreetmap.josm.tools.CheckParameterUtil;
     20import org.openstreetmap.josm.tools.JosmRuntimeException;
    2021
    2122/**
     
    143144        Way myWay = (Way) getMergeTarget(other);
    144145        if (myWay == null)
    145             throw new RuntimeException(tr("Missing merge target for way with id {0}", other.getUniqueId()));
     146            throw new JosmRuntimeException(tr("Missing merge target for way with id {0}", other.getUniqueId()));
    146147    }
    147148
     
    178179                OsmPrimitive source = sourceDataSet.getPrimitiveById(target.getPrimitiveId());
    179180                if (source == null)
    180                     throw new RuntimeException(
     181                    throw new JosmRuntimeException(
    181182                            tr("Object of type {0} with id {1} was marked to be deleted, but it''s missing in the source dataset",
    182183                            target.getType(), target.getUniqueId()));
Note: See TracChangeset for help on using the changeset viewer.