Changeset 13852 in josm for trunk/src


Ignore:
Timestamp:
2018-05-26T20:11:44+02:00 (15 months ago)
Author:
Don-vip
Message:

SonarQube - fix more code issues

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

Legend:

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

    r13292 r13852  
    1919import java.util.ListIterator;
    2020import java.util.Map;
     21import java.util.Set;
    2122import java.util.Stack;
    2223
     
    6162
    6263    /** Mode of this ExportToGpxAction */
    63     protected final EnumSet<Mode> mode;
     64    protected final Set<Mode> mode;
    6465
    6566    /** Primitives this action works on */
     
    7677     * @param mode which mode to use, see {@code ExportRelationToGpxAction.Mode}
    7778     */
    78     public ExportRelationToGpxAction(EnumSet<Mode> mode) {
     79    public ExportRelationToGpxAction(Set<Mode> mode) {
    7980        super(name(mode), mode.contains(TO_FILE) ? "exportgpx" : "dialogs/layerlist", tooltip(mode),
    8081                null, false, null, false);
     
    8384    }
    8485
    85     private static String name(EnumSet<Mode> mode) {
     86    private static String name(Set<Mode> mode) {
    8687        if (mode.contains(TO_FILE)) {
    8788            if (mode.contains(FROM_FIRST_MEMBER)) {
     
    99100    }
    100101
    101     private static String tooltip(EnumSet<Mode> mode) {
     102    private static String tooltip(Set<Mode> mode) {
    102103        if (mode.contains(FROM_FIRST_MEMBER)) {
    103104            return tr("Flatten this relation to a single gpx track recursively, " +
  • trunk/src/org/openstreetmap/josm/command/SplitWayCommand.java

    r13173 r13852  
    275275        Collection<String> nowarnroles = Config.getPref().getList("way.split.roles.nowarn",
    276276                Arrays.asList("outer", "inner", "forward", "backward", "north", "south", "east", "west"));
    277 
    278         //final MapFrame map = MainApplication.getMap();
    279         //final boolean isMapModeDraw = map != null && map.mapMode == map.mapModeDraw;
    280277
    281278        // Change the original way
  • trunk/src/org/openstreetmap/josm/data/oauth/SignpostAdapters.java

    r11921 r13852  
    2525     */
    2626    public static class OAuthProvider extends AbstractOAuthProvider {
     27
     28        private static final long serialVersionUID = 1L;
    2729
    2830        /**
     
    6062     */
    6163    public static class OAuthConsumer extends AbstractOAuthConsumer {
     64
     65        private static final long serialVersionUID = 1L;
    6266
    6367        /**
  • trunk/src/org/openstreetmap/josm/data/osm/QuadBucketPrimitiveStore.java

    r13766 r13852  
    3838     */
    3939    private final Collection<R> relations = new ArrayList<>();
    40 
    41     /**
    42      * Constructs a new {@code QuadBucketPrimitiveStore}.
    43      */
    44     public QuadBucketPrimitiveStore() {
    45     }
    4640
    4741    /**
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/ComputeStyleListWorker.java

    r13810 r13852  
    3333 */
    3434public class ComputeStyleListWorker extends RecursiveTask<List<StyleRecord>> implements PrimitiveVisitor {
     35
     36    private static final long serialVersionUID = 1L;
     37
    3538    private final transient List<? extends IPrimitive> input;
    3639    private final transient List<StyleRecord> output;
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java

    r13810 r13852  
    595595            int textWidth = (int) bounds.getWidth();
    596596            if (bs.hAlign == HorizontalTextAlignment.CENTER) {
    597                 x -= textWidth / 2;
     597                x -= textWidth / 2d;
    598598            } else if (bs.hAlign == HorizontalTextAlignment.LEFT) {
    599599                x -= -box.x + 4 + textWidth;
     
    16671667        try {
    16681668            record.paintPrimitive(paintSettings, this);
    1669         } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException | NullPointerException e) {
     1669        } catch (RuntimeException e) {
    16701670            throw BugReport.intercept(e).put("record", record);
    16711671        }
  • trunk/src/org/openstreetmap/josm/data/tagging/ac/AutoCompletionSet.java

    r13121 r13852  
    1818 */
    1919public class AutoCompletionSet extends TreeSet<AutoCompletionItem> {
     20
     21    private static final long serialVersionUID = 1L;
    2022
    2123    // Keep a separate tree set of values for determining fast if a value is present
  • trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java

    r13564 r13852  
    666666            @Override
    667667            public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
     668                // Do nothing
    668669            }
    669670
    670671            @Override
    671672            public void popupMenuCanceled(PopupMenuEvent e) {
     673                // Do nothing
    672674            }
    673675        });
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/RecentTagCollection.java

    r12846 r13852  
    2323     */
    2424    static final class LruCache extends LinkedHashMap<Tag, Void> {
     25        private static final long serialVersionUID = 1L;
    2526        private final int capacity;
    2627
  • trunk/src/org/openstreetmap/josm/gui/history/CoordinateInfoViewer.java

    r13426 r13852  
    370370            }
    371371
    372             setDisplayToFitMapMarkers();
     372            super.setDisplayToFitMapMarkers();
    373373        }
    374374    }
  • trunk/src/org/openstreetmap/josm/gui/layer/AutosaveTask.java

    r13654 r13852  
    2222import java.util.LinkedList;
    2323import java.util.List;
     24import java.util.Locale;
    2425import java.util.Set;
    2526import java.util.Timer;
     
    197198        int index = startIndex;
    198199        while (true) {
    199             String filename = String.format("%1$s_%2$tY%2$tm%2$td_%2$tH%2$tM%2$tS%2$tL%3$s",
     200            String filename = String.format(Locale.ENGLISH, "%1$s_%2$tY%2$tm%2$td_%2$tH%2$tM%2$tS%2$tL%3$s",
    200201                    layer.layerFileName, now, index == 0 ? "" : ('_' + Integer.toString(index)));
    201202            File result = new File(autosaveDir, filename + '.' +
  • trunk/src/org/openstreetmap/josm/gui/layer/NativeScaleLayer.java

    r11386 r13852  
    55import java.util.Collection;
    66import java.util.List;
     7import java.util.Locale;
    78
    89import org.openstreetmap.josm.gui.NavigatableComponent;
     
    6465        @Override
    6566        public String toString() {
    66             return String.format("%f [%s]", scale, isNative);
     67            return String.format(Locale.ENGLISH, "%f [%s]", scale, isNative);
    6768        }
    6869
  • trunk/src/org/openstreetmap/josm/gui/layer/NoteLayer.java

    r13453 r13852  
    416416            Point notePoint = MainApplication.getMap().mapView.getPoint(note.getLatLon());
    417417            //move the note point to the center of the icon where users are most likely to click when selecting
    418             notePoint.setLocation(notePoint.getX(), notePoint.getY() - iconHeight / 2);
     418            notePoint.setLocation(notePoint.getX(), notePoint.getY() - iconHeight / 2d);
    419419            double dist = clickPoint.distanceSq(notePoint);
    420420            if (minDistance > dist && clickPoint.distance(notePoint) < snapDistance) {
  • trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java

    r13559 r13852  
    6464import org.openstreetmap.josm.data.osm.DataSelectionListener;
    6565import org.openstreetmap.josm.data.osm.DataSet;
    66 import org.openstreetmap.josm.data.osm.DownloadPolicy;
    67 import org.openstreetmap.josm.data.osm.UploadPolicy;
    6866import org.openstreetmap.josm.data.osm.DataSetMerger;
    6967import org.openstreetmap.josm.data.osm.DatasetConsistencyTest;
     68import org.openstreetmap.josm.data.osm.DownloadPolicy;
    7069import org.openstreetmap.josm.data.osm.HighlightUpdateListener;
    7170import org.openstreetmap.josm.data.osm.IPrimitive;
     
    7473import org.openstreetmap.josm.data.osm.OsmPrimitiveComparator;
    7574import org.openstreetmap.josm.data.osm.Relation;
     75import org.openstreetmap.josm.data.osm.UploadPolicy;
    7676import org.openstreetmap.josm.data.osm.Way;
    7777import org.openstreetmap.josm.data.osm.event.AbstractDatasetChangedEvent;
     
    239239
    240240    static final class LruCache extends LinkedHashMap<Relation, Void> {
     241        private static final long serialVersionUID = 1L;
    241242        LruCache(int initialCapacity) {
    242243            super(initialCapacity, 1.1f, true);
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetReader.java

    r13824 r13852  
    9292
    9393    static class HashSetWithLast<E> extends LinkedHashSet<E> {
     94        private static final long serialVersionUID = 1L;
    9495        protected transient E last;
    9596
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetSeparator.java

    r8863 r13852  
    88public class TaggingPresetSeparator extends TaggingPreset {
    99    @Override
    10     public void setDisplayName() {}
     10    public void setDisplayName() {
     11        // Do nothing
     12    }
    1113}
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Roles.java

    r13332 r13852  
    179179    @Override
    180180    public void addCommands(List<Tag> changedTags) {
     181        // Do nothing
    181182    }
    182183
  • trunk/src/org/openstreetmap/josm/tools/Shortcut.java

    r12846 r13852  
    283283
    284284    private static class ShortcutCollection extends CopyOnWriteArrayList<Shortcut> {
     285        private static final long serialVersionUID = 1L;
    285286        @Override
    286287        public boolean add(Shortcut shortcut) {
Note: See TracChangeset for help on using the changeset viewer.