Changeset 6981 in josm


Ignore:
Timestamp:
2014-04-15T13:56:36+02:00 (6 years ago)
Author:
Don-vip
Message:

fix some sonar issues

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

Legend:

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

    r6890 r6981  
    100100        if (zipRequired) {
    101101            zip = true;
    102         } else if (ff == joz) {
     102        } else if (joz.equals(ff)) {
    103103            zip = true;
    104         } else if (ff == jos) {
     104        } else if (jos.equals(ff)) {
    105105            zip = false;
    106106        } else {
     
    231231        }
    232232
    233         protected Component getDisabledExportPanel(Layer layer) {
     233        protected final Component getDisabledExportPanel(Layer layer) {
    234234            JPanel p = new JPanel(new GridBagLayout());
    235235            JCheckBox include = new JCheckBox();
  • trunk/src/org/openstreetmap/josm/actions/ShowStatusReportAction.java

    r6850 r6981  
    104104        }
    105105        try {
    106             final String env_java_home = System.getenv("JAVA_HOME");
    107             final String env_java_home_alt = Main.platform instanceof PlatformHookWindows ? "%JAVA_HOME%" : "${JAVA_HOME}";
    108             final String prop_java_home = System.getProperty("java.home");
    109             final String prop_java_home_alt = "<java.home>";
     106            final String envJavaHome = System.getenv("JAVA_HOME");
     107            final String envJavaHomeAlt = Main.platform instanceof PlatformHookWindows ? "%JAVA_HOME%" : "${JAVA_HOME}";
     108            final String propJavaHome = System.getProperty("java.home");
     109            final String propJavaHomeAlt = "<java.home>";
    110110            // Build a new list of VM parameters to modify it below if needed (default implementation returns an UnmodifiableList instance)
    111111            List<String> vmArguments = new ArrayList<String>(ManagementFactory.getRuntimeMXBean().getInputArguments());
     
    119119                    // Shorten some parameters for readability concerns
    120120                    } else {
    121                         shortenParam(it, param, env_java_home, env_java_home_alt);
    122                         shortenParam(it, param, prop_java_home, prop_java_home_alt);
     121                        shortenParam(it, param, envJavaHome, envJavaHomeAlt);
     122                        shortenParam(it, param, propJavaHome, propJavaHomeAlt);
    123123                    }
    124124                }
  • trunk/src/org/openstreetmap/josm/actions/SimplifyWayAction.java

    r6639 r6981  
    9696        DataSet ds = getCurrentDataSet();
    9797        ds.beginUpdate();
    98         try
    99         {
     98        try {
    10099            List<Way> ways = OsmPrimitive.getFilteredList(ds.getSelected(), Way.class);
    101100            if (ways.isEmpty()) {
    102101                alertSelectAtLeastOneWay();
    103102                return;
    104             } else if (!confirmWayWithNodesOutsideBoundingBox(ways))
     103            } else if (!confirmWayWithNodesOutsideBoundingBox(ways)) {
    105104                return;
    106             else if (ways.size() > 10) {
    107                 if (!confirmSimplifyManyWays(ways.size()))
    108                     return;
     105            } else if (ways.size() > 10 && !confirmSimplifyManyWays(ways.size())) {
     106                return;
    109107            }
    110108
     
    269267
    270268    public static double xtd(double lat1, double lon1, double lat2, double lon2, double lat3, double lon3) {
    271         double dist_AD = dist(lat1, lon1, lat3, lon3);
    272         double crs_AD = course(lat1, lon1, lat3, lon3);
    273         double crs_AB = course(lat1, lon1, lat2, lon2);
    274         return Math.asin(Math.sin(dist_AD) * Math.sin(crs_AD - crs_AB));
     269        double distAD = dist(lat1, lon1, lat3, lon3);
     270        double crsAD = course(lat1, lon1, lat3, lon3);
     271        double crsAB = course(lat1, lon1, lat2, lon2);
     272        return Math.asin(Math.sin(distAD) * Math.sin(crsAD - crsAB));
    275273    }
    276274
  • trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java

    r6959 r6981  
    334334            rolesToReAdd = null;
    335335            for (RelationMember rm : r.getMembers()) {
    336                 if (rm.isNode()) {
    337                     if (rm.getMember() == originalNode) {
    338                         if (newRel == null) {
    339                             newRel = new Relation(r);
    340                             rolesToReAdd = new HashSet<String>();
    341                         }
    342                         rolesToReAdd.add(rm.getRole());
     336                if (rm.isNode() && rm.getMember() == originalNode) {
     337                    if (newRel == null) {
     338                        newRel = new Relation(r);
     339                        rolesToReAdd = new HashSet<String>();
    343340                    }
     341                    rolesToReAdd.add(rm.getRole());
    344342                }
    345343            }
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/relations/MultipolygonCache.java

    r6362 r6981  
    3434import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    3535
    36 /*
     36/**
    3737 * A memory cache for Multipolygon objects.
    38  *
     38 * @since 4623
    3939 */
    4040public final class MultipolygonCache implements DataSetListener, LayerChangeListener, ProjectionChangeListener, SelectionChangedListener {
    4141
    42     private static final MultipolygonCache instance = new MultipolygonCache();
     42    private static final MultipolygonCache INSTANCE = new MultipolygonCache();
    4343   
    4444    private final Map<NavigatableComponent, Map<DataSet, Map<Relation, Multipolygon>>> cache;
     
    5454    }
    5555
     56    /**
     57     * Replies the unique instance.
     58     * @return the unique instance
     59     */
    5660    public static final MultipolygonCache getInstance() {
    57         return instance;
     61        return INSTANCE;
    5862    }
    5963
Note: See TracChangeset for help on using the changeset viewer.