Changeset 10234 in josm


Ignore:
Timestamp:
2016-05-17T00:43:47+02:00 (9 years ago)
Author:
Don-vip
Message:

findbugs - DB_DUPLICATE_SWITCH_CLAUSES + REC_CATCH_EXCEPTION + UC_USELESS_CONDITION + OS_OPEN_STREAM_EXCEPTION_PATH + ICAST_INTEGER_MULTIPLY_CAST_TO_LONG

Location:
trunk/src/org/openstreetmap/josm
Files:
8 edited

Legend:

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

    r10062 r10234  
    4242 * @author imi
    4343 */
    44 public class AboutAction extends JosmAction {
     44public final class AboutAction extends JosmAction {
    4545
    4646    /**
     
    130130            displayErrorMessage(ta, tr("Failed to locate resource ''{0}''.", filePath));
    131131        } else {
    132             try {
    133                 BufferedReader br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
     132            try (InputStreamReader reader = new InputStreamReader(is, "UTF-8");
     133                 BufferedReader br = new BufferedReader(reader)) {
    134134                String line;
    135135                while ((line = br.readLine()) != null) {
    136136                    ta.append(line+'\n');
    137137                }
    138                 br.close();
    139138            } catch (IOException e) {
    140139                Main.warn(e);
  • trunk/src/org/openstreetmap/josm/actions/UploadSelectionAction.java

    r9067 r10234  
    341341                        // our local dataset includes a deleted parent of a primitive we want
    342342                        // to delete. Include this parent in the collection of uploaded primitives
    343                         //
    344343                        if (myDeletedParent != null && myDeletedParent.isDeleted()) {
    345344                            if (!toUpload.contains(myDeletedParent)) {
     
    352351                    }
    353352                }
    354             } catch (Exception e) {
     353            } catch (OsmTransferException e) {
    355354                if (canceled)
    356355                    // ignore exception
  • trunk/src/org/openstreetmap/josm/data/validation/tests/PowerLines.java

    r10228 r10234  
    206206    }
    207207
    208     protected class PowerLineError extends TestError {
     208    protected static class PowerLineError extends TestError {
    209209        private final Way line;
    210210
  • trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java

    r10181 r10234  
    11181118     */
    11191119    public final WaySegment getNearestWaySegment(Point p, Predicate<OsmPrimitive> predicate, boolean useSelected) {
    1120         WaySegment wayseg = null, ntsel = null;
     1120        WaySegment wayseg = null;
     1121        WaySegment ntsel = null;
    11211122
    11221123        for (List<WaySegment> wslist : getNearestWaySegmentsImpl(p, predicate).values()) {
     
    11531154     */
    11541155    public final WaySegment getNearestWaySegment(Point p, Predicate<OsmPrimitive> predicate,
    1155             boolean useSelected,  Collection<OsmPrimitive> preferredRefs) {
    1156         WaySegment wayseg = null, ntsel = null, ntref = null;
    1157         if (preferredRefs != null && preferredRefs.isEmpty()) preferredRefs = null;
     1156            boolean useSelected, Collection<OsmPrimitive> preferredRefs) {
     1157        WaySegment wayseg = null;
     1158        WaySegment ntsel = null;
     1159        WaySegment ntref = null;
     1160        if (preferredRefs != null && preferredRefs.isEmpty())
     1161            preferredRefs = null;
    11581162
    11591163        searchLoop: for (List<WaySegment> wslist : getNearestWaySegmentsImpl(p, predicate).values()) {
  • trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java

    r10144 r10234  
    973973                switch (col) {
    974974                case 0: return layers.get(row) == getActiveLayer();
    975                 case 1: return layers.get(row);
    976                 case 2: return layers.get(row);
     975                case 1:
     976                case 2:
    977977                case 3: return layers.get(row);
    978                 default: throw new RuntimeException();
     978                default: // Do nothing
    979979                }
    980980            }
  • trunk/src/org/openstreetmap/josm/gui/io/DownloadFileTask.java

    r10173 r10234  
    119119                byte[] buffer = new byte[32768];
    120120                int count = 0;
    121                 long p1 = 0, p2 = 0;
     121                long p1 = 0;
     122                long p2;
    122123                for (int read = in.read(buffer); read != -1; read = in.read(buffer)) {
    123124                    out.write(buffer, 0, read);
    124125                    count += read;
    125126                    if (canceled) break;
    126                     p2 = 100 * count / size;
     127                    p2 = 100L * count / size;
    127128                    if (p2 != p1) {
    128129                        progressMonitor.setTicks((int) p2);
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java

    r10212 r10234  
    912912                    lblSeconds.setText(tr("Seconds: {0}", Offset.milliseconds(100L * sldSeconds.getValue()).formatOffset()));
    913913
    914                     delta = Offset.milliseconds(100 * sldSeconds.getValue()
     914                    delta = Offset.milliseconds(100L * sldSeconds.getValue()
    915915                            + 1000L * 60 * sldMinutes.getValue()
    916916                            + 1000L * 60 * 60 * 24 * dayOffset);
  • trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/ButtonMarker.java

    r9078 r10234  
    6666
    6767        String labelText = getText();
    68         if ((labelText != null) && showTextOrIcon && Main.pref.getBoolean("marker.buttonlabels", true)) {
     68        if (labelText != null && Main.pref.getBoolean("marker.buttonlabels", true)) {
    6969            g.drawString(labelText, screen.x+4, screen.y+2);
    7070        }
Note: See TracChangeset for help on using the changeset viewer.