Changeset 6295 in josm for trunk


Ignore:
Timestamp:
2013-10-04T01:20:31+02:00 (11 years ago)
Author:
Don-vip
Message:

Sonar/Findbugs - fix various problems, javadoc

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/tests/PowerLines.java

    r6241 r6295  
    128128    @Override
    129129    public Command fixError(TestError testError) {
    130         if (isFixable(testError)) {
     130        if (testError instanceof PowerLineError && isFixable(testError)) {
    131131            return new ChangePropertyCommand(
    132132                    testError.getPrimitives().iterator().next(),
  • trunk/src/org/openstreetmap/josm/gui/preferences/projection/CodeProjectionChoice.java

    r6246 r6295  
    213213
    214214    @Override
    215     public Collection<String> getPreferences(JPanel pnl) {
    216         CodeSelectionPanel csPanel = (CodeSelectionPanel) pnl;
     215    public Collection<String> getPreferences(JPanel panel) {
     216        if (!(panel instanceof CodeSelectionPanel)) {
     217            throw new IllegalArgumentException();
     218        }
     219        CodeSelectionPanel csPanel = (CodeSelectionPanel) panel;
    217220        return Collections.singleton(csPanel.getCode());
    218221    }
  • trunk/src/org/openstreetmap/josm/gui/preferences/projection/CustomProjectionChoice.java

    r6070 r6295  
    4242    private String pref;
    4343
     44    /**
     45     * Constructs a new {@code CustomProjectionChoice}.
     46     */
    4447    public CustomProjectionChoice() {
    4548        super(tr("Custom Projection"), "core:custom");
     
    156159    public static class ParameterInfoDialog extends ExtendedDialog {
    157160
     161        /**
     162         * Constructs a new {@code ParameterInfoDialog}.
     163         */
    158164        public ParameterInfoDialog() {
    159165            super(null, tr("Parameter information"), new String[] { tr("Close") }, false);
     
    225231    @Override
    226232    public Collection<String> getPreferences(JPanel panel) {
     233        if (!(panel instanceof PreferencePanel)) {
     234            throw new IllegalArgumentException();
     235        }
    227236        PreferencePanel prefPanel = (PreferencePanel) panel;
    228237        String pref = prefPanel.input.getText();
  • trunk/src/org/openstreetmap/josm/gui/preferences/projection/GaussKruegerProjectionChoice.java

    r6070 r6295  
    1111    private static String[] zones = { "2", "3", "4", "5" };
    1212
     13    /**
     14     * Constructs a new {@code GaussKruegerProjectionChoice}.
     15     */
    1316    public GaussKruegerProjectionChoice() {
    1417        super(tr("Gau\u00DF-Kr\u00FCger"), "core:gauss-krueger", zones, tr("GK Zone"));
  • trunk/src/org/openstreetmap/josm/gui/preferences/projection/LambertCC9ZonesProjectionChoice.java

    r6070 r6295  
    2828    };
    2929
     30    /**
     31     * Constructs a new {@code LambertCC9ZonesProjectionChoice}.
     32     */
    3033    public LambertCC9ZonesProjectionChoice() {
    3134        super(tr("Lambert CC9 Zone (France)"), "core:lambertcc9", lambert9zones, tr("Lambert CC Zone"));
  • trunk/src/org/openstreetmap/josm/gui/preferences/projection/ListProjectionChoice.java

    r6222 r6295  
    105105    @Override
    106106    public Collection<String> getPreferences(JPanel panel) {
     107        if (!(panel instanceof CBPanel)) {
     108            throw new IllegalArgumentException();
     109        }
    107110        CBPanel p = (CBPanel) panel;
    108111        int index = p.prefcb.getSelectedIndex();
  • trunk/src/org/openstreetmap/josm/gui/preferences/projection/SwissGridProjectionChoice.java

    r5548 r6295  
    1515public class SwissGridProjectionChoice extends SingleProjectionChoice {
    1616
     17    /**
     18     * Constructs a new {@code SwissGridProjectionChoice}.
     19     */
    1720    public SwissGridProjectionChoice() {
    1821        super(tr("Swiss Grid (Switzerland)"), "core:swissgrid", "EPSG:21781");
  • trunk/src/org/openstreetmap/josm/gui/preferences/projection/UTMProjectionChoice.java

    r6083 r6295  
    3333    }
    3434
     35    /**
     36     * Constructs a new {@code UTMProjectionChoice}.
     37     */
    3538    public UTMProjectionChoice() {
    3639        super(tr("UTM"), "core:utm", cbEntries.toArray(), tr("UTM Zone"));
     
    9699    @Override
    97100    public Collection<String> getPreferences(JPanel panel) {
     101        if (!(panel instanceof UTMPanel)) {
     102            throw new IllegalArgumentException();
     103        }
    98104        UTMPanel p = (UTMPanel) panel;
    99105        int index = p.prefcb.getSelectedIndex();
     
    133139        Hemisphere hemisphere = DEFAULT_HEMISPHERE;
    134140
    135         if(args != null) {
     141        if (args != null) {
    136142            String[] array = args.toArray(new String[args.size()]);
    137143
     
    155161        return defaultIndex;
    156162    }
    157 
    158163}
  • trunk/src/org/openstreetmap/josm/tools/Diff.java

    r6246 r6295  
    9595      an edit script, if desired.
    9696     */
    97     public Diff(Object[] a,Object[] b) {
     97    public Diff(Object[] a, Object[] b) {
    9898        Map<Object,Integer> h = new HashMap<Object,Integer>(a.length + b.length);
    9999        filevec = new FileData[] { new FileData(a,h),new FileData(b,h) };
     
    825825        }
    826826
    827         FileData(int[] data) {
    828             buffered_lines = data.length;
    829             equivs = data;
     827        FileData(int length) {
     828            buffered_lines = length;
     829            equivs = new int[length];
    830830            undiscarded = new int[buffered_lines];
    831831            realindexes = new int[buffered_lines];
    832832        }
    833833       
    834         FileData(Object[] data,Map<Object,Integer> h) {
    835             this(new int[data.length]);
     834        FileData(Object[] data, Map<Object,Integer> h) {
     835            this(data.length);
    836836            // FIXME: diff 2.7 removes common prefix and common suffix
    837837            for (int i = 0; i < data.length; ++i) {
Note: See TracChangeset for help on using the changeset viewer.