Changeset 6977 in josm for trunk/src


Ignore:
Timestamp:
2014-04-15T00:43:24+02:00 (10 years ago)
Author:
Don-vip
Message:

fix some sonar issues recently introduced

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

Legend:

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

    r6380 r6977  
    2323    private String textLatLon, textEastNorth;
    2424
     25    /**
     26     * Constructs a new {@code AddNodeAction}.
     27     */
    2528    public AddNodeAction() {
    2629        super(tr("Add Node..."), "addnode", tr("Add a node by entering latitude / longitude or easting / northing."),
  • trunk/src/org/openstreetmap/josm/actions/AlignInLineAction.java

    r6961 r6977  
    257257            for(int i = 1; i < nodes.size()-1; i++)
    258258                if(nodes.get(i) == node) {
    259                     System.out.printf("Find 2 neighbors\n");
    260259                    neighbors.add(nodes.get(i-1));
    261260                    neighbors.add(nodes.get(i+1));
    262                     //lines.add(new Line(nodes.get(i-1), nodes.get(i+1)));
    263261                }
    264262            if(neighbors.size() == 0)
  • trunk/src/org/openstreetmap/josm/actions/CreateCircleAction.java

    r6942 r6977  
    9797     * Class designed to create a couple between a node and its angle relative to the center of the circle.
    9898     */
    99     private class PolarNode {
     99    private static class PolarNode {
    100100        double a;
    101101        Node node;
     
    111111     * Comparator used to order PolarNode relative to their angle.
    112112     */
    113     private class PolarNodeComparator implements Comparator<PolarNode> {
     113    private static class PolarNodeComparator implements Comparator<PolarNode> {
    114114
    115115        @Override
     
    186186            double yc = 0.5 * (y1 + y2);
    187187            center = new EastNorth(xc, yc);
    188         } else if (nodes.size() == 3) {
     188        } else {
    189189            // triangle: three single nodes needed or a way with three nodes
    190190            center = Geometry.getCenter(nodes);
  • trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java

    r6976 r6977  
    5454    private final LinkedList<Command> cmds = new LinkedList<Command>();
    5555    private int cmdsCount = 0;
    56     private final LinkedList<Relation> addedRelations = new LinkedList<Relation>();
     56    private final List<Relation> addedRelations = new LinkedList<Relation>();
    5757
    5858    /**
  • trunk/src/org/openstreetmap/josm/gui/MapStatus.java

    r6960 r6977  
    717717    private class MapStatusPopupMenu extends JPopupMenu {
    718718
    719         private final JMenuItem jumpButton = createActionComponent(Main.main.menu.jumpToAct);
     719        private final JMenuItem jumpButton = add(Main.main.menu.jumpToAct);
    720720       
    721721        private final Collection<JCheckBoxMenuItem> somItems = new ArrayList<JCheckBoxMenuItem>();
     
    743743            }
    744744           
    745             add(jumpButton);
    746745            add(separator);
    747746            add(doNotHide);
     
    751750                public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
    752751                    Component invoker = ((JPopupMenu)e.getSource()).getInvoker();
    753                     jumpButton.setVisible(invoker == latText || invoker == lonText);
    754                     String currentSOM = ProjectionPreference.PROP_SYSTEM_OF_MEASUREMENT.get();;
     752                    jumpButton.setVisible(latText.equals(invoker) || lonText.equals(invoker));
     753                    String currentSOM = ProjectionPreference.PROP_SYSTEM_OF_MEASUREMENT.get();
    755754                    for (JMenuItem item : somItems) {
    756755                        item.setSelected(item.getText().equals(currentSOM));
    757                         item.setVisible(invoker == distText);
     756                        item.setVisible(distText.equals(invoker));
    758757                    }
    759                     separator.setVisible(invoker == distText);
     758                    separator.setVisible(distText.equals(invoker));
    760759                    doNotHide.setSelected(Main.pref.getBoolean("statusbar.always-visible", true));
    761760                }
  • trunk/src/org/openstreetmap/josm/gui/io/DownloadPrimitivesWithReferrersTask.java

    r6973 r6977  
    7575        // All downloaded primitives are put in a tmpLayer
    7676        tmpLayer = new OsmDataLayer(new DataSet(), OsmDataLayer.createNewName(), null);
    77         //Main.main.addLayer(tmpLayer);
    7877    }
    7978
     
    194193     * Dialog for report a problem during download.
    195194     * @param errs Primitives involved
    196      * @param TITLE Title of dialog
    197      * @param TEXT Detail message
    198      * @param LIST_LABEL List of primitives description
    199      * @param msgType Type of message {@see JOptionPane}
     195     * @param title Title of dialog
     196     * @param text Detail message
     197     * @param listLabel List of primitives description
     198     * @param msgType Type of message, see {@link JOptionPane}
    200199     * @return The Dialog object
    201200     */
    202201    private static ExtendedDialog reportProblemDialog(Set<PrimitiveId> errs,
    203             String TITLE, String TEXT, String LIST_LABEL, int msgType) {
     202            String title, String text, String listLabel, int msgType) {
    204203        JPanel p = new JPanel(new GridBagLayout());
    205         p.add(new HtmlPanel(TEXT), GBC.eop());
    206         if (LIST_LABEL != null) {
    207             JLabel missing = new JLabel(LIST_LABEL);
     204        p.add(new HtmlPanel(text), GBC.eop());
     205        if (listLabel != null) {
     206            JLabel missing = new JLabel(listLabel);
    208207            missing.setFont(missing.getFont().deriveFont(Font.PLAIN));
    209208            p.add(missing, GBC.eol());
     
    221220        return new ExtendedDialog(
    222221                Main.parent,
    223                 TITLE,
     222                title,
    224223                new String[] { tr("Ok") })
    225224        .setButtonIcons(new String[] { "ok" })
  • trunk/src/org/openstreetmap/josm/gui/io/UploadPrimitivesTask.java

    r6643 r6977  
    77import static org.openstreetmap.josm.tools.I18n.trn;
    88
    9 import java.io.IOException;
    109import java.lang.reflect.InvocationTargetException;
    1110import java.util.HashSet;
     
    3837import org.openstreetmap.josm.io.OsmTransferException;
    3938import org.openstreetmap.josm.tools.ImageProvider;
    40 import org.xml.sax.SAXException;
    4139
    4240/**
    43  * The task for uploading a collection of primitives
     41 * The task for uploading a collection of primitives.
    4442 *
    4543 */
    46 public class UploadPrimitivesTask extends  AbstractUploadTask {
     44public class UploadPrimitivesTask extends AbstractUploadTask {
    4745    private boolean uploadCanceled = false;
    4846    private Exception lastException = null;
     
    240238    }
    241239
    242     @Override protected void realRun() throws SAXException, IOException {
     240    @Override protected void realRun() {
    243241        try {
    244242            uploadloop:while(true) {
     
    294292                }
    295293            }
    296         // if required close the changeset
    297         //
    298         if (strategy.isCloseChangesetAfterUpload() && changeset != null && !changeset.isNew() && changeset.isOpen()) {
    299             OsmApi.getOsmApi().closeChangeset(changeset, progressMonitor.createSubTaskMonitor(0, false));
    300         }
     294            // if required close the changeset
     295            //
     296            if (strategy.isCloseChangesetAfterUpload() && changeset != null && !changeset.isNew() && changeset.isOpen()) {
     297                OsmApi.getOsmApi().closeChangeset(changeset, progressMonitor.createSubTaskMonitor(0, false));
     298            }
    301299        } catch (Exception e) {
    302300            if (uploadCanceled) {
  • trunk/src/org/openstreetmap/josm/gui/layer/gpx/ChooseTrackVisibilityAction.java

    r6958 r6977  
    6464     * Class to format a length according to SystemOfMesurement.
    6565     */
    66     private final class TrackLength {
     66    private static final class TrackLength {
    6767        private double value;
    6868
     
    8888     * Comparator for TrackLength objects
    8989     */
    90     private final class LengthContentComparator implements Comparator<TrackLength> {
     90    private static final class LengthContentComparator implements Comparator<TrackLength> {
    9191
    9292        /**
  • trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java

    r6949 r6977  
    265265                            final Node n = w.getNode(i - 1);
    266266                            final Environment e2 = e.withPrimitive(n).withParent(w).withChild(e.osm);
    267                             if (left.matches(e2)) {
    268                                 if (link.matches(e2.withLinkContext())) {
    269                                     e.child = n;
    270                                     e.index = i;
    271                                     e.parent = w;
    272                                     return true;
    273                                 }
     267                            if (left.matches(e2) && link.matches(e2.withLinkContext())) {
     268                                e.child = n;
     269                                e.index = i;
     270                                e.parent = w;
     271                                return true;
    274272                            }
    275273                        }
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookOsx.java

    r6943 r6977  
    5151        String java = System.getProperty("java.version");
    5252        String os = System.getProperty("os.version");
    53         if (java != null && java.startsWith("1.6") && os != null && (
    54                 os.startsWith("10.7.") || os.startsWith("10.8") || os.startsWith("10.9"))) {
     53        if (java != null && java.startsWith("1.6") && os != null && os.matches("^10\\.[789].*")) {
    5554            askUpdateJava(java);
    5655        }
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookUnixoid.java

    r6962 r6977  
    4646            String os = getOSDescription();
    4747            if (java != null && java.startsWith("1.6") && os != null && (
    48                     os.startsWith("Linux Debian GNU/Linux 7") || os.startsWith("Linux Mint") ||
    49                     os.startsWith("Linux Ubuntu 12") || os.startsWith("Linux Ubuntu 13") || os.startsWith("Linux Ubuntu 14"))) {
     48                    os.startsWith("Linux Debian GNU/Linux 7") || os.startsWith("Linux Mint") || os.matches("^Linux Ubuntu 1[234].*"))) {
    5049                String url;
    5150                // apturl does not exist on Debian (see #8465)
  • trunk/src/org/openstreetmap/josm/tools/Utils.java

    r6972 r6977  
    7575    private static final int MILLIS_OF_DAY = 86400000;
    7676
    77     public static String URL_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~:/?#[]@!$&'()*+,;=";
     77    public static final String URL_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~:/?#[]@!$&'()*+,;=";
    7878   
    7979    /**
Note: See TracChangeset for help on using the changeset viewer.