Changeset 6235 in josm for trunk


Ignore:
Timestamp:
2013-09-19T02:14:38+02:00 (11 years ago)
Author:
Don-vip
Message:

Sonar - fix recently introduced issues

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

Legend:

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

    r6232 r6235  
    2222import java.util.SortedMap;
    2323import java.util.TreeMap;
    24 import java.util.concurrent.Future;
    2524import java.util.regex.Matcher;
    2625import java.util.regex.Pattern;
  • trunk/src/org/openstreetmap/josm/data/Preferences.java

    r6232 r6235  
    982982
    983983    public boolean putArray(String key, Collection<Collection<String>> value) {
    984         //boolean changed = false;
    985 
    986984        List<List<String>> oldValue = null;
    987985        List<List<String>> valueCopy = null;
  • trunk/src/org/openstreetmap/josm/data/osm/QuadBuckets.java

    r6232 r6235  
    124124                return this;
    125125            else {
    126                 int index = bbox.getIndex(level);
    127                 if (index == -1)
     126                int idx = bbox.getIndex(level);
     127                if (idx == -1)
    128128                    return this;
    129                 return getChild(index).findBucket(bbox);
     129                return getChild(idx).findBucket(bbox);
    130130            }
    131131        }
     
    160160
    161161            for (T o : tmpcontent) {
    162                 int index = o.getBBox().getIndex(level);
    163                 if (index == -1) {
     162                int idx = o.getBBox().getIndex(level);
     163                if (idx == -1) {
    164164                    __add_content(o);
    165165                } else {
    166                     getChild(index).doAdd(o);
     166                    getChild(idx).doAdd(o);
    167167                }
    168168            }
  • trunk/src/org/openstreetmap/josm/gui/download/PlaceSelection.java

    r6203 r6235  
    4747import org.openstreetmap.josm.Main;
    4848import org.openstreetmap.josm.data.Bounds;
    49 import org.openstreetmap.josm.data.coor.LatLon;
    5049import org.openstreetmap.josm.gui.ExceptionDialogUtil;
    5150import org.openstreetmap.josm.gui.PleaseWaitRunnable;
  • trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java

    r6211 r6235  
    3030    private int defaultNodesIdx, defaultLinesIdx;
    3131
    32     public ElemStyles()
    33     {
     32    /**
     33     * Constructs a new {@code ElemStyles}.
     34     */
     35    public ElemStyles() {
    3436        styleSources = new ArrayList<StyleSource>();
    3537    }
     
    116118            osm.mappaintStyle = style.put(p.a, p.b);
    117119        } catch (StyleCache.RangeViolatedError e) {
    118             throw new AssertionError("Range violated. object: " + osm.getPrimitiveId() + ", current style: "+osm.mappaintStyle
     120            AssertionError error = new AssertionError("Range violated. object: " + osm.getPrimitiveId() + ", current style: "+osm.mappaintStyle
    119121                    + ", scale: " + scale + ", new stylelist: " + p.a + ", new range: " + p.b);
     122            error.initCause(e);
     123            throw error;
    120124        }
    121125        osm.mappaintCacheIdx = cacheIdx;
  • trunk/src/org/openstreetmap/josm/gui/widgets/QuadStateCheckBox.java

    r6221 r6235  
    118118    }
    119119
    120     private class QuadStateDecorator implements ButtonModel {
     120    private final class QuadStateDecorator implements ButtonModel {
    121121        private final ButtonModel other;
    122122       
  • trunk/src/org/openstreetmap/josm/tools/Diff.java

    r6224 r6235  
    945945        final int buffered_lines;
    946946
    947         /** Number of common prefix elements. */
    948         final int prefix_lines = 0;
    949 
    950947        /** Vector, indexed by line number, containing an equivalence code for
    951948           each line.  It is this vector that is actually compared with that
  • trunk/src/org/openstreetmap/josm/tools/ImageProvider.java

    r6172 r6235  
    116116     * Caches the image data for rotated versions of the same image.
    117117     */
    118     private static final Map<Image, Map<Long, ImageResource>> rotateCache = new HashMap<Image, Map<Long, ImageResource>>();
    119 
    120     private static final ExecutorService imageFetcher = Executors.newSingleThreadExecutor();
     118    private static final Map<Image, Map<Long, ImageResource>> ROTATE_CACHE = new HashMap<Image, Map<Long, ImageResource>>();
     119
     120    private static final ExecutorService IMAGE_FETCHER = Executors.newSingleThreadExecutor();
    121121
    122122    public interface ImageCallback {
     
    339339                }
    340340            };
    341             imageFetcher.submit(fetch);
     341            IMAGE_FETCHER.submit(fetch);
    342342        } else {
    343343            ImageIcon result = get();
     
    856856        ImageResource imageResource = null;
    857857
    858         synchronized (rotateCache) {
    859             Map<Long, ImageResource> cacheByAngle = rotateCache.get(img);
     858        synchronized (ROTATE_CACHE) {
     859            Map<Long, ImageResource> cacheByAngle = ROTATE_CACHE.get(img);
    860860            if (cacheByAngle == null) {
    861                 rotateCache.put(img, cacheByAngle = new HashMap<Long, ImageResource>());
     861                ROTATE_CACHE.put(img, cacheByAngle = new HashMap<Long, ImageResource>());
    862862            }
    863863           
Note: See TracChangeset for help on using the changeset viewer.