Changeset 10217 in josm for trunk/src


Ignore:
Timestamp:
2016-05-15T16:37:33+02:00 (8 years ago)
Author:
Don-vip
Message:

findbugs - SF_SWITCH_NO_DEFAULT + various sonar fixes

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/JosmUserIdentityManager.java

    r10212 r10217  
    278278            }
    279279            return;
    280 
    281280        case "osm-server.url":
    282281            String newUrl = null;
     
    290289            }
    291290            break;
    292 
    293291        case "oauth.access-token.key":
    294292            accessTokenKeyChanged = true;
    295293            break;
    296 
    297294        case "oauth.access-token.secret":
    298295            accessTokenSecretChanged = true;
    299296            break;
     297        default: // Do nothing
    300298        }
    301299
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r10212 r10217  
    255255        int c;
    256256        while ((c = g.getopt()) != -1) {
    257             Option opt = null;
     257            Option opt;
    258258            switch (c) {
    259259                case 'h':
     
    266266                    opt = Option.values()[g.getLongind()];
    267267                    break;
     268                default:
     269                    opt = null;
    268270            }
    269271            if (opt != null) {
  • trunk/src/org/openstreetmap/josm/gui/MapMover.java

    r10152 r10217  
    9292                    nc.zoomTo(new EastNorth(center.east(), newcenter.north()));
    9393                    break;
     94                default: // Do nothing
    9495                }
    9596            }
  • trunk/src/org/openstreetmap/josm/gui/ScrollViewport.java

    r9078 r10217  
    167167            deltaX *= -1;
    168168            break;
     169        default: // Do nothing
    169170        }
    170171
  • trunk/src/org/openstreetmap/josm/gui/bbox/SlippyMapControler.java

    r10152 r10217  
    265265                }
    266266                break;
     267            default:
     268                throw new IllegalStateException(Integer.toString(directionX));
    267269            }
    268270
     
    288290                }
    289291                break;
     292            default:
     293                throw new IllegalStateException(Integer.toString(directionY));
    290294            }
    291295
  • trunk/src/org/openstreetmap/josm/gui/conflict/tags/PasteTagsConflictResolverDialog.java

    r10179 r10217  
    325325    }
    326326
     327    /**
     328     * Returns conflict resolution.
     329     * @return conflict resolution
     330     */
    327331    public TagCollection getResolution() {
    328332        return allPrimitivesResolver.getModel().getResolution();
     
    351355
    352356    static final class StatisticsInfo {
    353         public int numTags;
    354         public final Map<OsmPrimitiveType, Integer> sourceInfo;
    355         public final Map<OsmPrimitiveType, Integer> targetInfo;
     357        int numTags;
     358        final Map<OsmPrimitiveType, Integer> sourceInfo;
     359        final Map<OsmPrimitiveType, Integer> targetInfo;
    356360
    357361        StatisticsInfo() {
     
    385389        }
    386390
    387         public void reset() {
     391        void reset() {
    388392            data.clear();
    389393        }
    390394
    391         public void append(StatisticsInfo info) {
     395        void append(StatisticsInfo info) {
    392396            data.add(info);
    393397            fireTableDataChanged();
     
    396400
    397401    static final class StatisticsInfoRenderer extends JLabel implements TableCellRenderer {
    398         protected void reset() {
     402        private void reset() {
    399403            setIcon(null);
    400404            setText("");
     
    402406        }
    403407
    404         protected void renderNumTags(StatisticsInfo info) {
     408        private void renderNumTags(StatisticsInfo info) {
    405409            if (info == null) return;
    406410            setText(trn("{0} tag", "{0} tags", info.numTags, info.numTags));
    407411        }
    408412
    409         protected void renderStatistics(Map<OsmPrimitiveType, Integer> stat) {
     413        private void renderStatistics(Map<OsmPrimitiveType, Integer> stat) {
    410414            if (stat == null) return;
    411415            if (stat.isEmpty()) return;
     
    422426                    continue;
    423427                }
    424                 String msg = "";
     428                String msg;
    425429                switch(type) {
    426430                case NODE: msg = trn("{0} node", "{0} nodes", numPrimitives, numPrimitives); break;
    427431                case WAY: msg = trn("{0} way", "{0} ways", numPrimitives, numPrimitives); break;
    428432                case RELATION: msg = trn("{0} relation", "{0} relations", numPrimitives, numPrimitives); break;
     433                default: throw new AssertionError();
    429434                }
    430435                if (text.length() > 0) {
     
    436441        }
    437442
    438         protected void renderFrom(StatisticsInfo info) {
     443        private void renderFrom(StatisticsInfo info) {
    439444            renderStatistics(info.sourceInfo);
    440445        }
    441446
    442         protected void renderTo(StatisticsInfo info) {
     447        private void renderTo(StatisticsInfo info) {
    443448            renderStatistics(info.targetInfo);
    444449        }
     
    461466                case 1: renderFrom(info); break;
    462467                case 2: renderTo(info); break;
     468                default: // Do nothing
    463469                }
    464470            }
  • trunk/src/org/openstreetmap/josm/gui/conflict/tags/RelationMemberConflictResolverModel.java

    r9192 r10217  
    132132            refresh();
    133133            break;
     134        default: // Do nothing
    134135        }
    135136        fireTableDataChanged();
  • trunk/src/org/openstreetmap/josm/gui/conflict/tags/TagConflictResolverModel.java

    r9078 r10217  
    181181                decision.sumAllNumeric();
    182182                break;
     183            default: // Do nothing
    183184            }
    184185        }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/FilterTableModel.java

    r9348 r10217  
    315315            updateFilters();
    316316            break;
     317        default: // Do nothing
    317318        }
    318319        if (column != 0) {
     
    346347            case in_selection: /* filter mode: in selection */
    347348                return trc("filter", "F");
    348             }
     349            default:
     350                Main.warn("Unknown filter mode: " + f.mode);
     351            }
     352            break;
     353        default: // Do nothing
    349354        }
    350355        return null;
     
    406411    }
    407412
     413    /**
     414     * Returns the list of filters.
     415     * @return the list of filters
     416     */
    408417    public List<Filter> getFilters() {
    409418        return filters;
  • trunk/src/org/openstreetmap/josm/gui/dialogs/SelectionListDialog.java

    r9376 r10217  
    512512                case WAY: numWays++; break;
    513513                case RELATION: numRelations++; break;
     514                default: throw new AssertionError();
    514515                }
    515516            }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetCacheTableCellRenderer.java

    r8510 r10217  
    6060        case 5: /* closed at */ renderDate(cs.getClosedAt()); break;
    6161        case 6: /* discussions */ renderDiscussions(cs); break;
     62        default: // Do nothing
    6263        }
    6364        return this;
  • trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetDiscussionTableCellRenderer.java

    r8510 r10217  
    3838            reset(comp, false);
    3939            renderColors(comp, isSelected);
     40            break;
     41        default: // Do nothing
    4042        }
    4143        return comp;
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java

    r10132 r10217  
    10901090            switch (PROPERTY_REFRESH_RECENT.get()) {
    10911091                case REFRESH: cacheRecentTags(); // break missing intentionally
    1092                 case STATUS: suggestRecentlyAddedTags();
     1092                case STATUS: suggestRecentlyAddedTags(); break;
     1093                default: // Do nothing
    10931094            }
    10941095        }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java

    r10113 r10217  
    820820                memberTableModel.removeMembersReferringTo(toCheck);
    821821                break;
     822            default: // Do nothing
    822823            }
    823824        }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableLinkedCellRenderer.java

    r9223 r10217  
    157157
    158158        /* special icons */
    159         Image arrow = null;
     159        Image arrow;
    160160        switch (value.direction) {
    161161        case FORWARD:
     
    165165            arrow = arrowUp;
    166166            break;
     167        default:
     168            arrow = null;
    167169        }
    168170        if (value.direction == Direction.ROUNDABOUT_LEFT) {
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/sort/WayConnectionTypeCalculator.java

    r10001 r10217  
    266266            refNodes = wayRef.getNodes();
    267267            break;
     268        default: // Do nothing
    268269        }
    269270
  • trunk/src/org/openstreetmap/josm/gui/download/PlaceSelection.java

    r10212 r10217  
    582582                }
    583583                break;
     584            default: // Do nothing
    584585            }
    585586            setToolTipText(lineWrapDescription(sr.description));
  • trunk/src/org/openstreetmap/josm/gui/history/TagTableCellRenderer.java

    r9450 r10217  
    6767            setBackgroundReadable(key, model, isSelected, true);
    6868            break;
     69        default: // Do nothing
    6970        }
    7071
  • trunk/src/org/openstreetmap/josm/gui/io/AbstractUploadTask.java

    r9917 r10217  
    3838
    3939public abstract class AbstractUploadTask extends PleaseWaitRunnable {
     40
     41    /**
     42     * Constructs a new {@code AbstractUploadTask}.
     43     * @param title message for the user
     44     * @param ignoreException If true, exception will be silently ignored. If false then
     45     * exception will be handled by showing a dialog. When this runnable is executed using executor framework
     46     * then use false unless you read result of task (because exception will get lost if you don't)
     47     */
    4048    public AbstractUploadTask(String title, boolean ignoreException) {
    4149        super(title, ignoreException);
    4250    }
    4351
     52    /**
     53     * Constructs a new {@code AbstractUploadTask}.
     54     * @param title message for the user
     55     * @param progressMonitor progress monitor
     56     * @param ignoreException If true, exception will be silently ignored. If false then
     57     * exception will be handled by showing a dialog. When this runnable is executed using executor framework
     58     * then use false unless you read result of task (because exception will get lost if you don't)
     59     */
    4460    public AbstractUploadTask(String title, ProgressMonitor progressMonitor, boolean ignoreException) {
    4561        super(title, progressMonitor, ignoreException);
    4662    }
    4763
     64    /**
     65     * Constructs a new {@code AbstractUploadTask}.
     66     * @param title message for the user
     67     */
    4868    public AbstractUploadTask(String title) {
    4969        super(title);
     
    93113    protected void handleUploadConflictForKnownConflict(final OsmPrimitiveType primitiveType, final long id, String serverVersion,
    94114            String myVersion) {
    95         String lbl = "";
     115        String lbl;
    96116        switch(primitiveType) {
    97117        case NODE: lbl =  tr("Synchronize node {0} only", id); break;
    98118        case WAY: lbl =  tr("Synchronize way {0} only", id); break;
    99119        case RELATION: lbl =  tr("Synchronize relation {0} only", id); break;
     120        default: throw new AssertionError();
    100121        }
    101122        ButtonSpec[] spec = new ButtonSpec[] {
  • trunk/src/org/openstreetmap/josm/gui/io/ChangesetManagementPanel.java

    r9514 r10217  
    4848 */
    4949public class ChangesetManagementPanel extends JPanel implements ListDataListener {
    50     public static final String SELECTED_CHANGESET_PROP = ChangesetManagementPanel.class.getName() + ".selectedChangeset";
    51     public static final String CLOSE_CHANGESET_AFTER_UPLOAD = ChangesetManagementPanel.class.getName() + ".closeChangesetAfterUpload";
     50    static final String SELECTED_CHANGESET_PROP = ChangesetManagementPanel.class.getName() + ".selectedChangeset";
     51    static final String CLOSE_CHANGESET_AFTER_UPLOAD = ChangesetManagementPanel.class.getName() + ".closeChangesetAfterUpload";
    5252
    5353    private JRadioButton rbUseNew;
     
    5656    private JCheckBox cbCloseAfterUpload;
    5757    private OpenChangesetComboBoxModel model;
    58     private final transient ChangesetCommentModel changesetCommentModel;
     58
     59    /**
     60     * Constructs a new {@code ChangesetManagementPanel}.
     61     *
     62     * @param changesetCommentModel the changeset comment model. Must not be null.
     63     * @throws IllegalArgumentException if {@code changesetCommentModel} is null
     64     */
     65    public ChangesetManagementPanel(ChangesetCommentModel changesetCommentModel) {
     66        CheckParameterUtil.ensureParameterNotNull(changesetCommentModel, "changesetCommentModel");
     67        build();
     68        refreshGUI();
     69    }
    5970
    6071    /**
     
    159170    }
    160171
    161     /**
    162      * Creates a new panel
    163      *
    164      * @param changesetCommentModel the changeset comment model. Must not be null.
    165      * @throws IllegalArgumentException if {@code changesetCommentModel} is null
    166      */
    167     public ChangesetManagementPanel(ChangesetCommentModel changesetCommentModel) {
    168         CheckParameterUtil.ensureParameterNotNull(changesetCommentModel, "changesetCommentModel");
    169         this.changesetCommentModel = changesetCommentModel;
    170         build();
    171         refreshGUI();
    172     }
    173 
    174172    protected void refreshGUI() {
    175173        rbExisting.setEnabled(model.getSize() > 0);
    176         if (model.getSize() == 0) {
    177             if (!rbUseNew.isSelected()) {
    178                 rbUseNew.setSelected(true);
    179             }
     174        if (model.getSize() == 0 && !rbUseNew.isSelected()) {
     175            rbUseNew.setSelected(true);
    180176        }
    181177        cbOpenChangesets.setEnabled(model.getSize() > 0 && rbExisting.isSelected());
     
    235231
    236232    /**
    237      * Listens to changes in the selected changeset and fires property
    238      * change events.
    239      *
     233     * Listens to changes in the selected changeset and fires property change events.
    240234     */
    241235    class ChangesetListItemStateListener implements ItemListener {
     
    251245
    252246    /**
    253      * Listens to changes in "close after upload" flag and fires
    254      * property change events.
    255      *
     247     * Listens to changes in "close after upload" flag and fires property change events.
    256248     */
    257249    class CloseAfterUploadItemStateListener implements ItemListener {
     
    269261                Main.pref.put("upload.changeset.close", false);
    270262                break;
     263            default: // Do nothing
    271264            }
    272265        }
     
    275268    /**
    276269     * Listens to changes in the two radio buttons rbUseNew and rbUseExisting.
    277      *
    278270     */
    279271    class RadioButtonHandler implements ItemListener {
  • trunk/src/org/openstreetmap/josm/gui/io/SaveLayersModel.java

    r9751 r10217  
    116116            info.setDoSaveToFile(values[1]);
    117117            break;
     118        default: // Do nothing
    118119        }
    119120        fireTableDataChanged();
  • trunk/src/org/openstreetmap/josm/gui/io/UploadStrategySelectionPanel.java

    r10179 r10217  
    255255    public UploadStrategySpecification getUploadStrategySpecification() {
    256256        UploadStrategy strategy = getUploadStrategy();
    257         int chunkSize = getChunkSize();
    258257        UploadStrategySpecification spec = new UploadStrategySpecification();
    259258        if (strategy != null) {
    260259            switch(strategy) {
     260            case CHUNKED_DATASET_STRATEGY:
     261                spec.setStrategy(strategy).setChunkSize(getChunkSize());
     262                break;
    261263            case INDIVIDUAL_OBJECTS_STRATEGY:
    262264            case SINGLE_REQUEST_STRATEGY:
     265            default:
    263266                spec.setStrategy(strategy);
    264                 break;
    265             case CHUNKED_DATASET_STRATEGY:
    266                 spec.setStrategy(strategy).setChunkSize(chunkSize);
    267267                break;
    268268            }
  • trunk/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java

    r10212 r10217  
    358358                        }
    359359                        break;
     360                    default: // Do nothing
    360361                    }
    361362                    if (!noDraw && (maxLineLength == -1 || dist <= maxLineLength)) {
  • trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/BoxTextElement.java

    r9371 r10217  
    120120    public static BoxTextElement create(Environment env, BoxProvider boxProvider, Rectangle box) {
    121121        initDefaultParameters();
    122         Cascade c = env.mc.getCascade(env.layer);
    123122
    124123        TextLabel text = TextLabel.create(env, DEFAULT_TEXT_COLOR, false);
     
    129128        if (text.labelCompositionStrategy.compose(env.osm) == null) return null;
    130129
    131         HorizontalTextAlignment hAlign = HorizontalTextAlignment.RIGHT;
    132         Keyword hAlignKW = c.get(TEXT_ANCHOR_HORIZONTAL, Keyword.RIGHT, Keyword.class);
    133         switch (hAlignKW.val) {
     130        Cascade c = env.mc.getCascade(env.layer);
     131
     132        HorizontalTextAlignment hAlign;
     133        switch (c.get(TEXT_ANCHOR_HORIZONTAL, Keyword.RIGHT, Keyword.class).val) {
    134134            case "left":
    135135                hAlign = HorizontalTextAlignment.LEFT;
     
    137137            case "center":
    138138                hAlign = HorizontalTextAlignment.CENTER;
    139         }
    140         VerticalTextAlignment vAlign = VerticalTextAlignment.BOTTOM;
    141         Keyword vAlignKW = c.get(TEXT_ANCHOR_VERTICAL, Keyword.BOTTOM, Keyword.class);
    142         switch (vAlignKW.val) {
    143             case "bottom":
    144                 vAlign = VerticalTextAlignment.BOTTOM;
    145                 break;
     139                break;
     140            case "right":
     141            default:
     142                hAlign = HorizontalTextAlignment.RIGHT;
     143        }
     144        VerticalTextAlignment vAlign;
     145        switch (c.get(TEXT_ANCHOR_VERTICAL, Keyword.BOTTOM, Keyword.class).val) {
    146146            case "above":
    147147                vAlign = VerticalTextAlignment.ABOVE;
     
    155155            case "below":
    156156                vAlign = VerticalTextAlignment.BELOW;
     157                break;
     158            case "bottom":
     159            default:
     160                vAlign = VerticalTextAlignment.BOTTOM;
    157161        }
    158162
  • trunk/src/org/openstreetmap/josm/gui/oauth/AdvancedOAuthPropertiesPanel.java

    r10183 r10217  
    5555    private String apiUrl;
    5656
     57    /**
     58     * Constructs a new {@code AdvancedOAuthPropertiesPanel}.
     59     */
     60    public AdvancedOAuthPropertiesPanel() {
     61        build();
     62    }
     63
    5764    protected final void build() {
    5865        setLayout(new GridBagLayout());
     
    111118        SelectAllOnFocusGainedDecorator.decorate(tfAccessTokenURL);
    112119
    113 
    114120        // -- authorise URL
    115121        gc.gridy = 5;
     
    123129        SelectAllOnFocusGainedDecorator.decorate(tfAuthoriseURL);
    124130
    125 
    126131        // -- OSM login URL
    127132        gc.gridy = 6;
     
    134139        add(tfOsmLoginURL, gc);
    135140        SelectAllOnFocusGainedDecorator.decorate(tfOsmLoginURL);
    136 
    137141
    138142        // -- OSM logout URL
     
    250254
    251255    /**
    252      * Constructs a new {@code AdvancedOAuthPropertiesPanel}.
    253      */
    254     public AdvancedOAuthPropertiesPanel() {
    255         build();
    256     }
    257 
    258     /**
    259256     * Initializes the panel from the values in the preferences <code>preferences</code>.
    260257     *
     
    308305                setChildComponentsEnabled(true);
    309306                break;
     307            default: // Do nothing
    310308            }
    311309        }
  • trunk/src/org/openstreetmap/josm/gui/preferences/display/GPXSettingsPanel.java

    r10043 r10217  
    357357            colorDynamic.setEnabled(false);
    358358        } else {
    359             switch(Main.pref.getInteger("draw.rawgps.colors", layerName, 0)) {
     359            int colorType = Main.pref.getInteger("draw.rawgps.colors", layerName, 0);
     360            switch (colorType) {
    360361            case 0: colorTypeNone.setSelected(true);   break;
    361362            case 1: colorTypeVelocity.setSelected(true);  break;
     
    363364            case 3: colorTypeDirection.setSelected(true); break;
    364365            case 4: colorTypeTime.setSelected(true);  break;
     366            default: Main.warn("Unknown color type: " + colorType);
    365367            }
    366368            int ccts = Main.pref.getInteger("draw.rawgps.colorTracksTune", layerName, 45);
  • trunk/src/org/openstreetmap/josm/gui/preferences/server/OsmApiUrlInputPanel.java

    r10212 r10217  
    144144        String oldUrl = OsmApi.getOsmApi().getServerUrl();
    145145        String hmiUrl = getStrippedApiUrl();
    146         if (cbUseDefaultServerUrl.isSelected()) {
    147             Main.pref.put("osm-server.url", null);
    148         } else if (OsmApi.DEFAULT_API_URL.equals(hmiUrl)) {
     146        if (cbUseDefaultServerUrl.isSelected() || OsmApi.DEFAULT_API_URL.equals(hmiUrl)) {
    149147            Main.pref.put("osm-server.url", null);
    150148        } else {
     
    300298                propagator.propagate();
    301299                break;
     300            default: // Do nothing
    302301            }
    303302        }
  • trunk/src/org/openstreetmap/josm/gui/tagging/TagEditorModel.java

    r9816 r10217  
    8080    }
    8181
     82    /**
     83     * Adds property change listener.
     84     * @param listener property change listener to add
     85     */
    8286    public void addPropertyChangeListener(PropertyChangeListener listener) {
    8387        propChangeSupport.addPropertyChangeListener(listener);
     
    102106    }
    103107
     108    /**
     109     * Removes property change listener.
     110     * @param listener property change listener to remove
     111     */
    104112    public void removePropertyChangeListener(PropertyChangeListener listener) {
    105113        propChangeSupport.removePropertyChangeListener(listener);
     
    146154            case 1:
    147155                String v = (String) value;
    148                 if (tag.getValueCount() > 1 && !v.isEmpty()) {
    149                     updateTagValue(tag, v);
    150                 } else if (tag.getValueCount() <= 1) {
     156                if ((tag.getValueCount() > 1 && !v.isEmpty()) || tag.getValueCount() <= 1) {
    151157                    updateTagValue(tag, v);
    152158                }
     159                break;
     160            default: // Do nothing
    153161            }
    154162        }
     
    653661        }
    654662
    655         public void apply() {
     663        void apply() {
    656664            rowSelectionModel.setValueIsAdjusting(true);
    657665            colSelectionModel.setValueIsAdjusting(true);
  • trunk/src/org/openstreetmap/josm/gui/tagging/TagTable.java

    r10082 r10217  
    210210                deleteTags();
    211211                break;
     212            default: // Do nothing
    212213            }
    213214
    214215            if (isEditing()) {
    215                 CellEditor editor = getCellEditor();
    216                 if (editor != null) {
    217                     editor.cancelCellEditing();
     216                CellEditor cEditor = getCellEditor();
     217                if (cEditor != null) {
     218                    cEditor.cancelCellEditing();
    218219                }
    219220            }
     
    260261        @Override
    261262        public void actionPerformed(ActionEvent e) {
    262             CellEditor editor = getCellEditor();
    263             if (editor != null) {
    264                 getCellEditor().stopCellEditing();
     263            CellEditor cEditor = getCellEditor();
     264            if (cEditor != null) {
     265                cEditor.stopCellEditing();
    265266            }
    266267            final int rowIdx = model.getRowCount()-1;
     
    599600                    return;
    600601                else if (c instanceof Window) {
    601                     if (c == SwingUtilities.getRoot(TagTable.this)) {
    602                         if (!getCellEditor().stopCellEditing()) {
    603                             getCellEditor().cancelCellEditing();
    604                         }
     602                    if (c == SwingUtilities.getRoot(TagTable.this) && !getCellEditor().stopCellEditing()) {
     603                        getCellEditor().cancelCellEditing();
    605604                    }
    606605                    break;
  • trunk/src/org/openstreetmap/josm/gui/util/AdjustmentSynchronizer.java

    r10210 r10217  
    139139                    }
    140140                    break;
     141                default: // Do nothing
    141142                }
    142143            }
  • trunk/src/org/openstreetmap/josm/gui/widgets/SearchTextResultListPanel.java

    r9390 r10217  
    3333    protected abstract void filterItems();
    3434
     35    /**
     36     * Constructs a new {@code SearchTextResultListPanel}.
     37     */
    3538    public SearchTextResultListPanel() {
    3639        super(new BorderLayout());
     
    7578                        selectItem(lsResultModel.getSize());
    7679                        break;
     80                    default: // Do nothing
    7781                }
    7882            }
  • trunk/src/org/openstreetmap/josm/io/MultiFetchServerObjectReader.java

    r10216 r10217  
    311311     */
    312312    protected void fetchPrimitives(Set<Long> ids, OsmPrimitiveType type, ProgressMonitor progressMonitor) throws OsmTransferException {
    313         String msg = "";
     313        String msg;
    314314        final String baseUrl = getBaseUrl();
    315315        switch (type) {
     
    317317            case WAY:      msg = tr("Fetching a package of ways from ''{0}''",      baseUrl); break;
    318318            case RELATION: msg = tr("Fetching a package of relations from ''{0}''", baseUrl); break;
     319            default: throw new AssertionError();
    319320        }
    320321        progressMonitor.setTicksCount(ids.size());
  • trunk/src/org/openstreetmap/josm/io/OsmServerWriter.java

    r10216 r10217  
    3939
    4040    private static volatile List<OsmServerWritePostprocessor> postprocessors;
     41
     42    /**
     43     * Registers a post-processor.
     44     * @param pp post-processor to register
     45     */
    4146    public static void registerPostprocessor(OsmServerWritePostprocessor pp) {
    4247        if (postprocessors == null) {
     
    4651    }
    4752
     53    /**
     54     * Unregisters a post-processor.
     55     * @param pp post-processor to unregister
     56     */
    4857    public static void unregisterPostprocessor(OsmServerWritePostprocessor pp) {
    4958        if (postprocessors != null) {
     
    6170    private long uploadStartTime;
    6271
    63     public String timeLeft(int progress, int listSize) {
     72    protected String timeLeft(int progress, int listSize) {
    6473        long now = System.currentTimeMillis();
    6574        long elapsed = now - uploadStartTime;
     
    93102            uploadStartTime = System.currentTimeMillis();
    94103            for (OsmPrimitive osm : primitives) {
    95                 int progress = progressMonitor.getTicks();
    96                 String timeLeftStr = timeLeft(progress, primitives.size());
    97                 String msg = "";
     104                String msg;
    98105                switch(OsmPrimitiveType.from(osm)) {
    99106                case NODE: msg = marktr("{0}% ({1}/{2}), {3} left. Uploading node ''{4}'' (id: {5})"); break;
    100107                case WAY: msg = marktr("{0}% ({1}/{2}), {3} left. Uploading way ''{4}'' (id: {5})"); break;
    101108                case RELATION: msg = marktr("{0}% ({1}/{2}), {3} left. Uploading relation ''{4}'' (id: {5})"); break;
     109                default: throw new AssertionError();
    102110                }
     111                int progress = progressMonitor.getTicks();
    103112                progressMonitor.subTask(
    104113                        tr(msg,
     
    106115                                progress,
    107116                                primitives.size(),
    108                                 timeLeftStr,
    109                                 osm.getName() == null ? osm.getId() : osm.getName(),
    110                                         osm.getId()));
     117                                timeLeft(progress, primitives.size()),
     118                                osm.getName() == null ? osm.getId() : osm.getName(), osm.getId()));
    111119                makeApiRequest(osm, progressMonitor);
    112120                processed.add(osm);
     
    134142            progressMonitor.beginTask(tr("Starting to upload in one request ..."));
    135143            processed.addAll(api.uploadDiff(primitives, progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false)));
    136         } catch (OsmTransferException e) {
    137             throw e;
    138144        } finally {
    139145            progressMonitor.finishTask();
     
    151157     */
    152158    protected void uploadChangesInChunks(Collection<? extends OsmPrimitive> primitives, ProgressMonitor progressMonitor, int chunkSize)
    153             throws OsmTransferException, IllegalArgumentException {
     159            throws OsmTransferException {
    154160        if (chunkSize <= 0)
    155161            throw new IllegalArgumentException(tr("Value >0 expected for parameter ''{0}'', got {1}", "chunkSize", chunkSize));
     
    176182                processed.addAll(api.uploadDiff(chunk, progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false)));
    177183            }
    178         } catch (OsmTransferException e) {
    179             throw e;
    180184        } finally {
    181185            progressMonitor.finishTask();
     
    223227                break;
    224228            }
    225         } catch (OsmTransferException e) {
    226             throw e;
    227229        } finally {
    228230            executePostprocessors(monitor);
     
    242244    }
    243245
     246    /**
     247     * Cancel operation.
     248     */
    244249    public void cancel() {
    245250        this.canceled = true;
  • trunk/src/org/openstreetmap/josm/io/imagery/ImageryReader.java

    r10216 r10217  
    5454    }
    5555
     56    /**
     57     * Constructs a {@code ImageryReader} from a given filename, URL or internal resource.
     58     *
     59     * @param source can be:<ul>
     60     *  <li>relative or absolute file name</li>
     61     *  <li>{@code file:///SOME/FILE} the same as above</li>
     62     *  <li>{@code http://...} a URL. It will be cached on disk.</li>
     63     *  <li>{@code resource://SOME/FILE} file from the classpath (usually in the current *.jar)</li>
     64     *  <li>{@code josmdir://SOME/FILE} file inside josm user data directory (since r7058)</li>
     65     *  <li>{@code josmplugindir://SOME/FILE} file inside josm plugin directory (since r7834)</li></ul>
     66     */
    5667    public ImageryReader(String source) {
    5768        this.source = source;
    5869    }
    5970
     71    /**
     72     * Parses imagery source.
     73     * @return list of imagery info
     74     * @throws SAXException if any SAX error occurs
     75     * @throws IOException if any I/O error occurs
     76     */
    6077    public List<ImageryInfo> parse() throws SAXException, IOException {
    6178        Parser parser = new Parser();
     
    328345                        }
    329346                        break;
     347                    default: // Do nothing
    330348                    }
    331349                }
     
    456474                projections = null;
    457475                break;
    458             /* nothing to do for these or the unknown type:
    459476            case NO_TILE:
    460477            case NO_TILESUM:
    461478            case METADATA:
    462479            case UNKNOWN:
    463                 break;
    464             */
     480            default:
     481                // nothing to do for these or the unknown type
    465482            }
    466483        }
Note: See TracChangeset for help on using the changeset viewer.