Changeset 6246 in josm


Ignore:
Timestamp:
2013-09-22T18:36:07+02:00 (11 years ago)
Author:
Don-vip
Message:

Sonar/FindBugs - various bugfixes / violation fixes

Location:
trunk
Files:
50 edited
2 moved

Legend:

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

    r6130 r6246  
    132132            if(selectedWays.size() == 1) {
    133133                w = selectedWays.iterator().next();
    134                 if(w.containsNode(n) == false)
     134                if (!w.containsNode(n))
    135135                    // warning
    136136                    return;
  • trunk/src/org/openstreetmap/josm/actions/AutoScaleAction.java

    r6084 r6246  
    88import java.awt.event.ActionEvent;
    99import java.awt.event.KeyEvent;
     10import java.util.Arrays;
    1011import java.util.Collection;
     12import java.util.Collections;
    1113import java.util.HashSet;
    1214import java.util.List;
     
    3840public class AutoScaleAction extends JosmAction {
    3941
    40     public static final String[] MODES = {
     42    public static final Collection<String> MODES = Collections.unmodifiableList(Arrays.asList(
    4143        marktr("data"),
    4244        marktr("layer"),
     
    4648        marktr("problem"),
    4749        marktr("previous"),
    48         marktr("next")};
     50        marktr("next")));
    4951
    5052    private final String mode;
  • trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java

    r6130 r6246  
    6363    public static class JoinAreasResult {
    6464
    65         public boolean mergeSuccessful;
    6665        public boolean hasChanges;
    67         public boolean hasRelationProblems;
    6866
    6967        public List<Multipolygon> polygons;
     
    539537
    540538        result.hasChanges = true;
    541         result.mergeSuccessful = true;
    542539        result.polygons = polygons;
    543540        return result;
  • trunk/src/org/openstreetmap/josm/actions/JumpToAction.java

    r6203 r6246  
    6464                  BorderLayout.NORTH);
    6565
    66         class osmURLListener implements DocumentListener {
     66        class OsmURLListener implements DocumentListener {
    6767            @Override public void changedUpdate(DocumentEvent e) { parseURL(); }
    6868            @Override public void insertUpdate(DocumentEvent e) { parseURL(); }
     
    7070        }
    7171
    72         class osmLonLatListener implements DocumentListener {
     72        class OsmLonLatListener implements DocumentListener {
    7373            @Override public void changedUpdate(DocumentEvent e) { updateUrl(false); }
    7474            @Override public void insertUpdate(DocumentEvent e) { updateUrl(false); }
     
    7676        }
    7777
    78         osmLonLatListener x=new osmLonLatListener();
     78        OsmLonLatListener x = new OsmLonLatListener();
    7979        lat.getDocument().addDocumentListener(x);
    8080        lon.getDocument().addDocumentListener(x);
    8181        zm.getDocument().addDocumentListener(x);
    82         url.getDocument().addDocumentListener(new osmURLListener());
     82        url.getDocument().addDocumentListener(new OsmURLListener());
    8383
    8484        JPanel p = new JPanel(new GridBagLayout());
  • trunk/src/org/openstreetmap/josm/actions/MapRectifierWMSmenuAction.java

    r6239 r6246  
    2828import org.openstreetmap.josm.gui.widgets.JosmTextField;
    2929
    30 public class Map_Rectifier_WMSmenuAction extends JosmAction {
     30public class MapRectifierWMSmenuAction extends JosmAction {
    3131    /**
    3232     * Class that bundles all required information of a rectifier service
     
    6565    public ArrayList<RectifierService> services = new ArrayList<RectifierService>();
    6666
    67     public Map_Rectifier_WMSmenuAction() {
     67    public MapRectifierWMSmenuAction() {
    6868        super(tr("Rectified Image..."),
    6969                "OLmarker",
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadGpsTask.java

    r6244 r6246  
    161161            boolean merge = Main.pref.getBoolean("download.gps.mergeWithLocal", false);
    162162            Layer active = Main.map.mapView.getActiveLayer();
    163             if (active != null && active instanceof GpxLayer && (merge || ((GpxLayer)active).data.fromServer))
     163            if (active instanceof GpxLayer && (merge || ((GpxLayer)active).data.fromServer))
    164164                return (GpxLayer) active;
    165165            for (GpxLayer l : Main.map.mapView.getLayersOfType(GpxLayer.class)) {
  • trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java

    r6104 r6246  
    179179
    180180        // update selection to reflect which way being modified
    181         if (currentBaseNode != null && getCurrentDataSet() != null && getCurrentDataSet().getSelected().isEmpty() == false) {
     181        if (currentBaseNode != null && getCurrentDataSet() != null && !getCurrentDataSet().getSelected().isEmpty()) {
    182182            Way continueFrom = getWayForNode(currentBaseNode);
    183183            if (alt && continueFrom != null && (!currentBaseNode.isSelected() || continueFrom.isSelected())) {
  • trunk/src/org/openstreetmap/josm/actions/mapmode/ParallelWayAction.java

    r6107 r6246  
    310310            return;
    311311
    312         if(sanityCheck() == false)
     312        if (!sanityCheck())
    313313            return;
    314314
     
    586586    }
    587587
    588     private String getStringPref(String subKey) {
    589         return getStringPref(subKey, null);
    590     }
    591 
    592588    @Override
    593589    public void preferenceChanged(PreferenceChangeEvent e) {
  • trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java

    r6215 r6246  
    312312                // only show merge to node cursor if nearby node and that node is currently
    313313                // not being dragged
    314                 final boolean hasTarget = osm != null && osm instanceof Node && !osm.isSelected();
     314                final boolean hasTarget = osm instanceof Node && !osm.isSelected();
    315315                c = hasTarget ? "merge_to_node" : "merge";
    316316                break;
  • trunk/src/org/openstreetmap/josm/command/RotateCommand.java

    r6069 r6246  
    2626
    2727    /**
    28      * World position of the mouse when the user started the command.
    29      *
    30      */
    31     EastNorth startEN = null;
    32 
    33     /**
    3428     * angle of rotation starting click to pivot
    3529     */
     
    4943
    5044        pivot = getNodesCenter();
    51 
    52         // We remember the very first position of the mouse for this action.
    53         // Note that SelectAction will keep the same ScaleCommand when the user
    54         // releases the button and presses it again with the same modifiers.
    55         // The very first point of this operation is stored here.
    56         startEN   = currentEN;
    57 
    5845        startAngle = getAngle(currentEN);
    5946        rotationAngle = 0.0;
  • trunk/src/org/openstreetmap/josm/data/Version.java

    r6087 r6246  
    131131        isLocalBuild = false;
    132132        value = properties.get("Is-Local-Build");
    133         if (value != null && value.trim().toLowerCase().equals("true"))  {
     133        if (value != null && value.trim().equalsIgnoreCase("true"))  {
    134134            isLocalBuild = true;
    135135        }
  • trunk/src/org/openstreetmap/josm/data/gpx/WayPoint.java

    r6203 r6246  
    1 //License: GPLv2 or later
    2 //Copyright 2007 by Raphael Mack and others
    3 
     1// License: GPL. For details, see LICENSE file.
    42package org.openstreetmap.josm.data.gpx;
    53
  • trunk/src/org/openstreetmap/josm/data/osm/AbstractPrimitive.java

    r6215 r6246  
    398398    @Override
    399399    public void setVisible(boolean visible) throws IllegalStateException{
    400         if (isNew() && visible == false)
     400        if (isNew() && !visible)
    401401            throw new IllegalStateException(tr("A primitive with ID = 0 cannot be invisible."));
    402402        updateFlags(FLAG_VISIBLE, visible);
  • trunk/src/org/openstreetmap/josm/data/osm/WaySegment.java

    r5909 r6246  
    5050
    5151    @Override public boolean equals(Object o) {
    52         return o != null && o instanceof WaySegment
     52        return o instanceof WaySegment
    5353            && ((WaySegment) o).way == way
    5454            && ((WaySegment) o).lowerIndex == lowerIndex;
  • trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java

    r6192 r6246  
    8484     */
    8585    @SuppressWarnings("unchecked")
    86     public static Class<Test>[] allAvailableTests = new Class[] {
     86    private static final Class<Test>[] allAvailableTests = new Class[] {
    8787        DuplicateNode.class, // ID    1 ..   99
    8888        OverlappingWays.class, // ID  101 ..  199
  • trunk/src/org/openstreetmap/josm/gui/ImageryMenu.java

    r6098 r6246  
    2727import org.openstreetmap.josm.actions.AddImageryLayerAction;
    2828import org.openstreetmap.josm.actions.JosmAction;
    29 import org.openstreetmap.josm.actions.Map_Rectifier_WMSmenuAction;
     29import org.openstreetmap.josm.actions.MapRectifierWMSmenuAction;
    3030import org.openstreetmap.josm.data.coor.LatLon;
    3131import org.openstreetmap.josm.data.imagery.ImageryInfo;
     
    8080    private JMenuItem singleOffset = new JMenuItem(offsetAction);
    8181    private JMenuItem offsetMenuItem = singleOffset;
    82     private Map_Rectifier_WMSmenuAction rectaction = new Map_Rectifier_WMSmenuAction();
     82    private MapRectifierWMSmenuAction rectaction = new MapRectifierWMSmenuAction();
    8383
    8484    public ImageryMenu(JMenu subMenu) {
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r6221 r6246  
    395395        if ((!args.containsKey(Option.NO_MAXIMIZE) && maximized) || args.containsKey(Option.MAXIMIZE)) {
    396396            if (Toolkit.getDefaultToolkit().isFrameStateSupported(JFrame.MAXIMIZED_BOTH)) {
    397                 // Main.debug("Main window maximized");
    398397                Main.windowState = JFrame.MAXIMIZED_BOTH;
    399398                mainFrame.setExtendedState(Main.windowState);
     
    401400                Main.debug("Main window: maximizing not supported");
    402401            }
    403         } else {
    404             // Main.debug("Main window not maximized");
    405         }
    406         if(main.menu.fullscreenToggleAction != null) {
     402        }
     403        if (main.menu.fullscreenToggleAction != null) {
    407404            main.menu.fullscreenToggleAction.initial();
    408405        }
  • trunk/src/org/openstreetmap/josm/gui/MainMenu.java

    r6180 r6246  
    329329    public final JMenu helpMenu = addMenu(marktr("Help"), KeyEvent.VK_H, 11, ht("/Menu/Help"));
    330330
    331     private final int defaultMenuPos = 11;
     331    private static final int defaultMenuPos = 11;
    332332
    333333    public final JosmAction moveUpAction = new MoveAction(MoveAction.Direction.UP);
  • trunk/src/org/openstreetmap/josm/gui/MapFrame.java

    r6070 r6246  
    429429         */
    430430        sideToolBar.setComponentPopupMenu(new JPopupMenu() {
    431             final int staticMenuEntryCount = 2;
     431            static final int staticMenuEntryCount = 2;
    432432            JCheckBoxMenuItem doNotHide = new JCheckBoxMenuItem(new AbstractAction(tr("Do not hide toolbar")) {
    433433                @Override
  • trunk/src/org/openstreetmap/josm/gui/MenuScroller.java

    r6084 r6246  
    11/**
    2  * @(#)MenuScroller.java    1.5.0 04/02/12
     2 * MenuScroller.java    1.5.0 04/02/12
    33 * License: use / modify without restrictions (see http://tips4java.wordpress.com/about/)
    44 */
     
    438438     */
    439439    @Override
    440     public void finalize() throws Throwable {
     440    protected void finalize() throws Throwable {
    441441        dispose();
    442442    }
  • trunk/src/org/openstreetmap/josm/gui/OsmPrimitivRenderer.java

    r6084 r6246  
    7070     */
    7171    private Component renderer(Component def, OsmPrimitive value) {
    72         if (def != null && value != null && def instanceof JLabel) {
     72        if (value != null && def instanceof JLabel) {
    7373            ((JLabel)def).setText(getComponentText(value));
    7474            ImageIcon icon = ImageProvider.get(value.getDisplayType());
     
    9191     */
    9292    private Component renderer(Component def, HistoryOsmPrimitive value) {
    93         if (def != null && value != null && def instanceof JLabel) {
     93        if (value != null && def instanceof JLabel) {
    9494            ((JLabel)def).setText(value.getDisplayName(DefaultNameFormatter.getInstance()));
    9595            ((JLabel)def).setIcon(ImageProvider.get(value.getType()));
  • trunk/src/org/openstreetmap/josm/gui/SideButton.java

    r6101 r6246  
    2929    private PropertyChangeListener propertyChangeListener;
    3030
    31     public SideButton(Action action)
    32     {
     31    public SideButton(Action action) {
    3332        super(action);
    3433        fixIcon(action);
     
    3635    }
    3736
    38     public SideButton(Action action, boolean usename)
    39     {
     37    public SideButton(Action action, boolean usename) {
    4038        super(action);
    4139        if(!usename) {
     
    4644    }
    4745
    48     public SideButton(Action action, String imagename)
    49     {
     46    public SideButton(Action action, String imagename) {
    5047        super(action);
    5148        setIcon(makeIcon(imagename));
     
    6764        }
    6865        Icon i = getIcon();
    69         if (i != null && i instanceof ImageIcon && i.getIconHeight() != iconHeight) {
     66        if (i instanceof ImageIcon && i.getIconHeight() != iconHeight) {
    7067            setIcon(getScaledImage(((ImageIcon) i).getImage()));
    7168        }
  • trunk/src/org/openstreetmap/josm/gui/bbox/SlippyMapBBoxChooser.java

    r6203 r6246  
    1717import java.util.HashSet;
    1818import java.util.List;
    19 import java.util.Vector;
    2019import java.util.concurrent.CopyOnWriteArrayList;
    2120
     
    382381        MapMarkerDot xmax_ymax = new MapMarkerDot(bbox.getMaxLat(), bbox.getMaxLon());
    383382
    384         Vector<MapMarker> marker = new Vector<MapMarker>(2);
     383        List<MapMarker> marker = new ArrayList<MapMarker>(2);
    385384        marker.add(xmin_ymin);
    386385        marker.add(xmax_ymax);
  • trunk/src/org/openstreetmap/josm/gui/bbox/TileSelectionBBoxChooser.java

    r6203 r6246  
    2121import java.beans.PropertyChangeEvent;
    2222import java.beans.PropertyChangeListener;
     23import java.util.ArrayList;
    2324import java.util.HashSet;
     25import java.util.List;
    2426import java.util.Set;
    25 import java.util.Vector;
    2627import java.util.regex.Matcher;
    2728import java.util.regex.Pattern;
     
    5051import org.openstreetmap.josm.gui.widgets.AbstractTextComponentValidator;
    5152import org.openstreetmap.josm.gui.widgets.HtmlPanel;
     53import org.openstreetmap.josm.gui.widgets.JosmTextField;
    5254import org.openstreetmap.josm.gui.widgets.SelectAllOnFocusGainedDecorator;
    5355import org.openstreetmap.josm.tools.ImageProvider;
    54 import org.openstreetmap.josm.gui.widgets.JosmTextField;
    5556
    5657/**
     
    156157        MapMarkerDot xmax_ymax = new MapMarkerDot(bbox.getMaxLat(), bbox.getMaxLon());
    157158
    158         Vector<MapMarker> marker = new Vector<MapMarker>(2);
     159        List<MapMarker> marker = new ArrayList<MapMarker>(2);
    159160        marker.add(xmin_ymin);
    160161        marker.add(xmax_ymax);
  • trunk/src/org/openstreetmap/josm/gui/dialogs/DialogsPanel.java

    r6172 r6246  
    2020    protected List<ToggleDialog> allDialogs = new ArrayList<ToggleDialog>();
    2121    protected MultiSplitPane mSpltPane = new MultiSplitPane();
    22     final protected int DIVIDER_SIZE = 5;
     22    protected static final int DIVIDER_SIZE = 5;
    2323
    2424    /**
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java

    r6172 r6246  
    236236        public void actionPerformed(ActionEvent e) {
    237237            toggleButtonHook();
    238             if(getValue("toolbarbutton") != null && getValue("toolbarbutton") instanceof JButton) {
     238            if (getValue("toolbarbutton") instanceof JButton) {
    239239                ((JButton) getValue("toolbarbutton")).setSelected(!isShowing);
    240240            }
     
    255255                showNotify();
    256256            }
    257         }
    258 
    259         @Override
    260         public void destroy() {
    261             super.destroy();
    262257        }
    263258    }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java

    r6142 r6246  
    822822                        ++cnt;
    823823                    } else if (cnt == 0) {
    824                         positionString += "," + String.valueOf(cur);
     824                        positionString += "," + cur;
    825825                    } else {
    826                         positionString += "-" + String.valueOf(last);
    827                         positionString += "," + String.valueOf(cur);
     826                        positionString += "-" + last;
     827                        positionString += "," + cur;
    828828                        cnt = 0;
    829829                    }
     
    831831                }
    832832                if (cnt >= 1) {
    833                     positionString += "-" + String.valueOf(last);
     833                    positionString += "-" + last;
    834834                }
    835835            }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java

    r6113 r6246  
    3838import java.util.List;
    3939import java.util.Map;
    40 import java.util.Vector;
    4140
    4241import javax.swing.AbstractAction;
     
    374373                    }
    375374                }
    376                 Collection<Command> commands=new Vector<Command>();
     375                Collection<Command> commands = new ArrayList<Command>();
    377376                commands.add(new ChangePropertyCommand(sel, key, null));
    378377                if (value.equals(tr("<different>"))) {
    379                     HashMap<String, Vector<OsmPrimitive>> map=new HashMap<String, Vector<OsmPrimitive>>();
     378                    Map<String, ArrayList<OsmPrimitive>> map = new HashMap<String, ArrayList<OsmPrimitive>>();
    380379                    for (OsmPrimitive osm: sel) {
    381                         String val=osm.get(key);
    382                         if(val != null)
    383                         {
     380                        String val = osm.get(key);
     381                        if (val != null) {
    384382                            if (map.containsKey(val)) {
    385383                                map.get(val).add(osm);
    386384                            } else {
    387                                 Vector<OsmPrimitive> v = new Vector<OsmPrimitive>();
     385                                ArrayList<OsmPrimitive> v = new ArrayList<OsmPrimitive>();
    388386                                v.add(osm);
    389387                                map.put(val, v);
     
    391389                        }
    392390                    }
    393                     for (Map.Entry<String, Vector<OsmPrimitive>> e: map.entrySet()) {
     391                    for (Map.Entry<String, ArrayList<OsmPrimitive>> e: map.entrySet()) {
    394392                        commands.add(new ChangePropertyCommand(e.getValue(), newkey, e.getKey()));
    395393                    }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberRoleCellEditor.java

    r6084 r6246  
    5050    }
    5151
    52     @Override
    53     public void cancelCellEditing() {
    54         super.cancelCellEditing();
    55     }
    56 
    57     @Override
    58     public boolean stopCellEditing() {
    59         return super.stopCellEditing();
    60     }
    61 
    6252    /** Returns the edit field for this cell editor. */
    6353    public AutoCompletingTextField getEditor() {
  • trunk/src/org/openstreetmap/josm/gui/history/TwoColumnDiff.java

    r6222 r6246  
    6565    private void diff() {
    6666        Diff diff = new Diff(reference, current);
    67         Diff.change script = diff.diff_2(false);
     67        Diff.Change script = diff.diff_2(false);
    6868        twoColumnDiffFromScript(script, reference, current);
    6969    }
     
    7373     * This method expands this script into a full two column description.
    7474     */
    75     private void twoColumnDiffFromScript(Diff.change script, Object[] a, Object[] b) {
     75    private void twoColumnDiffFromScript(Diff.Change script, Object[] a, Object[] b) {
    7676        int ia = 0;
    7777        int ib = 0;
  • trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java

    r6143 r6246  
    122122
    123123    protected GeorefImage[][] images;
    124     protected final int serializeFormatVersion = 5;
     124    protected static final int serializeFormatVersion = 5;
    125125    protected boolean autoDownloadEnabled = true;
    126126    protected boolean autoResolutionEnabled = true;
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java

    r6223 r6246  
    3737import java.util.List;
    3838import java.util.TimeZone;
    39 import java.util.Vector;
    4039import java.util.zip.GZIPInputStream;
    4140
     
    116115
    117116    ExtendedDialog syncDialog;
    118     Vector<GpxDataWrapper> gpxLst = new Vector<GpxDataWrapper>();
     117    List<GpxDataWrapper> gpxLst = new ArrayList<GpxDataWrapper>();
    119118    JPanel outerPanel;
    120119    JosmComboBox cbGpx;
     
    292291
    293292            String[] tmp = TimeZone.getAvailableIDs();
    294             Vector<String> vtTimezones = new Vector<String>(tmp.length);
     293            List<String> vtTimezones = new ArrayList<String>(tmp.length);
    295294
    296295            for (String tzStr : tmp) {
     
    904903            // This is called whenever one of the sliders is moved.
    905904            // It updates the labels and also calls the "match photos" code
    906             class sliderListener implements ChangeListener {
     905            class SliderListener implements ChangeListener {
    907906                @Override
    908907                public void stateChanged(ChangeEvent e) {
     
    970969
    971970            // Call the sliderListener once manually so labels get adjusted
    972             new sliderListener().stateChanged(null);
     971            new SliderListener().stateChanged(null);
    973972            // Listeners added here, otherwise it tries to match three times
    974973            // (when setting the default values)
    975             sldTimezone.addChangeListener(new sliderListener());
    976             sldMinutes.addChangeListener(new sliderListener());
    977             sldSeconds.addChangeListener(new sliderListener());
     974            sldTimezone.addChangeListener(new SliderListener());
     975            sldMinutes.addChangeListener(new SliderListener());
     976            sldSeconds.addChangeListener(new SliderListener());
    978977
    979978            // There is no way to cancel this dialog, all changes get applied
  • trunk/src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSourceHandler.java

    r6085 r6246  
    3131        AreaPrototype area = new AreaPrototype();
    3232        IconPrototype icon = new IconPrototype();
    33         public void init()
    34         {
     33        public void init() {
    3534            conditions = null;
    3635            scaleMax = Double.POSITIVE_INFINITY;
     
    5049    }
    5150
    52     Color convertColor(String colString)
    53     {
     51    Color convertColor(String colString) {
    5452        int i = colString.indexOf('#');
    5553        Color ret;
     
    8078
    8179    private void startElementLine(String qName, Attributes atts, LinePrototype line) {
    82         for (int count=0; count<atts.getLength(); count++)
    83         {
    84             if(atts.getQName(count).equals("width"))
    85             {
     80        for (int count=0; count<atts.getLength(); count++) {
     81            if(atts.getQName(count).equals("width")) {
    8682                String val = atts.getValue(count);
    8783                if (! (val.startsWith("+") || val.startsWith("-") || val.endsWith("%"))) {
    8884                    line.setWidth(Integer.parseInt(val));
    8985                }
    90             }
    91             else if (atts.getQName(count).equals("colour")) {
     86            } else if (atts.getQName(count).equals("colour")) {
    9287                line.color=convertColor(atts.getValue(count));
    9388            } else if (atts.getQName(count).equals("realwidth")) {
     
    122117    private void startElementLinemod(String qName, Attributes atts, LinemodPrototype line) {
    123118        startElementLine(qName, atts, line);
    124         for (int count=0; count<atts.getLength(); count++)
    125         {
    126             if(atts.getQName(count).equals("width"))
    127             {
     119        for (int count=0; count<atts.getLength(); count++) {
     120            if (atts.getQName(count).equals("width")) {
    128121                String val = atts.getValue(count);
    129                 if(val.startsWith("+"))
    130                 {
     122                if (val.startsWith("+")) {
    131123                    line.setWidth(Integer.parseInt(val.substring(1)));
    132124                    line.widthMode = LinemodPrototype.WidthMode.OFFSET;
    133                 }
    134                 else if(val.startsWith("-"))
    135                 {
     125                } else if(val.startsWith("-")) {
    136126                    line.setWidth(Integer.parseInt(val));
    137127                    line.widthMode = LinemodPrototype.WidthMode.OFFSET;
    138                 }
    139                 else if(val.endsWith("%"))
    140                 {
     128                } else if(val.endsWith("%")) {
    141129                    line.setWidth(Integer.parseInt(val.substring(0, val.length()-1)));
    142130                    line.widthMode = LinemodPrototype.WidthMode.PERCENT;
     
    151139
    152140    @Override public void startElement(String uri,String name, String qName, Attributes atts) {
    153         if (inDoc==true)
    154         {
     141        if (inDoc) {
    155142            if (qName.equals("rule")) {
    156143                inRule=true;
    157             } else if (qName.equals("rules"))
    158             {
     144            } else if (qName.equals("rules")) {
    159145                if (style.name == null) {
    160146                    style.name = atts.getValue("name");
     
    166152                    style.icon = atts.getValue("icon");
    167153                }
    168             }
    169             else if (qName.equals("scale_max")) {
     154            } else if (qName.equals("scale_max")) {
    170155                inScaleMax = true;
    171156            } else if (qName.equals("scale_min")) {
    172157                inScaleMin = true;
    173             } else if (qName.equals("condition") && inRule)
    174             {
     158            } else if (qName.equals("condition") && inRule) {
    175159                inCondition=true;
    176160                XmlCondition c = rule.cond;
    177                 if(c.key != null)
    178                 {
     161                if (c.key != null) {
    179162                    if(rule.conditions == null) {
    180163                        rule.conditions = new LinkedList<XmlCondition>();
     
    184167                    rule.conditions.add(c);
    185168                }
    186                 for (int count=0; count<atts.getLength(); count++)
    187                 {
    188                     if(atts.getQName(count).equals("k")) {
     169                for (int count=0; count<atts.getLength(); count++) {
     170                    if (atts.getQName(count).equals("k")) {
    189171                        c.key = atts.getValue(count);
    190                     } else if(atts.getQName(count).equals("v")) {
     172                    } else if (atts.getQName(count).equals("v")) {
    191173                        c.value = atts.getValue(count);
    192174                    } else if(atts.getQName(count).equals("b")) {
     
    199181                    error("The condition has no key!");
    200182                }
    201             }
    202             else if (qName.equals("line"))
    203             {
     183            } else if (qName.equals("line")) {
    204184                hadLine = inLine = true;
    205185                startElementLine(qName, atts, rule.line);
    206             }
    207             else if (qName.equals("linemod"))
    208             {
     186            } else if (qName.equals("linemod")) {
    209187                hadLineMod = inLineMod = true;
    210188                startElementLinemod(qName, atts, rule.linemod);
    211             }
    212             else if (qName.equals("icon"))
    213             {
     189            } else if (qName.equals("icon")) {
    214190                inIcon = true;
    215                 for (int count=0; count<atts.getLength(); count++)
    216                 {
     191                for (int count=0; count<atts.getLength(); count++) {
    217192                    if (atts.getQName(count).equals("src")) {
    218193                        IconReference icon = new IconReference(atts.getValue(count), style);
     
    227202                    }
    228203                }
    229             }
    230             else if (qName.equals("area"))
    231             {
     204            } else if (qName.equals("area")) {
    232205                hadArea = inArea = true;
    233206                for (int count=0; count<atts.getLength(); count++)
     
    251224    @Override public void endElement(String uri,String name, String qName)
    252225    {
    253         if (inRule && qName.equals("rule"))
    254         {
    255             if(hadLine)
     226        if (inRule && qName.equals("rule")) {
     227            if (hadLine) {
     228                style.add(rule.cond, rule.conditions,
     229                        new LinePrototype(rule.line, new Range(rule.scaleMin, rule.scaleMax)));
     230            }
     231            if (hadLineMod)
    256232            {
    257233                style.add(rule.cond, rule.conditions,
    258                         new LinePrototype(rule.line, new Range(rule.scaleMin, rule.scaleMax)));
    259             }
    260             if(hadLineMod)
     234                        new LinemodPrototype(rule.linemod, new Range(rule.scaleMin, rule.scaleMax)));
     235            }
     236            if (hadIcon)
    261237            {
    262238                style.add(rule.cond, rule.conditions,
    263                         new LinemodPrototype(rule.linemod, new Range(rule.scaleMin, rule.scaleMax)));
    264             }
    265             if(hadIcon)
    266             {
    267                 style.add(rule.cond, rule.conditions,
    268239                        new IconPrototype(rule.icon, new Range(rule.scaleMin, rule.scaleMax)));
    269240            }
    270             if(hadArea)
     241            if (hadArea)
    271242            {
    272243                style.add(rule.cond, rule.conditions,
     
    276247            hadLine = hadLineMod = hadIcon = hadArea = false;
    277248            rule.init();
    278         }
    279         else if (inCondition && qName.equals("condition")) {
     249        } else if (inCondition && qName.equals("condition")) {
    280250            inCondition = false;
    281251        } else if (inLine && qName.equals("line")) {
     
    294264    }
    295265
    296     @Override public void characters(char[] ch, int start, int length)
    297     {
    298         if (inScaleMax == true) {
     266    @Override public void characters(char[] ch, int start, int length) {
     267        if (inScaleMax) {
    299268            rule.scaleMax = Long.parseLong(new String(ch, start, length));
    300         } else if (inScaleMin == true) {
     269        } else if (inScaleMin) {
    301270            rule.scaleMin = Long.parseLong(new String(ch, start, length));
    302271        }
  • trunk/src/org/openstreetmap/josm/gui/preferences/advanced/AdvancedPreference.java

    r6085 r6246  
    332332                        +"</html>", null, "")) {
    333333                    Main.pref.resetToDefault();
    334                     try { Main.pref.save(); } catch (IOException ex) {}
     334                    try {
     335                        Main.pref.save();
     336                    } catch (IOException e) {
     337                        Main.warn("IOException while saving preferences: "+e.getMessage());
     338                    }
    335339                    readPreferences(Main.pref);
    336340                    applyFilter();
  • trunk/src/org/openstreetmap/josm/gui/preferences/display/LafPreference.java

    r6084 r6246  
    6363        } catch (Exception ex) {
    6464            // just ignore, Quaqua may not even be installed...
    65             //System.out.println("Failed to load Quaqua: " + ex);
    6665        }
    6766
  • trunk/src/org/openstreetmap/josm/gui/preferences/map/MapPaintPreference.java

    r6148 r6246  
    8686    static class MapPaintSourceEditor extends SourceEditor {
    8787
    88         final private String iconpref = "mappaint.icon.sources";
     88        private static final String iconpref = "mappaint.icon.sources";
    8989
    9090        public MapPaintSourceEditor() {
  • trunk/src/org/openstreetmap/josm/gui/preferences/map/TaggingPresetPreference.java

    r6143 r6246  
    187187    static class TaggingPresetSourceEditor extends SourceEditor {
    188188
    189         final private String iconpref = "taggingpreset.icon.sources";
     189        private static final String iconpref = "taggingpreset.icon.sources";
    190190
    191191        public TaggingPresetSourceEditor() {
  • trunk/src/org/openstreetmap/josm/gui/preferences/projection/CodeProjectionChoice.java

    r6231 r6246  
    5050        List<String> data;
    5151        List<String> filteredData;
    52         final String DEFAULT_CODE = "EPSG:3857";
     52        static final String DEFAULT_CODE = "EPSG:3857";
    5353        String lastCode = DEFAULT_CODE;
    5454        ActionListener listener;
  • trunk/src/org/openstreetmap/josm/gui/preferences/projection/LambertProjectionChoice.java

    r5548 r6246  
    1616public class LambertProjectionChoice extends ListProjectionChoice {
    1717
    18     public static String[] lambert4zones = {
     18    private static final String[] lambert4zones = {
    1919        tr("{0} ({1} to {2} degrees)", 1,"51.30","48.15"),
    2020        tr("{0} ({1} to {2} degrees)", 2,"48.15","45.45"),
     
    2323    };
    2424
     25    /**
     26     * Constructs a new {@code LambertProjectionChoice}.
     27     */
    2528    public LambertProjectionChoice() {
    2629        super(tr("Lambert 4 Zones (France)"), "core:lambert", lambert4zones, tr("Lambert CC Zone"));
  • trunk/src/org/openstreetmap/josm/gui/preferences/projection/ProjectionPreference.java

    r6084 r6246  
    175175         * Using the UTM transvers Mercator projection and specific geodesic settings.
    176176         */
    177         registerProjectionChoice(utm_france_dom = new UTM_France_DOM_ProjectionChoice());                            // FR
     177        registerProjectionChoice(utm_france_dom = new UTMFranceDOMProjectionChoice());                            // FR
    178178
    179179        /**
  • trunk/src/org/openstreetmap/josm/gui/preferences/projection/UTMFranceDOMProjectionChoice.java

    r6239 r6246  
    77import java.util.Collections;
    88
    9 public class UTM_France_DOM_ProjectionChoice extends ListProjectionChoice {
     9public class UTMFranceDOMProjectionChoice extends ListProjectionChoice {
    1010
    1111    private final static String FortMarigotName = tr("Guadeloupe Fort-Marigot 1949");
     
    2323    private final static Integer[] utmEPSGs = { FortMarigotEPSG, SainteAnneEPSG, MartiniqueEPSG, ReunionEPSG, GuyaneEPSG };
    2424
    25     public UTM_France_DOM_ProjectionChoice() {
     25    /**
     26     * Constructs a new {@code UTMFranceDOMProjectionChoice}.
     27     */
     28    public UTMFranceDOMProjectionChoice() {
    2629        super(tr("UTM France (DOM)"), "core:utmfrancedom", utmGeodesicsNames, tr("UTM Geodesic system"));
    2730    }
  • trunk/src/org/openstreetmap/josm/gui/preferences/shortcut/ShortcutPreference.java

    r6084 r6246  
    4141        JPanel p = gui.createPreferenceTab(this);
    4242
    43         PrefJPanel prefpanel = new PrefJPanel(new scListModel());
     43        PrefJPanel prefpanel = new PrefJPanel(new ScListModel());
    4444        p.add(prefpanel, GBC.eol().fill(GBC.BOTH));
    4545        if (defaultFilter!=null) prefpanel.filter(defaultFilter);
     
    5656
    5757    // Maybe move this to prefPanel? There's no need for it to be here.
    58     private static class scListModel extends AbstractTableModel {
     58    private static class ScListModel extends AbstractTableModel {
    5959        private String[] columnNames = new String[]{tr("Action"), tr("Shortcut")};
    6060        private List<Shortcut> data;
    6161
    62         public scListModel() {
     62        public ScListModel() {
    6363            data = Shortcut.listAll();
    6464        }
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetItems.java

    r6231 r6246  
    204204            String cstring;
    205205            if(count > 0 && !required) {
    206                 cstring = "0,"+String.valueOf(count);
     206                cstring = "0,"+count;
    207207            } else if(count > 0) {
    208208                cstring = String.valueOf(count);
     
    10101010        }
    10111011
    1012         protected String getDisplayIfNull(String display) {
    1013             return display;
     1012        protected String getDisplayIfNull() {
     1013            return null;
    10141014        }
    10151015
     
    10201020            String value = null;
    10211021            if (display == null) {
    1022                 display = getDisplayIfNull(display);
     1022                display = getDisplayIfNull();
    10231023            }
    10241024
     
    12081208
    12091209        @Override
    1210         protected String getDisplayIfNull(String display) {
     1210        protected String getDisplayIfNull() {
    12111211            if (combo.isEditable())
    12121212                return combo.getEditor().getItem().toString();
    12131213            else
    1214                 return display;
    1215 
     1214                return null;
    12161215        }
    12171216    }
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetMenu.java

    r6074 r6246  
    3131                    tr("Preset group {0}", getLocaleName())));
    3232        putValue("toolbar", "tagginggroup_" + getRawName());
    33     }
    34    
    35     @Override
    36     public void setIcon(String iconName) {
    37         super.setIcon(iconName);
    3833    }
    3934
  • trunk/src/org/openstreetmap/josm/io/GeoJSONWriter.java

    r6009 r6246  
    1717    private OsmDataLayer layer;
    1818    private StringBuilder out;
    19     private final boolean skipEmptyNodes = true;
     19    private static final boolean skipEmptyNodes = true;
    2020    private boolean insertComma = false;
    2121
  • trunk/src/org/openstreetmap/josm/io/OsmServerReader.java

    r6244 r6246  
    146146
    147147                return FixEncoding(new ProgressInputStream(activeConnection, progressMonitor), encoding);
    148             } catch(Exception e) {
    149                 if (e instanceof OsmTransferException)
    150                     throw (OsmTransferException)e;
    151                 else
    152                     throw new OsmTransferException(e);
     148            } catch (OsmTransferException e) {
     149                throw e;
     150            } catch (Exception e) {
     151                throw new OsmTransferException(e);
    153152            }
    154153        } finally {
  • trunk/src/org/openstreetmap/josm/tools/AudioPlayer.java

    r6070 r6246  
    305305                                        bytesToSkip -= nBytesRead;
    306306                                    }
    307                                     if (bytesToSkip > 0) {
    308                                         audioInputStream.skip(bytesToSkip);
     307                                    while (bytesToSkip > 0) {
     308                                        long skippedBytes = audioInputStream.skip(bytesToSkip);
     309                                        bytesToSkip -= skippedBytes;
     310                                        if (skippedBytes == 0) {
     311                                            // Avoid inifinite loop
     312                                            Main.warn("Unable to skip bytes from audio input stream");
     313                                            bytesToSkip = 0;
     314                                        }
    309315                                    }
    310316                                    position = offset;
  • trunk/src/org/openstreetmap/josm/tools/Diff.java

    r6235 r6246  
    9797    public Diff(Object[] a,Object[] b) {
    9898        Map<Object,Integer> h = new HashMap<Object,Integer>(a.length + b.length);
    99         filevec = new file_data[] { new file_data(a,h),new file_data(b,h) };
     99        filevec = new FileData[] { new FileData(a,h),new FileData(b,h) };
    100100    }
    101101
     
    123123                   search of the edit matrix. */
    124124    private int fdiagoff, bdiagoff;
    125     private final file_data[] filevec;
     125    private final FileData[] filevec;
    126126    private int cost;
    127127    /** Snakes bigger than this are considered "big". */
     
    358358                filevec[0].changed_flag[1+filevec[0].realindexes[xoff++]] = true;
    359359            }
    360         } else
    361         {
     360        } else {
    362361            /* Find a point of correspondence in the middle of the files.  */
    363362
     
    378377                compareseq (xoff, b, yoff, b - d);
    379378                /* This used to use f instead of b,
    380            but that is incorrect!
    381            It is not necessarily the case that diagonal d
    382            has a snake from b to f.  */
     379                   but that is incorrect!
     380                   It is not necessarily the case that diagonal d
     381                   has a snake from b to f.  */
    383382                compareseq (b, xlim, b - d, ylim);
    384383            }
     
    388387    /** Discard lines from one file that have no matches in the other file.
    389388     */
    390 
    391389    private void discard_confusing_lines() {
    392390        filevec[0].discard_confusing_lines(filevec[1]);
     
    397395
    398396    /** Adjust inserts/deletes of blank lines to join changes
    399      as much as possible.
     397        as much as possible.
    400398     */
    401 
    402399    private void shift_boundaries() {
    403400        if (inhibit)
     
    409406    public interface ScriptBuilder {
    410407        /** Scan the tables of which lines are inserted and deleted,
    411      producing an edit script.
    412    @param changed0 true for lines in first file which do not match 2nd
    413    @param len0 number of lines in first file
    414    @param changed1 true for lines in 2nd file which do not match 1st
    415    @param len1 number of lines in 2nd file
    416    @return a linked list of changes - or null
     408            producing an edit script.
     409            @param changed0 true for lines in first file which do not match 2nd
     410            @param len0 number of lines in first file
     411            @param changed1 true for lines in 2nd file which do not match 1st
     412            @param len1 number of lines in 2nd file
     413            @return a linked list of changes - or null
    417414         */
    418         public change build_script(
     415        public Change build_script(
    419416                boolean[] changed0,int len0,
    420417                boolean[] changed1,int len1
     
    427424    static class ReverseScript implements ScriptBuilder {
    428425        @Override
    429         public  change build_script(
     426        public  Change build_script(
    430427                final boolean[] changed0,int len0,
    431428                final boolean[] changed1,int len1)
    432429        {
    433             change script = null;
     430            Change script = null;
    434431            int i0 = 0, i1 = 0;
    435432            while (i0 < len0 || i1 < len1) {
     
    446443
    447444                    /* Record this change.  */
    448                     script = new change(line0, line1, i0 - line0, i1 - line1, script);
     445                    script = new Change(line0, line1, i0 - line0, i1 - line1, script);
    449446                }
    450447
     
    459456    static class ForwardScript implements ScriptBuilder {
    460457        /** Scan the tables of which lines are inserted and deleted,
    461        producing an edit script in forward order.  */
     458            producing an edit script in forward order.  */
    462459        @Override
    463         public change build_script(
     460        public Change build_script(
    464461                final boolean[] changed0,int len0,
    465462                final boolean[] changed1,int len1)
    466463        {
    467             change script = null;
     464            Change script = null;
    468465            int i0 = len0, i1 = len1;
    469466
     
    483480
    484481                    /* Record this change.  */
    485                     script = new change(i0, i1, line0 - i0, line1 - i1, script);
     482                    script = new Change(i0, i1, line0 - i0, line1 - i1, script);
    486483                }
    487484
     
    499496    reverseScript = new ReverseScript();
    500497
    501     /* Report the differences of two files.  DEPTH is the current directory
    502      depth. */
    503     public final change diff_2(final boolean reverse) {
     498    /** Report the differences of two files.  DEPTH is the current directory
     499        depth. */
     500    public final Change diff_2(final boolean reverse) {
    504501        return diff(reverse ? reverseScript : forwardScript);
    505502    }
     
    513510     @return the head of a list of changes
    514511     */
    515     public change diff(final ScriptBuilder bld) {
     512    public Change diff(final ScriptBuilder bld) {
    516513
    517514        /* Some lines are obviously insertions or deletions
     
    566563     which the insertion was done; vice versa for INSERTED and LINE1.  */
    567564
    568     public static class change {
     565    public static class Change {
    569566        /** Previous or next edit command. */
    570         public change link;
     567        public Change link;
    571568        /** # lines of file 1 changed here.  */
    572569        public final int inserted;
     
    577574        /** Line number of 1st inserted line.  */
    578575        public final int line1;
    579         /** Change is ignorable. */
    580         public boolean ignore;
    581576
    582577        /** Cons an additional entry onto the front of an edit script OLD.
     
    587582       If DELETED is 0 then LINE0 is the number of the line before
    588583       which the insertion was done; vice versa for INSERTED and LINE1.  */
    589         public change(int line0, int line1, int deleted, int inserted, change old) {
     584        public Change(int line0, int line1, int deleted, int inserted, Change old) {
    590585            this.line0 = line0;
    591586            this.line1 = line1;
     
    604599     */
    605600
    606     class file_data {
     601    class FileData {
    607602
    608603        /** Allocate changed array for the results of comparison.  */
    609604        void clear() {
    610605            /* Allocate a flag for each line of each file, saying whether that line
    611      is an insertion or deletion.
    612      Allocate an extra element, always zero, at each end of each vector.
     606               is an insertion or deletion.
     607               Allocate an extra element, always zero, at each end of each vector.
    613608             */
    614609            changed_flag = new boolean[buffered_lines + 2];
     
    616611
    617612        /** Return equiv_count[I] as the number of lines in this file
    618        that fall in equivalence class I.
     613         that fall in equivalence class I.
    619614         @return the array of equivalence class counts.
    620615         */
     
    640635      @param f the other file
    641636         */
    642         void discard_confusing_lines(file_data f) {
     637        void discard_confusing_lines(FileData f) {
    643638            clear();
    644639            /* Set up table of which lines are going to be discarded. */
     
    729724
    730725                    /* Now we have the length of a run of discardable lines
    731            whose first and last are not provisional.  */
     726                       whose first and last are not provisional.  */
    732727                    length = j - i;
    733728
    734729                    /* If 1/4 of the lines in the run are provisional,
    735            cancel discarding of all provisional lines in the run.  */
    736                     if (provisional * 4 > length)
    737                     {
     730                       cancel discarding of all provisional lines in the run.  */
     731                    if (provisional * 4 > length) {
    738732                        while (j > i)
    739733                            if (discards[--j] == 2) {
    740734                                discards[j] = 0;
    741735                            }
    742                     }
    743                     else
    744                     {
     736                    } else {
    745737                        int consec;
    746738                        int minimum = 1;
     
    817809
    818810        /** Actually discard the lines.
    819       @param discards flags lines to be discarded
     811            @param discards flags lines to be discarded
    820812         */
    821813        private void discard(final byte[] discards) {
     
    833825        }
    834826
    835         file_data(int[] data) {
     827        FileData(int[] data) {
    836828            buffered_lines = data.length;
    837829            equivs = data;
     
    840832        }
    841833       
    842         file_data(Object[] data,Map<Object,Integer> h) {
     834        FileData(Object[] data,Map<Object,Integer> h) {
    843835            this(new int[data.length]);
    844836            // FIXME: diff 2.7 removes common prefix and common suffix
     
    866858         */
    867859
    868         void shift_boundaries(file_data f) {
     860        void shift_boundaries(FileData f) {
    869861            final boolean[] changed = changed_flag;
    870862            final boolean[] other_changed = f.changed_flag;
     
    909901
    910902                    /* If the first changed line matches the following unchanged one,
    911          and this run does not follow right after a previous run,
    912          and there are no lines deleted from the other file here,
    913          then classify the first changed line as unchanged
    914          and the following line as changed in its place.  */
     903                       and this run does not follow right after a previous run,
     904                       and there are no lines deleted from the other file here,
     905                       then classify the first changed line as unchanged
     906                       and the following line as changed in its place.  */
    915907
    916908                    /* You might ask, how could this run follow right after another?
    917          Only because the previous run was shifted here.  */
     909                       Only because the previous run was shifted here.  */
    918910
    919911                    if (end != i_end
     
    929921                        ++i;
    930922                        /* Since one line-that-matches is now before this run
    931              instead of after, we must advance in the other file
    932              to keep in synch.  */
     923                           instead of after, we must advance in the other file
     924                           to keep in synch.  */
    933925                        ++j;
    934926                    } else {
     
    965957           The results of comparison are stored here.  */
    966958        boolean[]       changed_flag;
    967 
    968959    }
    969960}
  • trunk/src/org/openstreetmap/josm/tools/Geometry.java

    r6230 r6246  
    181181
    182182        for (int pos = 0; pos < ways.size(); pos ++) {
    183             if (changedWays[pos] == false) {
     183            if (!changedWays[pos]) {
    184184                continue;
    185185            }
  • trunk/src/org/openstreetmap/josm/tools/ImageProvider.java

    r6235 r6246  
    412412                                    try {
    413413                                        return new ImageResource(ImageIO.read(new ByteArrayInputStream(bytes)));
    414                                     } catch (IOException e) {}
     414                                    } catch (IOException e) {
     415                                        Main.warn("IOException while reading image: "+e.getMessage());
     416                                    }
    415417                                }
    416418                    }
     
    522524                try {
    523525                    img = ImageIO.read(is.getFile().toURI().toURL());
    524                 } catch (IOException e) {}
     526                } catch (IOException e) {
     527                    Main.warn("IOException while reading HTTP image: "+e.getMessage());
     528                }
    525529                return img == null ? null : new ImageResource(img);
    526530            default:
  • trunk/src/org/openstreetmap/josm/tools/TextTagParser.java

    r6142 r6246  
    3434   
    3535    public static class TextAnalyzer {
    36         int start = 0;
    37         boolean keyFound = false;
    3836        boolean quotesStarted = false;
    3937        boolean esc = false;
     
    4240        String data;
    4341        int n;
    44         boolean notFound;
    4542
    4643        public TextAnalyzer(String text) {
  • trunk/test/unit/org/openstreetmap/josm/tools/ExifReaderTest.java

    r6213 r6246  
    4949    public void testReadOrientation() {
    5050        Integer orientation = ExifReader.readOrientation(sampleFile);
    51         assertEquals(new Integer(1), orientation);
     51        assertEquals(Integer.valueOf(1), orientation);
    5252    }
    5353   
Note: See TracChangeset for help on using the changeset viewer.