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


Ignore:
Timestamp:
2014-01-31T02:44:56+01:00 (10 years ago)
Author:
Don-vip
Message:

Sonar - fix various issues

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

Legend:

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

    r5450 r6792  
    4343    }
    4444
     45    /**
     46     * Constructs a new {@code AbstractMergeAction}.
     47     */
    4548    public AbstractMergeAction() {
    4649        super();
     
    7477            return null;
    7578
    76         Layer targetLayer = (Layer) layerList.getSelectedItem();
    77         return targetLayer;
     79        return (Layer) layerList.getSelectedItem();
    7880    }
    7981
  • trunk/src/org/openstreetmap/josm/actions/ActionParameter.java

    r5170 r6792  
    4242            return value;
    4343        }
    44 
    4544    }
    4645
     
    5857        @Override
    5958        public SearchSetting readFromString(String s) {
    60             SearchSetting result = SearchSetting.readFromString(s);
    61             return result;
     59            return SearchSetting.readFromString(s);
    6260        }
    6361
     
    6866            return value.writeToString();
    6967        }
    70 
    7168    }
    7269}
  • trunk/src/org/openstreetmap/josm/actions/CreateMultipolygonAction.java

    r6765 r6792  
    7474        return update ? tr("Update multipolygon") : tr("Create multipolygon");
    7575    }
    76    
    77     private class CreateUpdateMultipolygonTask implements Runnable {
     76
     77    private static class CreateUpdateMultipolygonTask implements Runnable {
    7878        private final Collection<Way> selectedWays;
    7979        private final Relation multipolygonRelation;
  • trunk/src/org/openstreetmap/josm/actions/ExpertToggleAction.java

    r6327 r6792  
    2626    private static final List<WeakReference<Component>> visibilityToggleListeners = new ArrayList<WeakReference<Component>>();
    2727
    28     private static ExpertToggleAction INSTANCE = new ExpertToggleAction();
     28    private static final ExpertToggleAction INSTANCE = new ExpertToggleAction();
    2929
    3030    private synchronized static void fireExpertModeChanged(boolean isExpert) {
     
    133133    }
    134134
     135    @Override
    135136    protected void notifySelectedState() {
    136137        super.notifySelectedState();
  • trunk/src/org/openstreetmap/josm/actions/ImageryAdjustAction.java

    r6340 r6792  
    2727import org.openstreetmap.josm.gui.ExtendedDialog;
    2828import org.openstreetmap.josm.gui.layer.ImageryLayer;
     29import org.openstreetmap.josm.gui.widgets.JMultilineLabel;
     30import org.openstreetmap.josm.gui.widgets.JosmTextField;
    2931import org.openstreetmap.josm.tools.GBC;
    3032import org.openstreetmap.josm.tools.ImageProvider;
    31 import org.openstreetmap.josm.gui.widgets.JMultilineLabel;
    32 import org.openstreetmap.josm.gui.widgets.JosmTextField;
    3333
    3434public class ImageryAdjustAction extends MapMode implements MouseListener, MouseMotionListener, AWTEventListener{
     
    4242    private MapMode oldMapMode;
    4343
     44    /**
     45     * Constructs a new {@code ImageryAdjustAction} for the given layer.
     46     * @param layer The imagery layer
     47     */
    4448    public ImageryAdjustAction(ImageryLayer layer) {
    4549        super(tr("New offset"), "adjustimg",
     
    5054    }
    5155
    52     @Override public void enterMode() {
     56    @Override
     57    public void enterMode() {
    5358        super.enterMode();
    5459        if (layer == null)
     
    6368        offsetDialog.setVisible(true);
    6469    }
    65    
     70
    6671    protected void addListeners() {
    6772        Main.map.mapView.addMouseListener(this);
     
    7075            Toolkit.getDefaultToolkit().addAWTEventListener(this, AWTEvent.KEY_EVENT_MASK);
    7176        } catch (SecurityException ex) {
    72         }
    73     }
    74 
    75     @Override public void exitMode() {
     77            Main.error(ex);
     78        }
     79    }
     80
     81    @Override
     82    public void exitMode() {
    7683        super.exitMode();
    7784        if (offsetDialog != null) {
     
    8289        removeListeners();
    8390    }
    84    
     91
    8592    protected void removeListeners() {
    8693        try {
    8794            Toolkit.getDefaultToolkit().removeAWTEventListener(this);
    8895        } catch (SecurityException ex) {
     96            Main.error(ex);
    8997        }
    9098        if (Main.isDisplayingMapView()) {
     
    119127    }
    120128
    121     @Override public void mousePressed(MouseEvent e) {
     129    @Override
     130    public void mousePressed(MouseEvent e) {
    122131        if (e.getButton() != MouseEvent.BUTTON1)
    123132            return;
     
    130139    }
    131140
    132     @Override public void mouseDragged(MouseEvent e) {
     141    @Override
     142    public void mouseDragged(MouseEvent e) {
    133143        if (layer == null || prevEastNorth == null) return;
    134144        EastNorth eastNorth =
     
    144154    }
    145155
    146     @Override public void mouseReleased(MouseEvent e) {
     156    @Override
     157    public void mouseReleased(MouseEvent e) {
    147158        Main.map.mapView.repaint();
    148159        Main.map.mapView.resetCursor(this);
  • trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java

    r6546 r6792  
    272272            Toolkit.getDefaultToolkit().removeAWTEventListener(this);
    273273        } catch (SecurityException ex) {
     274            Main.warn(ex);
    274275        }
    275276
  • trunk/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java

    r6380 r6792  
    136136    private final Cursor cursorCreateNodes;
    137137
    138     private class ReferenceSegment {
     138    private static class ReferenceSegment {
    139139        public final EastNorth en;
    140140        public final EastNorth p1;
  • trunk/src/org/openstreetmap/josm/actions/mapmode/ParallelWayAction.java

    r6367 r6792  
    252252        boolean oldAlt = alt, oldShift = shift, oldCtrl = ctrl;
    253253        updateKeyModifiers(e);
    254         boolean changed = (oldAlt != alt || oldShift != shift || oldCtrl != ctrl);
    255         return changed;
     254        return (oldAlt != alt || oldShift != shift || oldCtrl != ctrl);
    256255    }
    257256
  • trunk/src/org/openstreetmap/josm/actions/relation/DeleteRelationsAction.java

    r6336 r6792  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.actions.relation;
     3
     4import static org.openstreetmap.josm.tools.I18n.tr;
    35
    46import java.awt.event.ActionEvent;
     
    810import org.openstreetmap.josm.tools.ImageProvider;
    911
    10 import static org.openstreetmap.josm.tools.I18n.tr;
    11 
    12 
    1312/**
    1413 * Action that delete relations
     
    1615 */
    1716public class DeleteRelationsAction extends AbstractRelationAction {
    18     class AbortException extends Exception {}
     17    static class AbortException extends Exception {}
    1918
    2019    /**
  • trunk/src/org/openstreetmap/josm/actions/search/SearchCompiler.java

    r6674 r6792  
    7777            addMatchFactory(new CoreUnaryMatchFactory());
    7878        }
    79 
    8079    }
    8180
     
    289288     */
    290289    public static class Always extends Match {
    291         public static Always INSTANCE = new Always();
     290        /** The unique instance/ */
     291        public static final Always INSTANCE = new Always();
    292292        @Override public boolean match(OsmPrimitive osm) {
    293293            return true;
  • trunk/src/org/openstreetmap/josm/actions/upload/FixDataHook.java

    r6699 r6792  
    7272     * Data fix to remove spaces at begin or end of tags
    7373     */
    74     public class FixDataSpace implements FixData {
     74    public static class FixDataSpace implements FixData {
    7575        @Override
    7676        public boolean fixKeys(Map<String, String> keys, OsmPrimitive osm) {
     
    105105     * Data fix to cleanup wrong spelled keys
    106106     */
    107     public class FixDataKey implements FixData {
     107    public static class FixDataKey implements FixData {
    108108        /** key of wrong data */
    109109        String oldKey;
     
    136136     * Data fix to cleanup wrong spelled tags
    137137     */
    138     public class FixDataTag implements FixData {
     138    public static class FixDataTag implements FixData {
    139139        /** key of wrong data */
    140140        String oldKey;
  • trunk/src/org/openstreetmap/josm/data/Preferences.java

    r6780 r6792  
    10331033     *  def otherwise
    10341034     */
     1035    @SuppressWarnings("unchecked")
    10351036    synchronized public <T extends Setting> T getSetting(String key, T def, Class<T> klass) {
    10361037        CheckParameterUtil.ensureParameterNotNull(key);
     
    10451046        Setting prop = settingsMap.get(key);
    10461047        if (klass.isInstance(prop)) {
    1047             @SuppressWarnings("unchecked")
    1048             T prop_cast = (T) prop;
    1049             return prop_cast;
     1048            return (T) prop;
    10501049        } else {
    10511050            return def;
     
    10751074     * If not a single entry could be found, <code>def</code> is returned.
    10761075     */
     1076    @SuppressWarnings({ "unchecked", "rawtypes" })
    10771077    synchronized public Collection<Collection<String>> getArray(String key, Collection<Collection<String>> def) {
    10781078        ListListSetting val = getSetting(key, ListListSetting.create(def), ListListSetting.class);
    1079         @SuppressWarnings({ "unchecked", "rawtypes" })
    1080         Collection<Collection<String>> val_cast = (Collection) val.getValue();
    1081         return val_cast;
     1079        return (Collection) val.getValue();
    10821080    }
    10831081
  • trunk/src/org/openstreetmap/josm/data/osm/OsmUtils.java

    r6362 r6792  
    88
    99public final class OsmUtils {
    10    
     10
    1111    private OsmUtils() {
    1212        // Hide default constructor for utils classes
    1313    }
    1414
    15     static List<String> TRUE_VALUES = new ArrayList<String>(Arrays
     15    static final List<String> TRUE_VALUES = new ArrayList<String>(Arrays
    1616            .asList(new String[] { "true", "yes", "1", "on" }));
    17     static List<String> FALSE_VALUES = new ArrayList<String>(Arrays
     17    static final List<String> FALSE_VALUES = new ArrayList<String>(Arrays
    1818            .asList(new String[] { "false", "no", "0", "off" }));
    19     static List<String> REVERSE_VALUES = new ArrayList<String>(Arrays
     19    static final List<String> REVERSE_VALUES = new ArrayList<String>(Arrays
    2020            .asList(new String[] { "reverse", "-1" }));
    2121
  • trunk/src/org/openstreetmap/josm/data/validation/tests/WayConnectedToArea.java

    r6724 r6792  
    6767    private void testForError(Way w, Node wayNode, OsmPrimitive p) {
    6868        if (wayNode.isOutsideDownloadArea()) {
     69            return;
    6970        } else if (Utils.exists(wayNode.getReferrers(), Predicates.hasTag("route", "ferry"))) {
     71            return;
    7072        } else if (isArea(p)) {
    7173            addError(w, wayNode, p);
  • trunk/src/org/openstreetmap/josm/gui/MapScaler.java

    r6084 r6792  
    11// License: GPL. See LICENSE file for details.
    2 
    32package org.openstreetmap.josm.gui;
    43
     
    1918    private final NavigatableComponent mv;
    2019
    21     private static int PADDING_RIGHT = 100;
     20    private static final int PADDING_RIGHT = 100;
    2221
    2322    public MapScaler(NavigatableComponent mv) {
     
    2726    }
    2827
    29     @Override public void paint(Graphics g) {
     28    @Override
     29    public void paint(Graphics g) {
    3030        String text = mv.getDist100PixelText();
    3131        Rectangle2D bound = g.getFontMetrics().getStringBounds(text, g);
     
    4141    }
    4242
    43     static public Color getColor()
    44     {
     43    static public Color getColor() {
    4544        return Main.pref.getColor(marktr("scale"), Color.white);
    4645    }
  • trunk/src/org/openstreetmap/josm/gui/conflict/pair/properties/PropertiesMerger.java

    r6267 r6792  
    3535 */
    3636public class PropertiesMerger extends JPanel implements Observer, IConflictResolver {
    37     private static DecimalFormat COORD_FORMATTER = new DecimalFormat("###0.0000000");
     37    private static final DecimalFormat COORD_FORMATTER = new DecimalFormat("###0.0000000");
    3838
    3939    private JLabel lblMyCoordinates;
  • trunk/src/org/openstreetmap/josm/gui/conflict/tags/MultiValueResolutionDecision.java

    r6316 r6792  
    249249            throw new IllegalStateException(tr("Not decided yet."));
    250250        String key = tags.getKeys().iterator().next();
    251         String value = getChosenValue();
    252         ChangePropertyCommand cmd = new ChangePropertyCommand(primitive, key,value);
    253         return cmd;
     251        return new ChangePropertyCommand(primitive, key, getChosenValue());
    254252    }
    255253
     
    267265            throw new IllegalStateException(tr("Not decided yet."));
    268266        String key = tags.getKeys().iterator().next();
    269         String value = getChosenValue();
    270         ChangePropertyCommand cmd = new ChangePropertyCommand(primitives, key,value);
    271         return cmd;
    272     }
    273 
    274     /**
    275      * Replies a tag representing the current resolution. Null, if this resolution is not resolved
    276      * yet.
    277      *
    278      * @return a tag representing the current resolution. Null, if this resolution is not resolved
    279      * yet
     267        return new ChangePropertyCommand(primitives, key, getChosenValue());
     268    }
     269
     270    /**
     271     * Replies a tag representing the current resolution. Null, if this resolution is not resolved yet.
     272     *
     273     * @return a tag representing the current resolution. Null, if this resolution is not resolved yet
    280274     */
    281275    public Tag getResolution() {
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationEditor.java

    r6316 r6792  
    8989                if (canEdit) {
    9090                    Constructor<RelationEditor> con = e.getConstructor(Relation.class, Collection.class);
    91                     RelationEditor editor = con.newInstance(layer, r, selectedMembers);
    92                     return editor;
     91                    return con.newInstance(layer, r, selectedMembers);
    9392                }
    9493            } catch (Exception ex) {
    95                 // plod on
     94                Main.warn(ex);
    9695            }
    9796        }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/sort/RelationNodeMap.java

    r6296 r6792  
    277277        Set<Integer> adj = nw.nodes.get(n);
    278278        if (adj == null || adj.isEmpty()) return null;
    279         Integer j = adj.iterator().next();
    280         return j;
     279        return adj.iterator().next();
    281280    }
    282281
  • trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserModel.java

    r6743 r6792  
    525525            OsmDataLayer editLayer = Main.main.getEditLayer();
    526526            if (editLayer == null) return null;
    527             OsmPrimitive p = editLayer.data.getPrimitiveById(latest.getId(), latest.getType());
    528             return p;
     527            return editLayer.data.getPrimitiveById(latest.getId(), latest.getType());
    529528        }
    530529
  • trunk/src/org/openstreetmap/josm/gui/history/NodeListViewer.java

    r6666 r6792  
    223223            OsmDataLayer editLayer = Main.main.getEditLayer();
    224224            if (editLayer == null) return null;
    225             OsmPrimitive p = editLayer.data.getPrimitiveById(primitiveId);
    226             return p;
     225            return editLayer.data.getPrimitiveById(primitiveId);
    227226        }
    228227
  • trunk/src/org/openstreetmap/josm/gui/history/RelationMemberListViewer.java

    r6207 r6792  
    2121public class RelationMemberListViewer extends HistoryViewerPanel {
    2222
    23     protected class MemberModelChanged implements TableModelListener {
     23    protected static class MemberModelChanged implements TableModelListener {
    2424        private final JTable table;
    2525
     
    3535    }
    3636
     37    @Override
    3738    protected JTable buildReferenceTable() {
    3839        JTable table = new JTable(
     
    4748    }
    4849
     50    @Override
    4951    protected JTable buildCurrentTable() {
    5052        JTable table = new JTable(
  • trunk/src/org/openstreetmap/josm/gui/layer/TMSLayer.java

    r6751 r6792  
    156156
    157157    private Set<Tile> tileRequestsOutstanding = new HashSet<Tile>();
    158    
     158
    159159    @Override
    160160    public synchronized void tileLoadingFinished(Tile tile, boolean success) {
     
    180180    }
    181181
    182     private class TmsTileClearController implements TileClearController, CancelListener {
     182    private static class TmsTileClearController implements TileClearController, CancelListener {
    183183
    184184        private final ProgressMonitor monitor;
     
    797797        if (x < 0 || x >= max || y < 0 || y >= max)
    798798            return null;
    799         Tile tile = tileCache.getTile(tileSource, x, y, zoom);
    800         return tile;
     799        return tileCache.getTile(tileSource, x, y, zoom);
    801800    }
    802801
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java

    r6643 r6792  
    9090    long delta;
    9191
     92    /**
     93     * Constructs a new {@code CorrelateGpxWithImages} action.
     94     * @param layer The image layer
     95     */
    9296    public CorrelateGpxWithImages(GeoImageLayer layer) {
    9397        super(tr("Correlate to GPX"), ImageProvider.get("dialogs/geoimage/gpx2img"));
     
    10151019                            firstGPXDate = dateParser.parse(curDateWpStr).getTime()/1000;
    10161020                            break outer;
    1017                         } catch(Exception e) {}
     1021                        } catch(Exception e) {
     1022                            Main.warn(e);
     1023                        }
    10181024                    }
    10191025                }
     
    11701176        return null;
    11711177    }
    1172    
     1178
    11731179    private int matchPoints(List<ImageEntry> images, WayPoint prevWp, long prevWpTime,
    11741180            WayPoint curWp, long curWpTime, long offset) {
     
    12361242            }
    12371243
    1238             if (curImg.tmp.getPos() == null) {
     1244            if (curImg.tmp.getPos() == null && prevWp != null) {
    12391245                // The values of timeDiff are between 0 and 1, it is not seconds but a dimensionless variable
    12401246                double timeDiff = (double)(imgTime - prevWpTime) / interval;
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java

    r6783 r6792  
    568568            }
    569569        } catch (MetadataException ex) {
     570            Main.debug(ex.getMessage());
    570571        }
    571572
     
    584585            e.setElevation(ele);
    585586        } catch (MetadataException ex) {
     587            Main.debug(ex.getMessage());
    586588        }
    587589
     
    603605            }
    604606        } catch (Exception ex) { // (CompoundException and other exceptions, e.g. #5271)
    605             // Do nothing
     607            Main.debug(ex.getMessage());
    606608        }
    607609
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageDisplay.java

    r6313 r6792  
    5151    private String osdText = null;
    5252
    53     private static int DRAG_BUTTON = Main.pref.getBoolean("geoimage.agpifo-style-drag-and-zoom", false) ? 1 : 3;
    54     private static int ZOOM_BUTTON = DRAG_BUTTON == 1 ? 3 : 1;
     53    private static final int DRAG_BUTTON = Main.pref.getBoolean("geoimage.agpifo-style-drag-and-zoom", false) ? 1 : 3;
     54    private static final int ZOOM_BUTTON = DRAG_BUTTON == 1 ? 3 : 1;
    5555
    5656    /** The thread that reads the images. */
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ThumbsLoader.java

    r6313 r6792  
    4040        for (int i = 0; i < data.size(); i++) {
    4141            if (stop) return;
    42 
    43             System.err.print("fetching image "+i);
    4442
    4543            data.get(i).thumbnail = loadThumb(data.get(i));
  • trunk/src/org/openstreetmap/josm/gui/mappaint/ElemStyles.java

    r6390 r6792  
    392392            }
    393393        }
    394         T res = mc.getCascade("default").get(key, def, c);
    395         return res;
     394        return mc.getCascade("default").get(key, def, c);
    396395    }
    397396
  • trunk/src/org/openstreetmap/josm/gui/preferences/advanced/MapListEditor.java

    r6767 r6792  
    213213
    214214    class MapTableModel extends AbstractTableModel {
     215        @SuppressWarnings("unchecked")
    215216        private List<List<String>> data() {
    216217            if (entryIdx == null) return Collections.emptyList();
    217             @SuppressWarnings("unchecked")
    218             List<List<String>> result = Arrays.asList(dataKeys.get(entryIdx), dataValues.get(entryIdx));
    219             return result;
     218            return Arrays.asList(dataKeys.get(entryIdx), dataValues.get(entryIdx));
    220219        }
    221220
  • trunk/src/org/openstreetmap/josm/gui/preferences/projection/CodeProjectionChoice.java

    r6295 r6792  
    2626import org.openstreetmap.josm.data.projection.Projection;
    2727import org.openstreetmap.josm.data.projection.Projections;
     28import org.openstreetmap.josm.gui.widgets.JosmTextField;
    2829import org.openstreetmap.josm.tools.GBC;
    29 import org.openstreetmap.josm.gui.widgets.JosmTextField;
    3030
    3131/**
     
    4343    }
    4444
    45     private class CodeSelectionPanel extends JPanel implements ListSelectionListener, DocumentListener {
     45    private static class CodeSelectionPanel extends JPanel implements ListSelectionListener, DocumentListener {
    4646
    4747        public JosmTextField filter;
  • trunk/src/org/openstreetmap/josm/gui/preferences/projection/CustomProjectionChoice.java

    r6295 r6792  
    3333import org.openstreetmap.josm.gui.widgets.HistoryComboBox;
    3434import org.openstreetmap.josm.gui.widgets.HtmlPanel;
     35import org.openstreetmap.josm.gui.widgets.JosmTextField;
    3536import org.openstreetmap.josm.tools.GBC;
    3637import org.openstreetmap.josm.tools.ImageProvider;
    3738import org.openstreetmap.josm.tools.Utils;
    38 import org.openstreetmap.josm.gui.widgets.JosmTextField;
    3939
    4040public class CustomProjectionChoice extends AbstractProjectionChoice implements SubPrefsOptions {
     
    189189            s.append("<b>+bounds=</b>minlon,minlat,maxlon,maxlat - <i>"+tr("Projection bounds (in degrees)")+"</i><br>");
    190190
    191             HtmlPanel info = new HtmlPanel(s.toString());
    192             return info;
     191            return new HtmlPanel(s.toString());
    193192        }
    194193
  • trunk/src/org/openstreetmap/josm/gui/preferences/projection/LambertCC9ZonesProjectionChoice.java

    r6295 r6792  
    1111import javax.swing.JPanel;
    1212
     13import org.openstreetmap.josm.Main;
    1314import org.openstreetmap.josm.tools.GBC;
    1415import org.openstreetmap.josm.tools.ImageProvider;
     
    7677                if(zoneval >= 0 && zoneval <= 8)
    7778                    return Collections.singleton(String.valueOf(zoneval+1));
    78             } catch(NumberFormatException ex) {}
     79            } catch(NumberFormatException ex) {
     80                Main.warn(ex);
     81            }
    7982        }
    8083        return null;
     
    9093        try {
    9194            return Integer.parseInt(zone) - 1;
    92         } catch(NumberFormatException e) {}
     95        } catch(NumberFormatException e) {
     96            Main.warn(e);
     97        }
    9398        return defaultIndex;
    9499    }
  • trunk/src/org/openstreetmap/josm/gui/preferences/projection/LambertProjectionChoice.java

    r6246 r6792  
    1111import javax.swing.JPanel;
    1212
     13import org.openstreetmap.josm.Main;
    1314import org.openstreetmap.josm.tools.GBC;
    1415import org.openstreetmap.josm.tools.ImageProvider;
     
    7071                if(zoneval >= 1 && zoneval <= 4)
    7172                    return Collections.singleton(zonestring);
    72             } catch(NumberFormatException e) {}
     73            } catch(NumberFormatException e) {
     74                Main.warn(e);
     75            }
    7376        }
    7477        return null;
     
    8487        try {
    8588            return Integer.parseInt(zone) - 1;
    86         } catch(NumberFormatException e) {}
     89        } catch(NumberFormatException e) {
     90            Main.warn(e);
     91        }
    8792        return defaultIndex;
    8893    }
    89 
    9094}
  • trunk/src/org/openstreetmap/josm/gui/preferences/projection/UTMFranceDOMProjectionChoice.java

    r6246 r6792  
    66import java.util.Collection;
    77import java.util.Collections;
     8
     9import org.openstreetmap.josm.Main;
    810
    911public class UTMFranceDOMProjectionChoice extends ListProjectionChoice {
     
    3941        try {
    4042            return Integer.parseInt(zone) - 1;
    41         } catch(NumberFormatException e) {}
     43        } catch(NumberFormatException e) {
     44            Main.warn(e);
     45        }
    4246        return defaultIndex;
    4347    }
  • trunk/src/org/openstreetmap/josm/gui/preferences/projection/UTMProjectionChoice.java

    r6316 r6792  
    1616import javax.swing.JRadioButton;
    1717
     18import org.openstreetmap.josm.Main;
    1819import org.openstreetmap.josm.tools.GBC;
    1920
    2021public class UTMProjectionChoice extends ListProjectionChoice {
    2122
    22     public enum Hemisphere { North, South }
     23    /** Earth emispheres **/
     24    public enum Hemisphere {
     25        /** North emisphere */
     26        North,
     27        /** South emisphere */
     28        South
     29    }
    2330
    2431    private static final Hemisphere DEFAULT_HEMISPHERE = Hemisphere.North;
     
    129136                if(zoneval > 0 && zoneval <= 60)
    130137                    return Arrays.asList(zonestring, hemisphere.toString());
    131             } catch(NumberFormatException e) {}
     138            } catch(NumberFormatException e) {
     139                Main.warn(e);
     140            }
    132141        }
    133142        return null;
     
    158167        try {
    159168            return Integer.parseInt(zone) - 1;
    160         } catch(NumberFormatException e) {}
     169        } catch(NumberFormatException e) {
     170            Main.warn(e);
     171        }
    161172        return defaultIndex;
    162173    }
  • trunk/src/org/openstreetmap/josm/gui/preferences/shortcut/PrefJPanel.java

    r6643 r6792  
    116116        filterField.setText(substring);
    117117    }
    118    
     118
    119119    private static class ScListModel extends AbstractTableModel {
    120120        private String[] columnNames = new String[]{tr("Action"), tr("Shortcut")};
     
    374374                }
    375375                model.fireTableDataChanged();
    376             }
    377             catch (PatternSyntaxException ex) { }
    378             catch (ClassCastException ex2) { /* eliminate warning */  }
     376            } catch (PatternSyntaxException ex) {
     377                Main.warn(ex);
     378            } catch (ClassCastException ex2) {
     379                Main.warn(ex2);
     380            }
    379381        }
    380382
     
    386388        public void removeUpdate(DocumentEvent arg0) { filter(); }
    387389    }
    388 
    389390}
  • trunk/src/org/openstreetmap/josm/gui/tagging/TagEditorModel.java

    r6316 r6792  
    238238    public TagModel get(int idx) {
    239239        if (idx >= tags.size()) return null;
    240         TagModel tagModel = tags.get(idx);
    241         return tagModel;
    242     }
    243 
    244     @Override public boolean isCellEditable(int row, int col) {
     240        return tags.get(idx);
     241    }
     242
     243    @Override
     244    public boolean isCellEditable(int row, int col) {
    245245        // all cells are editable
    246246        return true;
     
    484484            return null;
    485485
    486         String newkey = tag.getName();
    487         String newvalue = tag.getValue();
    488 
    489         ChangePropertyCommand command = new ChangePropertyCommand(primitives,newkey, newvalue);
    490         return command;
     486        return new ChangePropertyCommand(primitives, tag.getName(), tag.getValue());
    491487    }
    492488
  • trunk/src/org/openstreetmap/josm/gui/tagging/TaggingPresetItems.java

    r6772 r6792  
    7070public final class TaggingPresetItems {
    7171    private TaggingPresetItems() {    }
    72    
     72
    7373    private static int auto_increment_selected = 0;
    7474    public static final String DIFFERENT = tr("<different>");
     
    7979    private static final Map<String,EnumSet<TaggingPresetType>> typeCache =
    8080            new LinkedHashMap<String, EnumSet<TaggingPresetType>>(16, 1.1f, true);
    81    
     81
    8282    /**
    8383     * Last value of each key used in presets, used for prefilling corresponding fields
     
    279279        }
    280280    }
    281    
     281
    282282    public static class Usage {
    283283        TreeSet<String> values;
     
    310310         */
    311311        public String text;
    312        
     312
    313313        /**
    314314         * The context used for translating {@link #text}
    315315         */
    316316        public String text_context;
    317        
     317
    318318        /**
    319319         * The localized version of {@link #text}
     
    342342                    + (locale_text != null ? "locale_text=" + locale_text : "");
    343343        }
    344        
     344
    345345        @Override
    346346        public String toString() {
     
    365365         */
    366366        public String href;
    367        
     367
    368368        /**
    369369         * The localized version of {@link #href}
     
    421421        }
    422422    }
    423    
     423
    424424    public static class Roles extends TaggingPresetItem {
    425425
     
    526526            }
    527527        }
    528        
     528
    529529        @Override
    530530        public String toString() {
     
    566566        }
    567567    }
    568    
     568
    569569    public static class Text extends KeyedItem {
    570570
     
    670670                clearbutton.setFocusable(false);
    671671                bg.add(clearbutton);
    672                 // and its visible counterpart. - this mechanism allows us to 
    673                 // have *no* button selected after the X is clicked, instead 
     672                // and its visible counterpart. - this mechanism allows us to
     673                // have *no* button selected after the X is clicked, instead
    674674                // of the X remaining selected
    675675                JButton releasebutton = new JButton("X");
     
    703703            }
    704704        }
    705        
     705
    706706        @Override
    707707        public void addCommands(List<Tag> changedTags) {
     
    713713                return;
    714714            }
    715            
     715
    716716            v = Tag.removeWhiteSpaces(v);
    717717
     
    748748     */
    749749    public static class CheckGroup extends TaggingPresetItem {
    750        
     750
    751751        /**
    752752         * Number of columns (positive integer)
    753753         */
    754754        public String columns;
    755        
     755
    756756        /**
    757757         * List of checkboxes
     
    764764            int rows = (int) Math.ceil(checks.size()/cols.doubleValue());
    765765            JPanel panel = new JPanel(new GridLayout(rows, cols));
    766            
     766
    767767            for (Check check : checks) {
    768768                check.addToPanel(panel, sel);
    769769            }
    770            
     770
    771771            p.add(panel, GBC.eol());
    772772            return false;
     
    990990
    991991            String[] value_array = null;
    992            
     992
    993993            if (values_from != null) {
    994994                String[] class_method = values_from.split("#");
     
    998998                        // Check method is public static String[] methodName()
    999999                        int mod = method.getModifiers();
    1000                         if (Modifier.isPublic(mod) && Modifier.isStatic(mod) 
     1000                        if (Modifier.isPublic(mod) && Modifier.isStatic(mod)
    10011001                                && method.getReturnType().equals(String[].class) && method.getParameterTypes().length == 0) {
    10021002                            value_array = (String[]) method.invoke(null);
     
    10111011                }
    10121012            }
    1013            
     1013
    10141014            if (value_array == null) {
    10151015                value_array = splitEscaped(delChar, values);
     
    11061106        }
    11071107
    1108         private static ListCellRenderer RENDERER = new ListCellRenderer() {
     1108        private static final ListCellRenderer RENDERER = new ListCellRenderer() {
    11091109
    11101110            JLabel lbl = new JLabel();
     
    13681368        return result;
    13691369    }
    1370    
     1370
    13711371    static String fixPresetString(String s) {
    13721372        return s == null ? s : s.replaceAll("'","''");
    13731373    }
    1374    
     1374
    13751375    /**
    13761376     * allow escaped comma in comma separated list:
     
    14061406    }
    14071407
    1408    
     1408
    14091409    static Usage determineTextUsage(Collection<OsmPrimitive> sel, String key) {
    14101410        Usage returnValue = new Usage();
  • trunk/src/org/openstreetmap/josm/gui/widgets/TextContextualPopupMenu.java

    r6172 r6792  
    3939    protected JTextComponent component = null;
    4040    protected UndoAction undoAction = null;
    41    
     41
    4242    protected final PropertyChangeListener propertyChangeListener = new PropertyChangeListener() {
    4343        @Override public void propertyChange(PropertyChangeEvent evt) {
     
    4848        }
    4949    };
    50    
     50
    5151    /**
    5252     * Creates a new {@link TextContextualPopupMenu}.
     
    7474        return this;
    7575    }
    76    
     76
    7777    private void addMenuEntries() {
    7878        if (component.isEditable()) {
     
    8989        addMenuEntry(component, tr("Select All"), DefaultEditorKit.selectAllAction, null);
    9090    }
    91    
     91
    9292    /**
    9393     * Detaches this contextual menu from its text component.
     
    107107        return this;
    108108    }
    109    
     109
    110110    /**
    111111     * Creates a new {@link TextContextualPopupMenu} and enables it for the given text component.
    112112     * @param component The component that will display the menu and handle its actions.
    113      * @return The {@link PopupMenuLauncher} responsible of displaying the popup menu. 
     113     * @return The {@link PopupMenuLauncher} responsible of displaying the popup menu.
    114114     *         Call {@link #disableMenuFor} with this object if you want to disable the menu later.
    115115     * @see #disableMenuFor(JTextComponent, PopupMenuLauncher)
     
    122122
    123123    /**
    124      * Disables the {@link TextContextualPopupMenu} attached to the given popup menu launcher and text component. 
     124     * Disables the {@link TextContextualPopupMenu} attached to the given popup menu launcher and text component.
    125125     * @param component The component that currently displays the menu and handles its actions.
    126126     * @param launcher The {@link PopupMenuLauncher} obtained via {@link #enableMenuFor}.
     
    156156        }
    157157    }
    158    
    159     protected class UndoAction extends AbstractAction implements UndoableEditListener {
    160        
     158
     159    protected static class UndoAction extends AbstractAction implements UndoableEditListener {
     160
    161161        private final UndoManager undoManager = new UndoManager();
    162        
     162
    163163        public UndoAction() {
    164164            super(tr("Undo"));
  • trunk/src/org/openstreetmap/josm/io/MultiFetchServerObjectReader.java

    r6643 r6792  
    6363     * <a href="http://www.boutell.com/newfaq/misc/urllength.html">WWW FAQ</a>.
    6464     */
    65     static private int MAX_IDS_PER_REQUEST = 200;
     65    private static final int MAX_IDS_PER_REQUEST = 200;
    6666
    6767    private Set<Long> nodes;
  • trunk/src/org/openstreetmap/josm/io/OsmApi.java

    r6642 r6792  
    172172            host = (new URL(serverUrl)).getHost();
    173173        } catch (MalformedURLException e) {
     174            Main.warn(e);
    174175        }
    175176        return host;
  • trunk/src/org/openstreetmap/josm/io/OsmServerChangesetReader.java

    r6552 r6792  
    6363                return null;
    6464            monitor.indeterminateSubTask(tr("Downloading changesets ..."));
    65             List<Changeset> changesets = OsmChangesetParser.parse(in, monitor.createSubTaskMonitor(1, true));
    66             return changesets;
     65            return OsmChangesetParser.parse(in, monitor.createSubTaskMonitor(1, true));
    6766        } catch(OsmTransferException e) {
    6867            throw e;
     
    182181            monitor.setCustomText(tr("Downloading content for changeset {0} ...", id));
    183182            OsmChangesetContentParser parser = new OsmChangesetContentParser(in);
    184             ChangesetDataSet ds = parser.parse(monitor.createSubTaskMonitor(1, true));
    185             return ds;
     183            return parser.parse(monitor.createSubTaskMonitor(1, true));
    186184        } catch(OsmDataParsingException e) {
    187185            throw new OsmTransferException(e);
  • trunk/src/org/openstreetmap/josm/io/OsmServerHistoryReader.java

    r5874 r6792  
    6969            progressMonitor.indeterminateSubTask(tr("Downloading history..."));
    7070            final OsmHistoryReader reader = new OsmHistoryReader(in);
    71             HistoryDataSet data = reader.parse(progressMonitor.createSubTaskMonitor(1, true));
    72             return data;
     71            return reader.parse(progressMonitor.createSubTaskMonitor(1, true));
    7372        } catch(OsmTransferException e) {
    7473            throw e;
  • trunk/src/org/openstreetmap/josm/io/OsmServerObjectReader.java

    r6362 r6792  
    132132            if (in == null)
    133133                return null;
    134             final DataSet data = OsmReader.parseDataSet(in, progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false));
    135             return data;
     134            return OsmReader.parseDataSet(in, progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false));
    136135        } catch(OsmTransferException e) {
    137136            if (cancel) return null;
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/RequestProcessor.java

    r6643 r6792  
    105105    private static void addRequestHandlerClass(String command,
    106106                Class<? extends RequestHandler> handler, boolean silent) {
    107         if(command.charAt(0) == '/')
    108         {
     107        if(command.charAt(0) == '/') {
    109108            command = command.substring(1);
    110109        }
     
    246245                sendError(out);
    247246            } catch (IOException e1) {
     247                Main.warn(e1);
    248248            }
    249249        } finally {
     
    363363            out.write("\r\n");
    364364    }
    365    
     365
    366366    public static String getHandlersInfoAsJSON() {
    367367        StringBuilder r = new StringBuilder();
    368368        boolean first = true;
    369369        r.append("[");
    370        
     370
    371371        for (Entry<String, Class<? extends RequestHandler>> p : handlers.entrySet()) {
    372372            if (first) {
     
    424424            }
    425425        }
    426        
     426
    427427        r.append("], \"examples\" : [");
    428428        String[] examples = handler.getUsageExamples(cmd.substring(1));
     
    444444                w.close();
    445445            } catch (IOException ex) {
     446                Main.warn(ex);
    446447            }
    447448        }
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandler.java

    r6674 r6792  
    1919import org.openstreetmap.josm.data.osm.BBox;
    2020import org.openstreetmap.josm.data.osm.DataSet;
    21 import org.openstreetmap.josm.data.osm.Node;
    2221import org.openstreetmap.josm.data.osm.OsmPrimitive;
    2322import org.openstreetmap.josm.data.osm.Relation;
    2423import org.openstreetmap.josm.data.osm.SimplePrimitiveId;
    25 import org.openstreetmap.josm.data.osm.Way;
    2624import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
    2725import org.openstreetmap.josm.gui.util.GuiHelper;
     
    3533 */
    3634public class LoadAndZoomHandler extends RequestHandler {
    37    
     35
    3836    /**
    3937     * The remote control command name used to load data and zoom.
     
    5351
    5452    // Optional argument 'select'
    55     private final HashSet<SimplePrimitiveId> toSelect = new HashSet<SimplePrimitiveId>();
     53    private final Set<SimplePrimitiveId> toSelect = new HashSet<SimplePrimitiveId>();
    5654
    5755    @Override
     
    8482        return getUsageExamples(myCommand);
    8583    }
    86    
     84
    8785    @Override
    8886    public String[] getUsageExamples(String cmd) {
     
    163161                @Override
    164162                public void run() {
    165                     HashSet<OsmPrimitive> newSel = new HashSet<OsmPrimitive>();
     163                    Set<OsmPrimitive> newSel = new HashSet<OsmPrimitive>();
    166164                    DataSet ds = Main.main.getCurrentDataSet();
    167165                    if(ds == null) // e.g. download failed
     
    249247            throw new RequestHandlerBadRequestException("NumberFormatException ("+e.getMessage()+")");
    250248        }
    251        
     249
    252250        // Current API 0.6 check: "The latitudes must be between -90 and 90"
    253251        if (!LatLon.isValidLat(minlat) || !LatLon.isValidLat(maxlat)) {
  • trunk/src/org/openstreetmap/josm/io/session/ImagerySessionImporter.java

    r6070 r6792  
    88import java.util.Map;
    99
    10 import org.w3c.dom.Element;
    11 import org.w3c.dom.Node;
    12 import org.w3c.dom.NodeList;
    13 
    1410import org.openstreetmap.josm.data.Preferences;
    1511import org.openstreetmap.josm.data.imagery.ImageryInfo;
     
    2016import org.openstreetmap.josm.io.IllegalDataException;
    2117import org.openstreetmap.josm.io.session.SessionReader.ImportSupport;
     18import org.w3c.dom.Element;
     19import org.w3c.dom.Node;
     20import org.w3c.dom.NodeList;
    2221
    2322/**
     
    4544        ImageryPreferenceEntry prefEntry = Preferences.deserializeStruct(attributes, ImageryPreferenceEntry.class);
    4645        ImageryInfo i = new ImageryInfo(prefEntry);
    47         final ImageryLayer layer = ImageryLayer.create(i);
    48         return layer;
     46        return ImageryLayer.create(i);
    4947    }
    50 
    5148}
  • trunk/src/org/openstreetmap/josm/io/session/SessionReader.java

    r6747 r6792  
    185185                ZipEntry entry = zipFile.getEntry(inZipPath);
    186186                if (entry != null) {
    187                     InputStream is = zipFile.getInputStream(entry);
    188                     return is;
     187                    return zipFile.getInputStream(entry);
    189188                }
    190189            }
     
    311310                    LatLon centerLL = new LatLon(Double.parseDouble(centerEl.getAttribute("lat")), Double.parseDouble(centerEl.getAttribute("lon")));
    312311                    center = Projections.project(centerLL);
    313                 } catch (NumberFormatException ex) {}
     312                } catch (NumberFormatException ex) {
     313                    Main.warn(ex);
     314                }
    314315            }
    315316            if (center != null) {
     
    329330                        double scale = meterPerPixel / meterPerEasting; // unit: easting per pixel
    330331                        viewport = new ViewportData(center, scale);
    331                     } catch (NumberFormatException ex) {}
     332                    } catch (NumberFormatException ex) {
     333                        Main.warn(ex);
     334                    }
    332335                }
    333336            }
     
    344347            active = -1;
    345348        }
    346        
     349
    347350        MultiMap<Integer, Integer> deps = new MultiMap<Integer, Integer>();
    348351        Map<Integer, Element> elems = new HashMap<Integer, Element>();
     
    362365                    try {
    363366                        idx = Integer.parseInt(e.getAttribute("index"));
    364                     } catch (NumberFormatException ex) {}
     367                    } catch (NumberFormatException ex) {
     368                        Main.warn(ex);
     369                    }
    365370                    if (idx == null) {
    366371                        error(tr("unexpected format of attribute ''index'' for element ''layer''"));
     
    591596
    592597    private void loadSession(InputStream josIS, URI sessionFileURI, boolean zip, ProgressMonitor progressMonitor) throws IOException, IllegalDataException {
    593        
     598
    594599        this.sessionFileURI = sessionFileURI;
    595600        this.zip = zip;
    596        
     601
    597602        try {
    598603            DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
  • trunk/src/org/openstreetmap/josm/plugins/PluginInformation.java

    r6643 r6792  
    322322        if (className == null)
    323323            return null;
    324         try{
    325             Class<?> realClass = Class.forName(className, true, classLoader);
    326             return realClass;
     324        try {
     325            return Class.forName(className, true, classLoader);
    327326        } catch (ClassNotFoundException e) {
    328327            throw new PluginException(name, e);
     
    381380            File pluginFile = new File(s, pluginName + ".jar");
    382381            if (pluginFile.exists()) {
    383                 PluginInformation info = new PluginInformation(pluginFile);
    384                 return info;
     382                return new PluginInformation(pluginFile);
    385383            }
    386384        }
  • trunk/src/org/openstreetmap/josm/tools/SubclassFilteredCollection.java

    r6084 r6792  
    4747        }
    4848
     49        @SuppressWarnings("unchecked")
    4950        @Override
    5051        public T next() {
     
    5354            current = null;
    5455            // we are save because predicate only accepts objects of type T
    55             @SuppressWarnings("unchecked") T res = (T) old;
    56             return res;
     56            return (T) old;
    5757        }
    5858
  • trunk/src/org/openstreetmap/josm/tools/Utils.java

    r6772 r6792  
    294294        return null;
    295295    }
    296    
     296
    297297    /**
    298298     * Copies the given array. Unlike {@link Arrays#copyOf}, this method is null-safe.
     
    307307        return null;
    308308    }
    309    
     309
    310310    /**
    311311     * Simple file copy function that will overwrite the target file.<br/>
     
    386386        }
    387387    }
    388    
     388
    389389    /**
    390390     * Converts the given file to its URL.
     
    457457        try {
    458458            if (t != null && t.isDataFlavorSupported(DataFlavor.stringFlavor)) {
    459                 String text = (String) t.getTransferData(DataFlavor.stringFlavor);
    460                 return text;
     459                return (String) t.getTransferData(DataFlavor.stringFlavor);
    461460            }
    462461        } catch (UnsupportedFlavorException ex) {
     
    780779    /**
    781780     * Runs an external command and returns the standard output.
    782      * 
     781     *
    783782     * The program is expected to execute fast.
    784      * 
     783     *
    785784     * @param command the command with arguments
    786785     * @return the output
     
    945944        return result;
    946945    }
    947    
     946
    948947    /**
    949948     * Adds the given item at the end of a new copy of given array.
Note: See TracChangeset for help on using the changeset viewer.