Changeset 6223 in josm for trunk


Ignore:
Timestamp:
2013-09-08T05:51:16+02:00 (11 years ago)
Author:
Don-vip
Message:

Sonar - fix various violations

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/corrector/CorrectionTable.java

    r6084 r6223  
    1010import javax.swing.table.TableCellRenderer;
    1111
    12 public abstract class CorrectionTable<TM extends CorrectionTableModel<?>>
     12public abstract class CorrectionTable<T extends CorrectionTableModel<?>>
    1313        extends JTable {
    1414
     
    3434    private static BoldRenderer boldRenderer = null;
    3535
    36     protected CorrectionTable(TM correctionTableModel) {
     36    protected CorrectionTable(T correctionTableModel) {
    3737        super(correctionTableModel);
    3838
     
    5858
    5959    @SuppressWarnings("unchecked")
    60     public TM getCorrectionTableModel() {
    61         return (TM)getModel();
     60    public T getCorrectionTableModel() {
     61        return (T)getModel();
    6262    }
    6363
  • trunk/src/org/openstreetmap/josm/data/osm/User.java

    r5818 r6223  
    3939     *
    4040     * @param name the name
     41     * @return a new local user with the given name
    4142     */
    4243    public static User createLocalUser(String name) {
     
    5758     * @param uid  the user id
    5859     * @param name the name
     60     * @return a new OSM user with the given name and uid
    5961     */
    6062    public static User createOsmUser(long uid, String name) {
     
    107109    }
    108110
     111    /**
     112     * Replies the anonymous user
     113     * @return The anonymous user
     114     */
    109115    public static User getAnonymous() {
    110116        return anonymous;
     
    175181    }
    176182
     183    /**
     184     * Determines if this user is known to OSM
     185     * @return {@code true} if this user is known to OSM, {@code false} otherwise
     186     */
    177187    public boolean isOsmUser() {
    178188        return uid > 0;
    179189    }
    180190
     191    /**
     192     * Determines if this user is local
     193     * @return {@code true} if this user is local, {@code false} otherwise
     194     */
    181195    public boolean isLocalUser() {
    182196        return uid < 0;
     
    205219    public String toString() {
    206220        StringBuffer s = new StringBuffer();
    207         s.append("id:"+uid);
     221        s.append("id:").append(uid);
    208222        if (names.size() == 1) {
    209             s.append(" name:"+getName());
     223            s.append(" name:").append(getName());
    210224        }
    211225        else if (names.size() > 1) {
  • trunk/src/org/openstreetmap/josm/gui/help/HelpBrowserHistory.java

    r5923 r6223  
    5252        boolean add=true;
    5353
    54         if (historyPos >= 0 && historyPos < history.size() && history.get(historyPos).equals(url.toString())) {
     54        if (historyPos >= 0 && historyPos < history.size() && history.get(historyPos).equals(url)) {
    5555            add = false;
    5656        } else if (historyPos == history.size() -1) {
  • trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserDialogManager.java

    r6084 r6223  
    188188        @Override
    189189        public boolean evaluate(OsmPrimitive p) {
    190             if (hds.getHistory(p.getPrimitiveId()) == null)
     190            History h = hds.getHistory(p.getPrimitiveId());
     191            if (h == null)
    191192                // reload if the history is not in the cache yet
    192193                return true;
    193             else if (!p.isNew() && hds.getHistory(p.getPrimitiveId()).getByVersion(p.getUniqueId()) == null)
     194            else if (!p.isNew() && h.getByVersion(p.getUniqueId()) == null)
    194195                // reload if the history object of the selected object is not in the cache yet
    195196                return true;
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java

    r6106 r6223  
    3333import java.util.Comparator;
    3434import java.util.Date;
     35import java.util.Dictionary;
    3536import java.util.Hashtable;
    3637import java.util.List;
     
    7374import org.openstreetmap.josm.gui.layer.Layer;
    7475import org.openstreetmap.josm.gui.widgets.JosmComboBox;
     76import org.openstreetmap.josm.gui.widgets.JosmTextField;
    7577import org.openstreetmap.josm.io.GpxReader;
    7678import org.openstreetmap.josm.tools.ExifReader;
     
    7981import org.openstreetmap.josm.tools.PrimaryDateParser;
    8082import org.xml.sax.SAXException;
    81 import org.openstreetmap.josm.gui.widgets.JosmTextField;
    8283
    8384/** This class displays the window to select the GPX file and the offset (timezone + delta).
     
    881882            final JSlider sldTimezone = new JSlider(-24, 24, 0);
    882883            sldTimezone.setPaintLabels(true);
    883             Hashtable<Integer,JLabel> labelTable = new Hashtable<Integer, JLabel>();
     884            Dictionary<Integer,JLabel> labelTable = new Hashtable<Integer, JLabel>();
    884885            labelTable.put(-24, new JLabel("-12:00"));
    885886            labelTable.put(-12, new JLabel( "-6:00"));
  • trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceTabbedPane.java

    r6084 r6223  
    201201            @Override
    202202            public boolean identify(TabPreferenceSetting tps, Object name) {
    203                 return name != null && tps != null && tps.getIconName() != null && tps.getIconName().equals(name);
     203                return name != null && tps != null && tps.getIconName() != null && name.equals(tps.getIconName());
    204204            }}, name);
    205205    }
  • trunk/src/org/openstreetmap/josm/io/OsmServerObjectReader.java

    r6070 r6223  
    129129                sb.append("/full");
    130130            } else if (version > 0) {
    131                 sb.append("/"+version);
     131                sb.append("/").append(version);
    132132            }
    133133
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/RequestProcessor.java

    r6143 r6223  
    1919import java.util.StringTokenizer;
    2020import java.util.TreeMap;
    21 import java.util.logging.Level;
    22 import java.util.logging.Logger;
    2321import java.util.regex.Matcher;
    2422import java.util.regex.Pattern;
    2523
    26 import org.openstreetmap.josm.Main;
    2724import org.openstreetmap.josm.gui.help.HelpUtil;
    2825import org.openstreetmap.josm.io.remotecontrol.handler.AddNodeHandler;
     
    7875    /**
    7976     * Spawns a new thread for the request
     77     * @param request The request to process
    8078     */
    8179    public static void processRequest(Socket request) {
     
    214212                String usage = getUsageAsHtml();
    215213                String websiteDoc = HelpUtil.getWikiBaseHelpUrl() +"/Help/Preferences/RemoteControl";
    216                 String help = "No command specified! The following commands are available:<ul>"
    217                         + usage.toString()
     214                String help = "No command specified! The following commands are available:<ul>" + usage
    218215                        + "</ul>" + "See <a href=\""+websiteDoc+"\">"+websiteDoc+"</a> for complete documentation.";
    219216                sendBadRequest(out, help);
     
    449446    /**
    450447     * Reports HTML message with the description of all available commands
    451      * @return
     448     * @return HTML message with the description of all available commands
    452449     * @throws IllegalAccessException
    453450     * @throws InstantiationException
  • trunk/src/org/openstreetmap/josm/tools/LanguageInfo.java

    r6142 r6223  
    3838            if(code.matches("[^_]+_[^_]+")) {
    3939                code = code.substring(0,2);
    40                 if(code == "en")
     40                if ("en".equals(code))
    4141                    return null;
    4242            } else {
    4343                return null;
    4444            }
    45         } else if(type == LocaleType.DEFAULTNOTENGLISH && code == "en")
     45        } else if(type == LocaleType.DEFAULTNOTENGLISH && "en".equals(code))
    4646            return null;
    4747        return code.substring(0,1).toUpperCase() + code.substring(1) + ":";
  • trunk/src/org/openstreetmap/josm/tools/MultikeyActionsHandler.java

    r5463 r6223  
    3030
    3131    private static final long DIALOG_DELAY = 1000;
    32     private static final String STATUS_BAR_ID = new String("multikeyShortcut");
     32    private static final String STATUS_BAR_ID = "multikeyShortcut";
    3333
    3434    private Map<MultikeyShortcutAction, MyAction> myActions = new HashMap<MultikeyShortcutAction,MyAction>();
     
    120120    private static MultikeyActionsHandler instance;
    121121
     122    /**
     123     * Replies the unique instance of this class.
     124     * @return The unique instance of this class
     125     */
    122126    public static MultikeyActionsHandler getInstance() {
    123127        if (instance == null) {
     
    203207    }
    204208
     209    /**
     210     * Registers an action and its shortcut
     211     * @param action The action to add
     212     */
    205213    public void addAction(MultikeyShortcutAction action) {
    206         if(action.getMultikeyShortcut() != null) {
     214        if (action.getMultikeyShortcut() != null) {
    207215            MyAction myAction = new MyAction(action);
    208216            myActions.put(action, myAction);
     
    211219    }
    212220
    213     // unregister action and its shortcut completely
     221    /**
     222     * Unregisters an action and its shortcut completely
     223     * @param action The action to remove
     224     */
    214225    public void removeAction(MultikeyShortcutAction action) {
    215226        MyAction a = myActions.get(action);
  • trunk/src/org/openstreetmap/josm/tools/Property.java

    r3300 r6223  
    44/**
    55 * Small interface to define a property with both read and write access.
     6 * @param <O> Object type
     7 * @param <P> Property type
    68 */
    7 public interface Property<ObjectType, PropertyType> {
     9public interface Property<O, P> {
     10   
    811    /**
    912     * Get the value of the property.
     
    1114     * @return the value of the property for the object obj
    1215     */
    13     public PropertyType get(ObjectType obj);
     16    public P get(O obj);
     17   
    1418    /**
    1519     * Set the value of the property for the object.
     
    1721     * @param value the value the property is set to
    1822     */
    19     public void set(ObjectType obj, PropertyType value);
     23    public void set(O obj, P value);
    2024}
Note: See TracChangeset for help on using the changeset viewer.