Changeset 11436 in josm for trunk/src/org/openstreetmap/josm


Ignore:
Timestamp:
2017-01-07T01:15:43+01:00 (7 years ago)
Author:
Don-vip
Message:

fix recent Sonar issues

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

Legend:

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

    r11424 r11436  
    3232import java.util.MissingResourceException;
    3333import java.util.Objects;
     34import java.util.Optional;
    3435import java.util.ResourceBundle;
    3536import java.util.Set;
     
    6869import org.openstreetmap.josm.data.preferences.Setting;
    6970import org.openstreetmap.josm.data.preferences.StringSetting;
     71import org.openstreetmap.josm.gui.preferences.SourceEditor.ExtendedSourceEntry;
    7072import org.openstreetmap.josm.gui.preferences.validator.ValidatorTagCheckerRulesPreference;
    7173import org.openstreetmap.josm.gui.preferences.validator.ValidatorTagCheckerRulesPreference.RulePrefHelper;
     
    15841586            if (l.stream().noneMatch(x -> x.values().contains(url))) {
    15851587                RulePrefHelper helper = ValidatorTagCheckerRulesPreference.RulePrefHelper.INSTANCE;
    1586                 l.add(helper.serialize(helper.getDefault().stream().filter(x -> url.equals(x.url)).findFirst().get()));
     1588                Optional<ExtendedSourceEntry> val = helper.getDefault().stream().filter(x -> url.equals(x.url)).findFirst();
     1589                if (val.isPresent()) {
     1590                    l.add(helper.serialize(val.get()));
     1591                }
    15871592                putListOfStructs(key, l);
    15881593            }
  • trunk/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java

    r11431 r11436  
    144144
    145145    // copied value for line drawing
    146     private List<Integer> heatMapPolyX = new ArrayList<>();
    147     private List<Integer> heatMapPolyY = new ArrayList<>();
     146    private final List<Integer> heatMapPolyX = new ArrayList<>();
     147    private final List<Integer> heatMapPolyY = new ArrayList<>();
    148148
    149149    // setup color maps used by heat map
     
    369369                         "(" +
    370370                         "segments= " + visibleSegments.size() +
    371                          ", per 10000 = " + Utils.getDurationString(10000 * timeDiff / visibleSegments.size()) +
     371                         ", per 10000 = " + Utils.getDurationString(10_000 * timeDiff / visibleSegments.size()) +
    372372                         ")"
    373373              );
     
    449449            dateScale.setRange(minval, maxval);
    450450        }
    451 
    452451
    453452        // Now the colors for all the points will be assigned
     
    719718    }
    720719
    721    /**
     720    /**
    722721     * Draw GPX lines by using alpha blending
    723722     * @param g               the common draw object to use
     
    853852        // transform into lookup table
    854853        return colorTable;
    855     }
    856 
    857     /**
    858      * Creates a colormap by using a static color map with 1..n colors (RGB 0.0 ..1.0)
    859      * @param data array of multiple RGB color [n][3]
    860      * @return a dynamic list of color objects
    861      */
    862     protected static Color[] createColorFromRawArray(double[][] data) {
    863 
    864         // create the array
    865         Color[] color = new Color[ data.length ];
    866 
    867         for (int k = 0; k < data.length; k++) {
    868            // cast an map to linear array
    869            color[k] = new Color((float) data[k][0], (float) data[k][1], (float) data[k][2]);
    870         }
    871 
    872         // forward
    873         return createColorLut(color);
    874854    }
    875855
Note: See TracChangeset for help on using the changeset viewer.