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

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

Location:
trunk/src/org/openstreetmap/josm/actions
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java

    r11315 r11374  
    4545import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    4646import org.openstreetmap.josm.tools.Geometry;
     47import org.openstreetmap.josm.tools.JosmRuntimeException;
    4748import org.openstreetmap.josm.tools.Pair;
    4849import org.openstreetmap.josm.tools.Shortcut;
     
    11251126                WayInPolygon nextWay = traverser.walk();
    11261127                if (nextWay == null)
    1127                     throw new RuntimeException("Join areas internal error.");
     1128                    throw new JosmRuntimeException("Join areas internal error.");
    11281129                if (path.get(0) == nextWay) {
    11291130                    // path is closed -> stop here
     
    11801181                while ((nextWay = traverser.walk()) != startWay) {
    11811182                    if (nextWay == null)
    1182                         throw new RuntimeException("Join areas internal error.");
     1183                        throw new JosmRuntimeException("Join areas internal error.");
    11831184                    simpleRingWays.add(nextWay);
    11841185                }
     
    12541255        //should not happen
    12551256        if (joinedWay == null || !joinedWay.isClosed())
    1256             throw new RuntimeException("Join areas internal error.");
     1257            throw new JosmRuntimeException("Join areas internal error.");
    12571258
    12581259        return joinedWay;
  • trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java

    r11116 r11374  
    3131import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil;
    3232import org.openstreetmap.josm.gui.Notification;
     33import org.openstreetmap.josm.tools.JosmRuntimeException;
    3334import org.openstreetmap.josm.tools.Shortcut;
    3435
     
    294295                    w.calcDirections(Direction.RIGHT.changeBy(directionOffset));
    295296                    if (angleToDirectionChange(refHeading - w.heading, TOLERANCE2) != 0)
    296                         throw new RuntimeException();
     297                        throw new JosmRuntimeException("orthogonalize error");
    297298                    totSum = EN.sum(totSum, w.segSum);
    298299                }
     
    403404                }
    404405            }
    405             if (!s.isEmpty()) throw new RuntimeException();
     406            if (!s.isEmpty()) throw new JosmRuntimeException("orthogonalize error");
    406407        }
    407408
  • trunk/src/org/openstreetmap/josm/actions/search/PushbackTokenizer.java

    r8846 r11374  
    1212
    1313import org.openstreetmap.josm.actions.search.SearchCompiler.ParseError;
     14import org.openstreetmap.josm.tools.JosmRuntimeException;
    1415
    1516public class PushbackTokenizer {
     
    7475            c = search.read();
    7576        } catch (IOException e) {
    76             throw new RuntimeException(e.getMessage(), e);
     77            throw new JosmRuntimeException(e.getMessage(), e);
    7778        }
    7879    }
  • trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java

    r10711 r11374  
    5555import org.openstreetmap.josm.gui.widgets.HistoryComboBox;
    5656import org.openstreetmap.josm.tools.GBC;
     57import org.openstreetmap.josm.tools.JosmRuntimeException;
    5758import org.openstreetmap.josm.tools.Shortcut;
    5859import org.openstreetmap.josm.tools.Utils;
     
    229230                            tf.getDocument().insertString(tf.getCaretPosition(), ' ' + insertText, null);
    230231                        } catch (BadLocationException ex) {
    231                             throw new RuntimeException(ex.getMessage(), ex);
     232                            throw new JosmRuntimeException(ex.getMessage(), ex);
    232233                        }
    233234                    }
Note: See TracChangeset for help on using the changeset viewer.