Changeset 18174 in josm


Ignore:
Timestamp:
2021-08-25T14:47:26+02:00 (3 years ago)
Author:
Don-vip
Message:

see #21240 - fix a few potential issues reported by Coverity

Location:
trunk/src/org/openstreetmap/josm/gui
Files:
3 edited

Legend:

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

    r18173 r18174  
    8585     */
    8686    private void saveHistory() {
    87         hcbSearchString.getModel().addTopElement(SearchSetting.fromString(hcbSearchString.getText()));
     87        model.addTopElement(SearchSetting.fromString(hcbSearchString.getText()));
    8888        prefs.save(OVERPASS_WIZARD_HISTORY);
    8989    }
     
    120120     */
    121121    private boolean buildQueryAction() {
    122         final String wizardSearchTerm = getSearchSettings().text;
    123 
    124         Optional<String> q = this.tryParseSearchTerm(wizardSearchTerm);
     122        Optional<String> q = tryParseSearchTerm(getSearchSettings().text);
    125123        q.ifPresent(callbacks::submitWizardResult);
    126124        return q.isPresent();
  • trunk/src/org/openstreetmap/josm/gui/io/BasicUploadSettingsPanel.java

    r18173 r18174  
    320320    private void updateHistory(JTextField text) {
    321321        String tag = (String) text.getDocument().getProperty("tag"); // tag is either "comment" or "source"
    322         if (tag.equals("comment")) {
     322        if ("comment".equals(tag)) {
    323323            hcbUploadComment.addCurrentItemToHistory();
    324         }
    325         if (tag.equals("source")) {
     324        } else if ("source".equals(tag)) {
    326325            hcbUploadSource.addCurrentItemToHistory();
    327326        }
     
    382381    @Override
    383382    public void actionPerformed(ActionEvent e) {
    384         getDialog().setFocusToUploadButton();
     383        setFocusToUploadButton();
    385384    }
    386385
     
    439438    public void keyTyped(KeyEvent e) {
    440439        if (e.getKeyChar() == KeyEvent.VK_ENTER) {
    441             getDialog().setFocusToUploadButton();
     440            setFocusToUploadButton();
    442441        }
    443442    }
     
    450449    public void keyReleased(KeyEvent e) {
    451450    }
     451
     452    private void setFocusToUploadButton() {
     453        Optional.ofNullable(getDialog()).ifPresent(UploadDialog::setFocusToUploadButton);
     454    }
    452455}
  • trunk/src/org/openstreetmap/josm/gui/io/ChangesetManagementPanel.java

    r18173 r18174  
    276276                Changeset cs = (Changeset) cbOpenChangesets.getSelectedItem();
    277277                if (cs == null) return;
    278                 uploadDialogModel.putAll(getSelectedChangeset().getKeys());
     278                uploadDialogModel.putAll(cs.getKeys());
    279279                firePropertyChange(SELECTED_CHANGESET_PROP, null, cs);
    280280            }
Note: See TracChangeset for help on using the changeset viewer.