Ignore:
Timestamp:
2016-05-15T00:51:10+02:00 (8 years ago)
Author:
Don-vip
Message:

sonar - squid:S2221 - "Exception" should not be caught when not required by called methods

Location:
trunk/src/org/openstreetmap/josm/gui/bbox
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/bbox/SlippyMapBBoxChooser.java

    r10001 r10212  
    199199    @Override
    200200    public void paint(Graphics g) {
    201         try {
    202             super.paint(g);
    203 
    204             // draw selection rectangle
    205             if (iSelectionRectStart != null && iSelectionRectEnd != null) {
    206                 Rectangle box = new Rectangle(getMapPosition(iSelectionRectStart, false));
    207                 box.add(getMapPosition(iSelectionRectEnd, false));
    208 
    209                 g.setColor(new Color(0.9f, 0.7f, 0.7f, 0.6f));
    210                 g.fillRect(box.x, box.y, box.width, box.height);
    211 
    212                 g.setColor(Color.BLACK);
    213                 g.drawRect(box.x, box.y, box.width, box.height);
    214             }
    215         } catch (Exception e) {
    216             Main.error(e);
     201        super.paint(g);
     202
     203        // draw selection rectangle
     204        if (iSelectionRectStart != null && iSelectionRectEnd != null) {
     205            Rectangle box = new Rectangle(getMapPosition(iSelectionRectStart, false));
     206            box.add(getMapPosition(iSelectionRectEnd, false));
     207
     208            g.setColor(new Color(0.9f, 0.7f, 0.7f, 0.6f));
     209            g.fillRect(box.x, box.y, box.width, box.height);
     210
     211            g.setColor(Color.BLACK);
     212            g.drawRect(box.x, box.y, box.width, box.height);
    217213        }
    218214    }
  • trunk/src/org/openstreetmap/josm/gui/bbox/TileSelectionBBoxChooser.java

    r10179 r10212  
    4545import org.openstreetmap.gui.jmapviewer.interfaces.MapMarker;
    4646import org.openstreetmap.gui.jmapviewer.interfaces.TileLoader;
    47 import org.openstreetmap.josm.Main;
    4847import org.openstreetmap.josm.data.Bounds;
    4948import org.openstreetmap.josm.data.Version;
     
    694693        @Override
    695694        public void paint(Graphics g) {
    696             try {
    697                 super.paint(g);
    698                 if (min == null || max == null) return;
    699                 int zoomDiff = MAX_ZOOM - zoom;
    700                 Point tlc = getTopLeftCoordinates();
    701                 int xMin = (min.x >> zoomDiff) - tlc.x;
    702                 int yMin = (min.y >> zoomDiff) - tlc.y;
    703                 int xMax = (max.x >> zoomDiff) - tlc.x;
    704                 int yMax = (max.y >> zoomDiff) - tlc.y;
    705 
    706                 int w = xMax - xMin;
    707                 int h = yMax - yMin;
    708                 g.setColor(new Color(0.9f, 0.7f, 0.7f, 0.6f));
    709                 g.fillRect(xMin, yMin, w, h);
    710 
    711                 g.setColor(Color.BLACK);
    712                 g.drawRect(xMin, yMin, w, h);
    713             } catch (Exception e) {
    714                 Main.error(e);
    715             }
     695            super.paint(g);
     696            if (min == null || max == null) return;
     697            int zoomDiff = MAX_ZOOM - zoom;
     698            Point tlc = getTopLeftCoordinates();
     699            int xMin = (min.x >> zoomDiff) - tlc.x;
     700            int yMin = (min.y >> zoomDiff) - tlc.y;
     701            int xMax = (max.x >> zoomDiff) - tlc.x;
     702            int yMax = (max.y >> zoomDiff) - tlc.y;
     703
     704            int w = xMax - xMin;
     705            int h = yMax - yMin;
     706            g.setColor(new Color(0.9f, 0.7f, 0.7f, 0.6f));
     707            g.fillRect(xMin, yMin, w, h);
     708
     709            g.setColor(Color.BLACK);
     710            g.drawRect(xMin, yMin, w, h);
    716711        }
    717712    }
Note: See TracChangeset for help on using the changeset viewer.