Ignore:
Timestamp:
2018-12-31T19:36:59+01:00 (5 years ago)
Author:
Don-vip
Message:

fix various SonarQube issues

Location:
trunk/src/org/openstreetmap/josm/data
Files:
5 edited

Legend:

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

    r14460 r14624  
    489489                GpxData d = new GpxData();
    490490                d.addTrack(trk);
    491                 return new GpxLayer(d, ensureUniqueName(attrs, counts)); })
     491                return new GpxLayer(d, ensureUniqueName(attrs, counts));
     492            })
    492493            .forEachOrdered(layer -> MainApplication.getLayerManager().addLayer(layer));
    493494    }
     
    509510     */
    510511    public synchronized int getTrackSegsCount() {
    511         return privateTracks.stream().collect(Collectors.summingInt(t -> t.getSegments().size()));
     512        return privateTracks.stream().mapToInt(t -> t.getSegments().size()).sum();
    512513    }
    513514
  • trunk/src/org/openstreetmap/josm/data/gpx/GpxImageEntry.java

    r14210 r14624  
    2727 * @since 14205 (extracted from gui.layer.geoimage.ImageEntry)
    2828 */
    29 public class GpxImageEntry implements Comparable<GpxImageEntry>, Cloneable {
     29public class GpxImageEntry implements Comparable<GpxImageEntry> {
    3030    private File file;
    3131    private Integer exifOrientation;
     
    7373
    7474    /**
     75     * Constructs a new {@code GpxImageEntry} from an existing instance.
     76     * @param other existing instance
     77     * @since 14624
     78     */
     79    public GpxImageEntry(GpxImageEntry other) {
     80        file = other.file;
     81        exifOrientation = other.exifOrientation;
     82        exifCoor = other.exifCoor;
     83        exifImgDir = other.exifImgDir;
     84        exifTime = other.exifTime;
     85        isNewGpsData = other.isNewGpsData;
     86        exifGpsTime = other.exifGpsTime;
     87        pos = other.pos;
     88        speed = other.speed;
     89        elevation = other.elevation;
     90        gpsTime = other.gpsTime;
     91        width = other.width;
     92        height = other.height;
     93        tmp = other.tmp;
     94    }
     95
     96    /**
    7597     * Constructs a new {@code GpxImageEntry}.
    7698     * @param file Path to image file on disk
     
    311333    public void setExifImgDir(Double exifDir) {
    312334        this.exifImgDir = exifDir;
    313     }
    314 
    315     @Override
    316     public GpxImageEntry clone() {
    317         try {
    318             return (GpxImageEntry) super.clone();
    319         } catch (CloneNotSupportedException e) {
    320             throw new IllegalStateException(e);
    321         }
    322335    }
    323336
     
    370383     */
    371384    public void createTmp() {
    372         tmp = clone();
     385        tmp = new GpxImageEntry(this);
    373386        tmp.tmp = null;
    374387    }
  • trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoader.java

    r14261 r14624  
    7878     */
    7979    public static ThreadPoolExecutor getNewThreadPoolExecutor(String nameFormat, int workers, int hostLimit) {
    80         ThreadPoolExecutor executor = new ThreadPoolExecutor(
     80        return new ThreadPoolExecutor(
    8181                workers, // keep core pool the same size as max, as we use unbounded queue so there will
    8282                workers, // be never more threads than corePoolSize
     
    8686                Utils.newThreadFactory(nameFormat, Thread.NORM_PRIORITY)
    8787                );
    88         return executor;
    8988    }
    9089
  • trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2Proj4DirGridShiftFileSource.java

    r13647 r14624  
    1010import java.util.Collections;
    1111import java.util.List;
     12import java.util.stream.Collectors;
    1213
     14import org.openstreetmap.josm.spi.preferences.Config;
    1315import org.openstreetmap.josm.tools.Logging;
    1416import org.openstreetmap.josm.tools.Platform;
     
    7476    }
    7577
     78    private static List<File> visit(String prefSuffix, String... defaults) {
     79        return Config.getPref().getList("ntv2.proj4.grid.dir." + prefSuffix, Arrays.asList(defaults))
     80                               .stream().map(File::new).collect(Collectors.toList());
     81    }
     82
    7683    @Override
    7784    public List<File> visitUnixoid() {
    78         return Arrays.asList(new File("/usr/local/share/proj"), new File("/usr/share/proj"));
     85        return visit("unix", "/usr/local/share/proj", "/usr/share/proj");
    7986    }
    8087
    8188    @Override
    8289    public List<File> visitWindows() {
    83         return Arrays.asList(new File("C:\\PROJ\\NAD"));
     90        return visit("windows", "C:\\PROJ\\NAD");
    8491    }
    8592
  • trunk/src/org/openstreetmap/josm/data/validation/tests/UnconnectedWays.java

    r14468 r14624  
    230230                    continue;
    231231                }
    232                 if (!s.highway && endnodesHighway.contains(en) && !s.w.concernsArea()) {
    233                     map.put(en, s.w);
    234                 } else if (endnodes.contains(en) && !s.w.concernsArea()) {
     232                if (((!s.highway && endnodesHighway.contains(en)) || endnodes.contains(en)) && !s.w.concernsArea()) {
    235233                    map.put(en, s.w);
    236234                }
Note: See TracChangeset for help on using the changeset viewer.