Changeset 18211 in josm for trunk/src/org


Ignore:
Timestamp:
2021-09-12T02:10:25+02:00 (3 years ago)
Author:
Don-vip
Message:

global use of !Utils.isEmpty/isBlank

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

Legend:

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

    r17663 r18211  
    140140        // Get the list of Launchpad contributors using customary msgid “translator-credits”
    141141        String translators = tr("translator-credits");
    142         if (translators != null && !translators.isEmpty() && !"translator-credits".equals(translators)) {
     142        if (!Utils.isEmpty(translators) && !"translator-credits".equals(translators)) {
    143143            about.addTab(tr("Translators"), createScrollPane(new JosmTextArea(translators)));
    144144        }
     
    211211        symbol.setFont(GuiHelper.getMonospacedFont(symbol));
    212212        JosmTextArea dirLabel = new JosmTextArea();
    213         if (dir != null && !dir.isEmpty()) {
     213        if (!Utils.isEmpty(dir)) {
    214214            dirLabel.setText(dir);
    215215            dirLabel.setEditable(false);
  • trunk/src/org/openstreetmap/josm/actions/AbstractInfoAction.java

    r18014 r18211  
    1919import org.openstreetmap.josm.tools.OpenBrowser;
    2020import org.openstreetmap.josm.tools.Shortcut;
     21import org.openstreetmap.josm.tools.Utils;
    2122
    2223/**
     
    115116    @Override
    116117    protected void updateEnabledState(Collection<? extends OsmPrimitive> selection) {
    117         setEnabled(selection != null && !selection.isEmpty());
     118        setEnabled(!Utils.isEmpty(selection));
    118119    }
    119120}
  • trunk/src/org/openstreetmap/josm/actions/AutoScaleAction.java

    r18005 r18211  
    4040import org.openstreetmap.josm.spi.preferences.Config;
    4141import org.openstreetmap.josm.tools.Shortcut;
     42import org.openstreetmap.josm.tools.Utils;
    4243
    4344/**
     
    421422    protected void updateEnabledState(Collection<? extends OsmPrimitive> selection) {
    422423        if (AutoScaleMode.SELECTION == mode) {
    423             setEnabled(selection != null && !selection.isEmpty());
     424            setEnabled(!Utils.isEmpty(selection));
    424425        }
    425426    }
  • trunk/src/org/openstreetmap/josm/actions/CopyAction.java

    r14397 r18211  
    2121import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    2222import org.openstreetmap.josm.tools.Shortcut;
     23import org.openstreetmap.josm.tools.Utils;
    2324
    2425/**
     
    7071    @Override
    7172    protected void updateEnabledState(Collection<? extends OsmPrimitive> selection) {
    72         setEnabled(selection != null && !selection.isEmpty());
     73        setEnabled(!Utils.isEmpty(selection));
    7374    }
    7475
  • trunk/src/org/openstreetmap/josm/actions/DownloadReferrersAction.java

    r18208 r18211  
    6969    protected void updateEnabledState(Collection<? extends OsmPrimitive> selection) {
    7070        updateEnabledStateOnModifiableSelection(selection);
    71         if (isEnabled() && selection != null && !selection.isEmpty()
     71        if (isEnabled() && !Utils.isEmpty(selection)
    7272                && DownloadPolicy.BLOCKED.equals(selection.iterator().next().getDataSet().getDownloadPolicy())) {
    7373            setEnabled(false);
  • trunk/src/org/openstreetmap/josm/actions/ImageryAdjustAction.java

    r16882 r18211  
    3737import org.openstreetmap.josm.tools.JosmDecimalFormatSymbolsProvider;
    3838import org.openstreetmap.josm.tools.Logging;
     39import org.openstreetmap.josm.tools.Utils;
    3940
    4041/**
     
    328329        protected void buttonAction(int buttonIndex, ActionEvent evt) {
    329330            restoreOldMode = true;
    330             if (buttonIndex == 0 && tBookmarkName.getText() != null && !tBookmarkName.getText().isEmpty() &&
     331            if (buttonIndex == 0 && !Utils.isEmpty(tBookmarkName.getText()) &&
    331332                    OffsetBookmark.getBookmarkByName(layer, tBookmarkName.getText()) != null &&
    332333                    !confirmOverwriteBookmark()) {
     
    346347                if (getValue() != 1) {
    347348                    layer.getDisplaySettings().setOffsetBookmark(old);
    348                 } else if (tBookmarkName.getText() != null && !tBookmarkName.getText().isEmpty()) {
     349                } else if (!Utils.isEmpty(tBookmarkName.getText())) {
    349350                    OffsetBookmark.bookmarkOffset(tBookmarkName.getText(), layer);
    350351                }
  • trunk/src/org/openstreetmap/josm/actions/SelectNonBranchingWaySequences.java

    r16913 r18211  
    1212import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1313import org.openstreetmap.josm.data.osm.Way;
     14import org.openstreetmap.josm.tools.Utils;
    1415
    1516/**
     
    7778     */
    7879    public boolean canExtend() {
    79         return outerNodes != null && !outerNodes.isEmpty();
     80        return !Utils.isEmpty(outerNodes);
    8081    }
    8182
  • trunk/src/org/openstreetmap/josm/actions/SessionLoadAction.java

    r15070 r18211  
    135135
    136136        private void addLayers() {
    137             if (layers != null && !layers.isEmpty()) {
     137            if (!Utils.isEmpty(layers)) {
    138138                boolean noMap = MainApplication.getMap() == null;
    139139                for (Layer l : layers) {
  • trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java

    r18024 r18211  
    5151import org.openstreetmap.josm.tools.GBC;
    5252import org.openstreetmap.josm.tools.Shortcut;
     53import org.openstreetmap.josm.tools.Utils;
    5354
    5455/**
     
    384385            UndoRedoHandler.getInstance().add(result);
    385386            List<? extends PrimitiveId> newSel = result.getNewSelection();
    386             if (newSel != null && !newSel.isEmpty()) {
     387            if (!Utils.isEmpty(newSel)) {
    387388                way.getDataSet().setSelected(newSel);
    388389            }
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java

    r18208 r18211  
    502502                }
    503503                String remark = dataSet.getRemark();
    504                 if (remark != null && !remark.isEmpty()) {
     504                if (!Utils.isEmpty(remark)) {
    505505                    rememberErrorMessage(remark);
    506506                }
  • trunk/src/org/openstreetmap/josm/actions/mapmode/AddNoteAction.java

    r17414 r18211  
    2020import org.openstreetmap.josm.tools.ImageProvider;
    2121import org.openstreetmap.josm.tools.Logging;
     22import org.openstreetmap.josm.tools.Utils;
    2223
    2324/**
     
    7879        }
    7980        String input = dialog.getInputText();
    80         if (input != null && !input.isEmpty()) {
     81        if (!Utils.isEmpty(input)) {
    8182            LatLon latlon = map.mapView.getLatLon(e.getPoint().x, e.getPoint().y);
    8283            noteData.createNote(latlon, input);
  • trunk/src/org/openstreetmap/josm/actions/relation/AddSelectionToRelations.java

    r16441 r18211  
    7070
    7171    private void selectionChanged(final Collection<? extends IPrimitive> newSelection) {
    72         GuiHelper.runInEDT(() -> setEnabled(newSelection != null && !newSelection.isEmpty()
     72        GuiHelper.runInEDT(() -> setEnabled(!Utils.isEmpty(newSelection)
    7373                && OsmUtils.isOsmCollectionEditable(relations)));
    7474    }
  • trunk/src/org/openstreetmap/josm/actions/relation/ExportRelationToGpxAction.java

    r15496 r18211  
    3939import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    4040import org.openstreetmap.josm.tools.SubclassFilteredCollection;
     41import org.openstreetmap.josm.tools.Utils;
    4142
    4243/**
     
    214215    public void setPrimitives(Collection<? extends IPrimitive> primitives) {
    215216        relations = Collections.<Relation>emptySet();
    216         if (primitives != null && !primitives.isEmpty()) {
     217        if (!Utils.isEmpty(primitives)) {
    217218            relations = new SubclassFilteredCollection<>(primitives,
    218219                r -> r instanceof Relation && r.hasTag("type", Arrays.asList("route", "superroute")));
  • trunk/src/org/openstreetmap/josm/data/UserIdentityManager.java

    r18208 r18211  
    217217        String credentialsUserName = CredentialsManager.getInstance().getUsername();
    218218        if (isAnonymous()) {
    219             if (credentialsUserName != null && !credentialsUserName.trim().isEmpty()) {
     219            if (!Utils.isBlank(credentialsUserName)) {
    220220                setPartiallyIdentified(credentialsUserName);
    221221            }
  • trunk/src/org/openstreetmap/josm/data/Version.java

    r16436 r18211  
    178178        int v = getVersion();
    179179        String s = (v == JOSM_UNKNOWN_VERSION) ? "UNKNOWN" : Integer.toString(v);
    180         if (buildName != null && !buildName.isEmpty()) {
     180        if (!Utils.isEmpty(buildName)) {
    181181            s += ' ' + buildName;
    182182        }
  • trunk/src/org/openstreetmap/josm/data/gpx/GpxImageCorrelation.java

    r18130 r18211  
    197197        if (wp != null) {
    198198            String value = wp.getString(GpxConstants.PT_ELE);
    199             if (value != null && !value.isEmpty()) {
     199            if (!Utils.isEmpty(value)) {
    200200                try {
    201201                    return Double.valueOf(value);
  • trunk/src/org/openstreetmap/josm/data/gpx/GpxTrack.java

    r18014 r18211  
    1515import org.openstreetmap.josm.tools.Logging;
    1616import org.openstreetmap.josm.tools.StreamUtils;
     17import org.openstreetmap.josm.tools.Utils;
    1718
    1819/**
     
    3839    public GpxTrack(Collection<Collection<WayPoint>> trackSegs, Map<String, Object> attributes) {
    3940        this.segments = trackSegs.stream()
    40                 .filter(trackSeg -> trackSeg != null && !trackSeg.isEmpty())
     41                .filter(trackSeg -> !Utils.isEmpty(trackSeg))
    4142                .map(GpxTrackSegment::new)
    4243                .collect(StreamUtils.toUnmodifiableList());
  • trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java

    r18193 r18211  
    278278                projections = String.join(",", i.serverProjections);
    279279            }
    280             if (i.noTileHeaders != null && !i.noTileHeaders.isEmpty()) {
     280            if (!Utils.isEmpty(i.noTileHeaders)) {
    281281                noTileHeaders = new MultiMap<>(i.noTileHeaders);
    282282            }
    283283
    284             if (i.noTileChecksums != null && !i.noTileChecksums.isEmpty()) {
     284            if (!Utils.isEmpty(i.noTileChecksums)) {
    285285                noTileChecksums = new MultiMap<>(i.noTileChecksums);
    286286            }
    287287
    288             if (i.metadataHeaders != null && !i.metadataHeaders.isEmpty()) {
     288            if (!Utils.isEmpty(i.metadataHeaders)) {
    289289                metadataHeaders = i.metadataHeaders;
    290290            }
     
    363363        if (t != null) {
    364364            this.sourceType = t;
    365         } else if (type != null && !type.isEmpty()) {
     365        } else if (!Utils.isEmpty(type)) {
    366366            throw new IllegalArgumentException("unknown type: "+type);
    367367        }
     
    411411            }
    412412        }
    413         if (e.projections != null && !e.projections.isEmpty()) {
     413        if (!Utils.isEmpty(e.projections)) {
    414414            // split generates null element on empty string which gives one element Array[null]
    415415            setServerProjections(Arrays.asList(e.projections.split(",", -1)));
     
    717717        boolean html = false;
    718718        String dateStr = getDate();
    719         if (dateStr != null && !dateStr.isEmpty()) {
     719        if (!Utils.isEmpty(dateStr)) {
    720720            html = addNewLineInTooltip(res, tr("Date of imagery: {0}", dateStr), htmlSupported);
    721721        }
     
    730730        }
    731731        String desc = getDescription();
    732         if (desc != null && !desc.isEmpty()) {
     732        if (!Utils.isEmpty(desc)) {
    733733            html = addNewLineInTooltip(res, desc, htmlSupported);
    734734        }
  • trunk/src/org/openstreetmap/josm/data/imagery/ImageryLayerInfo.java

    r17093 r18211  
    333333    // some additional checks to respect extended URLs in preferences (legacy workaround)
    334334    private static boolean isSimilar(String a, String b) {
    335         return Objects.equals(a, b) || (a != null && b != null && !a.isEmpty() && !b.isEmpty() && (a.contains(b) || b.contains(a)));
     335        return Objects.equals(a, b) || (!Utils.isEmpty(a) && !Utils.isEmpty(b) && (a.contains(b) || b.contains(a)));
    336336    }
    337337
  • trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoaderJob.java

    r17862 r18211  
    142142        if (isNotImage(headers, statusCode)) {
    143143            String message = detectErrorMessage(new String(content, StandardCharsets.UTF_8));
    144             if (message != null && !message.isEmpty()) {
     144            if (!Utils.isEmpty(message)) {
    145145                tile.setError(message);
    146146            }
  • trunk/src/org/openstreetmap/josm/data/imagery/vectortile/mapbox/style/Layers.java

    r18115 r18211  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.data.imagery.vectortile.mapbox.style;
    3 
    4 import org.openstreetmap.josm.gui.mappaint.StyleKeys;
    53
    64import java.awt.Font;
     
    2220import javax.json.JsonString;
    2321import javax.json.JsonValue;
     22
     23import org.openstreetmap.josm.gui.mappaint.StyleKeys;
     24import org.openstreetmap.josm.tools.Utils;
    2425
    2526/**
     
    267268        if (layoutObject.containsKey("icon-image")) {
    268269            sb.append(/* NO-ICON */"icon-image:concat(");
    269             if (this.styleId != null && !this.styleId.trim().isEmpty()) {
     270            if (!Utils.isBlank(this.styleId)) {
    270271                sb.append('"').append(this.styleId).append('/').append("\",");
    271272            }
  • trunk/src/org/openstreetmap/josm/data/imagery/vectortile/mapbox/style/MapboxVectorStyle.java

    r18011 r18211  
    3737import org.openstreetmap.josm.spi.preferences.Config;
    3838import org.openstreetmap.josm.tools.Logging;
     39import org.openstreetmap.josm.tools.Utils;
    3940
    4041/**
     
    141142                this.sources.put(source, new ElemStyles(Collections.singleton(style)));
    142143            }
    143             if (this.spriteUrl != null && !this.spriteUrl.trim().isEmpty()) {
     144            if (!Utils.isBlank(this.spriteUrl)) {
    144145                MainApplication.worker.execute(this::fetchSprites);
    145146            }
  • trunk/src/org/openstreetmap/josm/data/osm/Tagged.java

    r17881 r18211  
    88import java.util.stream.Collectors;
    99import java.util.stream.Stream;
     10
     11import org.openstreetmap.josm.tools.Utils;
    1012
    1113/**
     
    111113     */
    112114    default boolean hasTag(String key) {
    113         String v = get(key);
    114         return v != null && !v.isEmpty();
     115        return !Utils.isEmpty(get(key));
    115116    }
    116117
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/relations/Multipolygon.java

    r17761 r18211  
    3232import org.openstreetmap.josm.tools.Geometry.AreaAndPerimeter;
    3333import org.openstreetmap.josm.tools.Logging;
     34import org.openstreetmap.josm.tools.Utils;
    3435
    3536/**
     
    100101            Collection<String> literals;
    101102            literals = Config.getPref().getList(PREF_KEY_OUTER_ROLES);
    102             if (literals != null && !literals.isEmpty()) {
     103            if (!Utils.isEmpty(literals)) {
    103104                setNormalized(literals, outerExactRoles);
    104105            }
    105106            literals = Config.getPref().getList(PREF_KEY_OUTER_ROLE_PREFIXES);
    106             if (literals != null && !literals.isEmpty()) {
     107            if (!Utils.isEmpty(literals)) {
    107108                setNormalized(literals, outerRolePrefixes);
    108109            }
    109110            literals = Config.getPref().getList(PREF_KEY_INNER_ROLES);
    110             if (literals != null && !literals.isEmpty()) {
     111            if (!Utils.isEmpty(literals)) {
    111112                setNormalized(literals, innerExactRoles);
    112113            }
    113114            literals = Config.getPref().getList(PREF_KEY_INNER_ROLE_PREFIXES);
    114             if (literals != null && !literals.isEmpty()) {
     115            if (!Utils.isEmpty(literals)) {
    115116                setNormalized(literals, innerRolePrefixes);
    116117            }
  • trunk/src/org/openstreetmap/josm/data/preferences/NamedColorProperty.java

    r17119 r18211  
    1010import org.openstreetmap.josm.tools.CheckParameterUtil;
    1111import org.openstreetmap.josm.tools.ColorHelper;
     12import org.openstreetmap.josm.tools.Utils;
    1213
    1314/**
     
    8485    public Color get() {
    8586        List<String> data = getPreferences().getList(getKey(), getDefaultValuePref()); // store default value
    86         if (super.isSet() && data != null && !data.isEmpty()) {
     87        if (super.isSet() && !Utils.isEmpty(data)) {
    8788            return ColorHelper.html2color(data.get(0));
    8889        }
  • trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2Proj4DirGridShiftFileSource.java

    r16436 r18211  
    5151        if (grid == null) {
    5252            String projLib = Utils.getSystemProperty("PROJ_LIB");
    53             if (projLib != null && !projLib.isEmpty()) {
     53            if (!Utils.isEmpty(projLib)) {
    5454                File dir = new File(projLib);
    5555                if (dir.exists() && dir.isDirectory()) {
  • trunk/src/org/openstreetmap/josm/data/sources/SourceInfo.java

    r18208 r18211  
    502502        }
    503503        return entries.stream()
    504                 .filter(prefEntry -> prefEntry.id != null && !prefEntry.id.isEmpty())
     504                .filter(prefEntry -> !Utils.isEmpty(prefEntry.id))
    505505                .map(prefEntry -> prefEntry.id)
    506506                .sorted()
     
    517517        boolean html = false;
    518518        String dateStr = getDate();
    519         if (dateStr != null && !dateStr.isEmpty()) {
     519        if (!Utils.isEmpty(dateStr)) {
    520520            res.append("<br>").append(tr("Date of imagery: {0}", dateStr));
    521521            html = true;
     
    526526        }
    527527        String desc = getDescription();
    528         if (desc != null && !desc.isEmpty()) {
     528        if (!Utils.isEmpty(desc)) {
    529529            res.append("<br>").append(Utils.escapeReservedCharactersHTML(desc));
    530530            html = true;
  • trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java

    r18208 r18211  
    392392            DefaultMutableTreeNode branch;
    393393
    394             if (description != null && !description.isEmpty()) {
     394            if (!Utils.isEmpty(description)) {
    395395                trunk = inTree(root, description);
    396396                branch = inTree(trunk, key);
  • trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java

    r17756 r18211  
    297297    private static String findURLTitle(String url) {
    298298        for (SourceEntry source : new ValidatorPrefHelper().get()) {
    299             if (url.equals(source.url) && source.title != null && !source.title.isEmpty()) {
     299            if (url.equals(source.url) && !Utils.isEmpty(source.title)) {
    300300                return source.title;
    301301            }
  • trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java

    r18208 r18211  
    240240                continue;
    241241            Set<String> values = TaggingPresets.getPresetValues(key);
    242             boolean allNumerical = values != null && !values.isEmpty()
     242            boolean allNumerical = !Utils.isEmpty(values)
    243243                    && values.stream().allMatch(TagChecker::isNum);
    244244            if (allNumerical) {
     
    428428     */
    429429    static boolean containsUnwantedNonPrintingControlCharacter(String s) {
    430         return s != null && !s.isEmpty() && (
     430        return !Utils.isEmpty(s) && (
    431431                isJoiningChar(s.charAt(0)) ||
    432432                isJoiningChar(s.charAt(s.length() - 1)) ||
     
    640640                checkSingleTagComplex(withErrors, p, key, value);
    641641            }
    642             if (checkFixmes && key != null && value != null && !value.isEmpty() && isFixme(key, value) && !withErrors.contains(p, "FIXME")) {
     642            if (checkFixmes && key != null && !Utils.isEmpty(value) && isFixme(key, value) && !withErrors.contains(p, "FIXME")) {
    643643                errors.add(TestError.builder(this, Severity.OTHER, FIXME)
    644644                        .message(tr("fixme"))
  • trunk/src/org/openstreetmap/josm/data/validation/util/MultipleNameVisitor.java

    r14865 r18211  
    1313import org.openstreetmap.josm.data.preferences.IntegerProperty;
    1414import org.openstreetmap.josm.tools.ImageProvider;
     15import org.openstreetmap.josm.tools.Utils;
    1516
    1617/**
     
    4445        for (OsmPrimitive osm : data) {
    4546            String name = osm.getDisplayName(DefaultNameFormatter.getInstance());
    46             if (name != null && !name.isEmpty() && multipleName.length() <= MULTIPLE_NAME_MAX_LENGTH.get()) {
     47            if (!Utils.isEmpty(name) && multipleName.length() <= MULTIPLE_NAME_MAX_LENGTH.get()) {
    4748                if (multipleName.length() > 0) {
    4849                    multipleName.append(", ");
  • trunk/src/org/openstreetmap/josm/gui/ExtendedDialog.java

    r17738 r18211  
    509509    @Override
    510510    public final boolean toggleCheckState() {
    511         toggleable = togglePref != null && !togglePref.isEmpty();
     511        toggleable = !Utils.isEmpty(togglePref);
    512512        toggleValue = ConditionalOptionPaneUtil.getDialogReturnValue(togglePref);
    513513        return toggleable && toggleValue != -1;
  • trunk/src/org/openstreetmap/josm/gui/MapStatus.java

    r17733 r18211  
    195195
    196196        private void updateText() {
    197             if (customText != null && !customText.isEmpty()) {
     197            if (!Utils.isEmpty(customText)) {
    198198                progressBar.setToolTipText(tr("{0} ({1})", title, customText));
    199199            } else {
     
    234234        @Override
    235235        public void appendLogMessage(String message) {
    236             if (message != null && !message.isEmpty()) {
     236            if (!Utils.isEmpty(message)) {
    237237                Logging.info("appendLogMessage not implemented for background tasks. Message was: " + message);
    238238            }
  • trunk/src/org/openstreetmap/josm/gui/MapView.java

    r17452 r18211  
    7676import org.openstreetmap.josm.tools.Logging;
    7777import org.openstreetmap.josm.tools.Shortcut;
     78import org.openstreetmap.josm.tools.Utils;
    7879import org.openstreetmap.josm.tools.bugreport.BugReport;
    7980
     
    819820    public String getLayerInformationForSourceTag() {
    820821        return layerManager.getVisibleLayersInZOrder().stream()
    821                 .filter(layer -> layer.getChangesetSourceTag() != null && !layer.getChangesetSourceTag().trim().isEmpty())
     822                .filter(layer -> !Utils.isBlank(layer.getChangesetSourceTag()))
    822823                .map(layer -> layer.getChangesetSourceTag().trim())
    823824                .distinct()
  • trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java

    r17896 r18211  
    13451345                    return ws;
    13461346                }
    1347                 if (preferredRefs != null && !preferredRefs.isEmpty()) {
     1347                if (!Utils.isEmpty(preferredRefs)) {
    13481348                    // prefer ways containing given nodes
    13491349                    if (preferredRefs.contains(ws.getFirstNode()) || preferredRefs.contains(ws.getSecondNode())) {
  • trunk/src/org/openstreetmap/josm/gui/SplashScreen.java

    r17704 r18211  
    234234        @Override
    235235        public void beginTask(String title) {
    236             if (title != null && !title.isEmpty()) {
     236            if (!Utils.isEmpty(title)) {
    237237                Logging.debug(title);
    238238                final MeasurableTask task = new MeasurableTask(title);
  • trunk/src/org/openstreetmap/josm/gui/bbox/JosmMapViewer.java

    r15853 r18211  
    3030import org.openstreetmap.josm.gui.layer.TMSLayer;
    3131import org.openstreetmap.josm.tools.Logging;
     32import org.openstreetmap.josm.tools.Utils;
    3233
    3334/**
     
    7778                Logging.trace(ex);
    7879                Logging.warn(ex.getMessage());
    79                 if (ex.getMessage() != null && !ex.getMessage().isEmpty()) {
     80                if (!Utils.isEmpty(ex.getMessage())) {
    8081                    new Notification(ex.getMessage()).setIcon(JOptionPane.WARNING_MESSAGE).show();
    8182                }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/LatLonDialog.java

    r17078 r18211  
    295295
    296296    private void setOkEnabled(boolean b) {
    297         if (buttons != null && !buttons.isEmpty()) {
     297        if (!Utils.isEmpty(buttons)) {
    298298            buttons.get(0).setEnabled(b);
    299299        }
  • trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java

    r18208 r18211  
    588588         */
    589589        public void setSelectedRelations(Collection<? extends IRelation<?>> sel) {
    590             if (sel != null && !sel.isEmpty()) {
     590            if (!Utils.isEmpty(sel)) {
    591591                if (!getVisibleRelations().containsAll(sel)) {
    592592                    resetFilter();
  • trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java

    r18066 r18211  
    7575import org.openstreetmap.josm.tools.Logging;
    7676import org.openstreetmap.josm.tools.Shortcut;
     77import org.openstreetmap.josm.tools.Utils;
    7778
    7879/**
     
    953954        }
    954955        add(data, BorderLayout.CENTER);
    955         if (!buttons.isEmpty() && buttons.get(0) != null && !buttons.get(0).isEmpty()) {
     956        if (!buttons.isEmpty() && !Utils.isEmpty(buttons.get(0))) {
    956957            buttonsPanel = new JPanel(new GridLayout(buttons.size(), 1));
    957958            for (Collection<SideButton> buttonRow : buttons) {
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/HelpAction.java

    r17032 r18211  
    8787        }
    8888
    89         if (type != null && !type.isEmpty()) {
     89        if (!Utils.isEmpty(type)) {
    9090            pages.add(String.format("%sRelation:%s", lang, type));
    9191            pages.add(String.format("Relation:%s", type));
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java

    r17427 r18211  
    994994        return presets.stream()
    995995                .map(preset -> preset.suggestRoleForOsmPrimitive(p))
    996                 .filter(role -> role != null && !role.isEmpty())
     996                .filter(role -> !Utils.isEmpty(role))
    997997                .collect(Collectors.toSet());
    998998    }
  • trunk/src/org/openstreetmap/josm/gui/download/BookmarkSelection.java

    r18208 r18211  
    204204            );
    205205            b.setArea(currentArea);
    206             if (b.getName() != null && !b.getName().isEmpty()) {
     206            if (!Utils.isEmpty(b.getName())) {
    207207                ((DefaultListModel<BookmarkList.Bookmark>) bookmarks.getModel()).addElement(b);
    208208                bookmarks.save();
  • trunk/src/org/openstreetmap/josm/gui/io/CloseChangesetDialog.java

    r14153 r18211  
    1212import java.util.ArrayList;
    1313import java.util.Collection;
    14 import java.util.List;
    1514
    1615import javax.swing.AbstractAction;
     
    3231import org.openstreetmap.josm.tools.ImageProvider;
    3332import org.openstreetmap.josm.tools.InputMapUtils;
     33import org.openstreetmap.josm.tools.Utils;
    3434
    3535/**
     
    128128
    129129        protected void refreshEnabledState() {
    130             List<Changeset> list = lstOpenChangesets.getSelectedValuesList();
    131             setEnabled(list != null && !list.isEmpty());
     130            setEnabled(!Utils.isEmpty(lstOpenChangesets.getSelectedValuesList()));
    132131        }
    133132
  • trunk/src/org/openstreetmap/josm/gui/io/LayerNameAndFilePathTableCell.java

    r18208 r18211  
    184184    private String makePathFit(String t) {
    185185        boolean hasEllipsis = false;
    186         while (t != null && !t.isEmpty()) {
     186        while (!Utils.isEmpty(t)) {
    187187            int txtwidth = lblFilename.getFontMetrics(lblFilename.getFont()).stringWidth(t);
    188188            if (txtwidth < lblFilename.getWidth() || t.lastIndexOf(File.separator) < ELLIPSIS.length()) {
  • trunk/src/org/openstreetmap/josm/gui/io/UploadParameterSummaryPanel.java

    r17709 r18211  
    2525import org.openstreetmap.josm.tools.ImageProvider;
    2626import org.openstreetmap.josm.tools.StreamUtils;
     27import org.openstreetmap.josm.tools.Utils;
    2728
    2829/**
     
    167168                .orElse("");
    168169        final String html = Stream.of(buildChangesetSummary(), buildChangesetSummary2(), buildStrategySummary(), server)
    169                 .filter(s -> s != null && !s.isEmpty())
     170                .filter(s -> !Utils.isEmpty(s))
    170171                .collect(StreamUtils.toHtmlList());
    171172        jepMessage.setText(html);
  • trunk/src/org/openstreetmap/josm/gui/layer/NoteLayer.java

    r18208 r18211  
    312312            String commentText = comment.getText();
    313313            //closing a note creates an empty comment that we don't want to show
    314             if (commentText != null && !commentText.trim().isEmpty()) {
     314            if (!Utils.isBlank(commentText)) {
    315315                sb.append("<hr/>");
    316316                String userName = XmlWriter.encode(comment.getUser().getName());
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageDisplay.java

    r18150 r18211  
    4040import org.openstreetmap.josm.tools.ImageProcessor;
    4141import org.openstreetmap.josm.tools.Logging;
     42import org.openstreetmap.josm.tools.Utils;
    4243
    4344/**
     
    792793            errorMessage = null;
    793794        }
    794         if (errorMessage != null && !errorMessage.trim().isEmpty()) {
     795        if (!Utils.isBlank(errorMessage)) {
    795796            Rectangle2D errorStringSize = g.getFontMetrics(g.getFont()).getStringBounds(errorMessage, g);
    796797            if (Boolean.TRUE.equals(ERROR_MESSAGE_BACKGROUND.get())) {
  • trunk/src/org/openstreetmap/josm/gui/layer/gpx/ConvertFromGpxLayerAction.java

    r18208 r18211  
    157157        for (GpxExtension ext : exts) {
    158158            String value = ext.getValue();
    159             if (value != null && !value.isEmpty()) {
     159            if (!Utils.isEmpty(value)) {
    160160                String extpre = "extension:";
    161161                String pre = ext.getPrefix();
  • trunk/src/org/openstreetmap/josm/gui/layer/gpx/ImportAudioAction.java

    r16953 r18211  
    124124    private void importAudio(File audioFile, MarkerLayer ml, double firstStartTime, Markers markers) {
    125125        URL url = Utils.fileToURL(audioFile);
    126         boolean hasTracks = layer.data.tracks != null && !layer.data.tracks.isEmpty();
    127         boolean hasWaypoints = layer.data.waypoints != null && !layer.data.waypoints.isEmpty();
     126        boolean hasTracks = !Utils.isEmpty(layer.data.tracks);
     127        boolean hasWaypoints = !Utils.isEmpty(layer.data.waypoints);
    128128        Collection<WayPoint> waypoints = new ArrayList<>();
    129129        boolean timedMarkersOmitted = false;
  • trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceTabbedPane.java

    r17865 r18211  
    437437            final Set<PluginInformation> toDownload = preference.getPluginsScheduledForUpdateOrDownload();
    438438            final PluginDownloadTask task;
    439             if (toDownload != null && !toDownload.isEmpty()) {
     439            if (!Utils.isEmpty(toDownload)) {
    440440                task = new PluginDownloadTask(this, toDownload, tr("Download plugins"));
    441441            } else {
  • trunk/src/org/openstreetmap/josm/gui/preferences/advanced/ListEditor.java

    r16960 r18211  
    2121import org.openstreetmap.josm.tools.GBC;
    2222import org.openstreetmap.josm.tools.SubclassFilteredCollection;
     23import org.openstreetmap.josm.tools.Utils;
    2324
    2425/**
     
    4445    @Override
    4546    public List<String> getData() {
    46         return new ArrayList<>(SubclassFilteredCollection.filter(model.getData(), object -> object != null && !object.isEmpty()));
     47        return new ArrayList<>(SubclassFilteredCollection.filter(model.getData(), object -> !Utils.isEmpty(object)));
    4748    }
    4849
  • trunk/src/org/openstreetmap/josm/gui/preferences/display/GPXSettingsPanel.java

    r18208 r18211  
    696696        putPref("colormode.heatmap.lower-limit", colorTypeHeatMapLowerLimit.getValue());
    697697
    698         if (!global && layers != null && !layers.isEmpty()) {
     698        if (!global && !Utils.isEmpty(layers)) {
    699699            layers.forEach(l -> l.data.invalidate());
    700700        }
  • trunk/src/org/openstreetmap/josm/gui/preferences/imagery/ImageryProvidersPanel.java

    r18208 r18211  
    369369                int viewIndex = defaultTable.convertRowIndexToView(i);
    370370                List<Shape> shapes = bounds.getShapes();
    371                 if (shapes != null && !shapes.isEmpty()) {
     371                if (!Utils.isEmpty(shapes)) {
    372372                    if (defaultTable.getSelectionModel().isSelectedIndex(viewIndex)) {
    373373                        if (!mapPolygons.containsKey(i)) {
  • trunk/src/org/openstreetmap/josm/gui/preferences/map/MapPaintPreference.java

    r17648 r18211  
    3232import org.openstreetmap.josm.tools.GBC;
    3333import org.openstreetmap.josm.tools.Logging;
     34import org.openstreetmap.josm.tools.Utils;
    3435
    3536/**
     
    169170            final MapCSSStyleSource css = new MapCSSStyleSource(entry);
    170171            css.loadStyleSource();
    171             if (css.title != null && !css.title.isEmpty()) {
     172            if (!Utils.isEmpty(css.title)) {
    172173                return css.title;
    173174            }
  • trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginListPanel.java

    r18208 r18211  
    137137            final PluginCheckBox cbPlugin = new PluginCheckBox(pi, selected, this, model);
    138138            String pluginText = tr("{0}: Version {1} (local: {2})", pi.getName(), remoteversion, localversion);
    139             if (pi.requires != null && !pi.requires.isEmpty()) {
     139            if (!Utils.isEmpty(pi.requires)) {
    140140                pluginText += tr(" (requires: {0})", pi.requires);
    141141            }
  • trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreference.java

    r17784 r18211  
    6363import org.openstreetmap.josm.tools.ImageProvider;
    6464import org.openstreetmap.josm.tools.Logging;
     65import org.openstreetmap.josm.tools.Utils;
    6566
    6667/**
     
    556557                            JOptionPane.QUESTION_MESSAGE
    557558                            );
    558                     if (s != null && !s.isEmpty()) {
     559                    if (!Utils.isEmpty(s)) {
    559560                        model.addElement(s);
    560561                    }
     
    582583                            list.getSelectedValue()
    583584                            );
    584                     if (s != null && !s.isEmpty()) {
     585                    if (!Utils.isEmpty(s)) {
    585586                        model.setElementAt(s, list.getSelectedIndex());
    586587                    }
  • trunk/src/org/openstreetmap/josm/gui/preferences/projection/CodeProjectionChoice.java

    r13544 r18211  
    1616import org.openstreetmap.josm.data.projection.Projection;
    1717import org.openstreetmap.josm.data.projection.Projections;
     18import org.openstreetmap.josm.tools.Utils;
    1819
    1920/**
     
    7879    @Override
    7980    public void setPreferences(Collection<String> args) {
    80         if (args != null && !args.isEmpty()) {
     81        if (!Utils.isEmpty(args)) {
    8182            code = args.iterator().next();
    8283        }
  • trunk/src/org/openstreetmap/josm/gui/preferences/projection/CustomProjectionChoice.java

    r18173 r18211  
    3131import org.openstreetmap.josm.tools.ImageProvider;
    3232import org.openstreetmap.josm.tools.Logging;
     33import org.openstreetmap.josm.tools.Utils;
    3334
    3435/**
     
    187188    @Override
    188189    public void setPreferences(Collection<String> args) {
    189         if (args != null && !args.isEmpty()) {
     190        if (!Utils.isEmpty(args)) {
    190191            pref = args.iterator().next();
    191192        }
  • trunk/src/org/openstreetmap/josm/gui/preferences/projection/ListProjectionChoice.java

    r16553 r18211  
    7070    public void setPreferences(Collection<String> args) {
    7171        String zone = null;
    72         if (args != null && !args.isEmpty()) {
     72        if (!Utils.isEmpty(args)) {
    7373            zone = args.iterator().next();
    7474        }
  • trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionManager.java

    r18170 r18211  
    291291        CheckParameterUtil.ensureParameterNotNull(list, "list");
    292292        Collection<TaggingPreset> presets = r != null ? TaggingPresets.getMatchingPresets(null, r.getKeys(), false) : null;
    293         if (r != null && presets != null && !presets.isEmpty()) {
     293        if (r != null && !Utils.isEmpty(presets)) {
    294294            for (TaggingPreset tp : presets) {
    295295                if (tp.roles != null) {
     
    481481                    tagCache = null;
    482482                    roleCache = null;
    483                     ds = null;                   
     483                    ds = null;
    484484                }
    485485            }
  • trunk/src/org/openstreetmap/josm/gui/widgets/AbstractIdTextField.java

    r18170 r18211  
    66import org.openstreetmap.josm.gui.datatransfer.ClipboardUtils;
    77import org.openstreetmap.josm.tools.Logging;
     8import org.openstreetmap.josm.tools.Utils;
    89
    910/**
     
    8081     */
    8182    public boolean tryToPasteFrom(String contents) {
    82         if (contents != null && !contents.trim().isEmpty()) {
     83        if (!Utils.isBlank(contents)) {
    8384            setText(contents.trim());
    8485            clearTextIfInvalid();
  • trunk/src/org/openstreetmap/josm/gui/widgets/ChangesetIdTextField.java

    r14930 r18211  
    77
    88import org.openstreetmap.josm.tools.Logging;
     9import org.openstreetmap.josm.tools.Utils;
    910
    1011/**
     
    7475        public boolean readChangesetId() {
    7576            String value = getComponent().getText();
    76             if (value != null && !value.trim().isEmpty()) {
     77            if (!Utils.isBlank(value)) {
    7778                value = value.trim();
    7879                id = 0;
  • trunk/src/org/openstreetmap/josm/gui/widgets/EditableList.java

    r16438 r18211  
    2020import org.openstreetmap.josm.gui.MainApplication;
    2121import org.openstreetmap.josm.tools.GBC;
     22import org.openstreetmap.josm.tools.Utils;
    2223
    2324/**
     
    6667                    title,
    6768                    JOptionPane.QUESTION_MESSAGE);
    68             if (source != null && !source.isEmpty()) {
     69            if (!Utils.isEmpty(source)) {
    6970                ((DefaultListModel<String>) sourcesList.getModel()).addElement(source);
    7071            }
     
    8182                if (sourcesList.getModel().getSize() == 0) {
    8283                    String source1 = JOptionPane.showInputDialog(MainApplication.getMainFrame(), title, title, JOptionPane.QUESTION_MESSAGE);
    83                     if (source1 != null && !source1.isEmpty()) {
     84                    if (!Utils.isEmpty(source1)) {
    8485                        ((DefaultListModel<String>) sourcesList.getModel()).addElement(source1);
    8586                    }
     
    9899                        JOptionPane.QUESTION_MESSAGE, null, null,
    99100                        sourcesList.getSelectedValue());
    100                 if (source2 != null && !source2.isEmpty()) {
     101                if (!Utils.isEmpty(source2)) {
    101102                    ((DefaultListModel<String>) sourcesList.getModel()).setElementAt(source2, row);
    102103                }
  • trunk/src/org/openstreetmap/josm/gui/widgets/JosmTextField.java

    r17768 r18211  
    2020import org.openstreetmap.josm.gui.MapFrame;
    2121import org.openstreetmap.josm.tools.Destroyable;
     22import org.openstreetmap.josm.tools.Utils;
    2223
    2324/**
     
    192193            icon.paintIcon(this, g, Math.min(leftInsets, h / 2), h / 2);
    193194        }
    194         if (hint != null && !hint.isEmpty() && getText().isEmpty() && !isFocusOwner()) {
     195        if (!Utils.isEmpty(hint) && getText().isEmpty() && !isFocusOwner()) {
    195196            // Taken from http://stackoverflow.com/a/24571681/2257172
    196197            int h = getHeight();
  • trunk/src/org/openstreetmap/josm/gui/widgets/UrlLabel.java

    r17605 r18211  
    9292
    9393    protected final void refresh() {
    94         if (url != null && !url.isEmpty()) {
     94        if (!Utils.isEmpty(url)) {
    9595            refresh("<html><a color=\"" + JosmEditorPane.getLinkColor() + "\" href=\"" + url + "\">" + description + "</a></html>",
    9696                    Cursor.getPredefinedCursor(Cursor.HAND_CURSOR),
     
    147147    @Override
    148148    public void mouseClicked(MouseEvent e) {
    149         if (url != null && !url.isEmpty()) {
     149        if (!Utils.isEmpty(url)) {
    150150            if (SwingUtilities.isLeftMouseButton(e)) {
    151151                OpenBrowser.displayUrl(url);
  • trunk/src/org/openstreetmap/josm/io/DefaultProxySelector.java

    r14273 r18211  
    142142        httpProxySocketAddress = null;
    143143        if (proxyPolicy == ProxyPolicy.USE_HTTP_PROXY) {
    144             if (host != null && !host.trim().isEmpty() && port > 0) {
     144            if (!Utils.isBlank(host) && port > 0) {
    145145                httpProxySocketAddress = new InetSocketAddress(host, port);
    146146            } else {
     
    154154        socksProxySocketAddress = null;
    155155        if (proxyPolicy == ProxyPolicy.USE_SOCKS_PROXY) {
    156             if (host != null && !host.trim().isEmpty() && port > 0) {
     156            if (!Utils.isBlank(host) && port > 0) {
    157157                socksProxySocketAddress = new InetSocketAddress(host, port);
    158158            } else {
  • trunk/src/org/openstreetmap/josm/io/GpxReader.java

    r18051 r18211  
    3232import org.openstreetmap.josm.tools.Logging;
    3333import org.openstreetmap.josm.tools.UncheckedParseException;
     34import org.openstreetmap.josm.tools.Utils;
    3435import org.openstreetmap.josm.tools.XmlUtils;
    3536import org.openstreetmap.josm.tools.date.DateUtils;
     
    661662                        message += '.';
    662663                }
    663                 if (parser.data.creator != null && !parser.data.creator.trim().isEmpty()) {
     664                if (!Utils.isBlank(parser.data.creator)) {
    664665                    message += "\n" + tr("The file was created by \"{0}\".", parser.data.creator);
    665666                }
  • trunk/src/org/openstreetmap/josm/io/GpxWriter.java

    r18207 r18211  
    3636import org.openstreetmap.josm.tools.JosmRuntimeException;
    3737import org.openstreetmap.josm.tools.Logging;
     38import org.openstreetmap.josm.tools.Utils;
    3839
    3940/**
     
    134135
    135136        for (XMLNamespace n : namespaces) {
    136             if (n.getURI() != null && n.getPrefix() != null && !n.getPrefix().isEmpty()) {
     137            if (n.getURI() != null && !Utils.isEmpty(n.getPrefix())) {
    137138                out.println(String.format("    xmlns:%s=\"%s\"", n.getPrefix(), n.getURI()));
    138139                if (n.getLocation() != null) {
     
    323324     */
    324325    private void simpleTag(String tag, String content) {
    325         if (content != null && !content.isEmpty()) {
     326        if (!Utils.isEmpty(content)) {
    326327            open(tag);
    327328            out.print(encode(content));
     
    332333
    333334    private void simpleTag(String tag, String content, String attributes) {
    334         if (content != null && !content.isEmpty()) {
     335        if (!Utils.isEmpty(content)) {
    335336            open(tag, attributes);
    336337            out.print(encode(content));
  • trunk/src/org/openstreetmap/josm/io/MessageNotifier.java

    r17333 r18211  
    149149                        String username = Config.getPref().get("osm-server.username", null);
    150150                        String password = Config.getPref().get("osm-server.password", null);
    151                         return username != null && !username.isEmpty() && password != null && !password.isEmpty();
     151                        return !Utils.isEmpty(username) && !Utils.isEmpty(password);
    152152                    }
    153153                } else {
     
    157157                        String username = credentials.getUsername();
    158158                        char[] password = credentials.getPassword();
    159                         return username != null && !username.isEmpty() && password != null && password.length > 0;
     159                        return !Utils.isEmpty(username) && password != null && password.length > 0;
    160160                    }
    161161                }
  • trunk/src/org/openstreetmap/josm/io/OsmApiException.java

    r18208 r18211  
    218218            sb.append(tr("The server replied an error with code {0}.", responseCode));
    219219        } else {
    220             if (header != null && !header.isEmpty()) {
     220            if (!Utils.isEmpty(header)) {
    221221                sb.append(tr(header));
    222222            }
    223             if (body != null && !body.isEmpty() && !body.equals(header)) {
     223            if (!Utils.isEmpty(body) && !body.equals(header)) {
    224224                if (sb.length() > 0) {
    225225                    sb.append(". ");
  • trunk/src/org/openstreetmap/josm/io/OsmChangeReader.java

    r14314 r18211  
    1616import org.openstreetmap.josm.gui.progress.ProgressMonitor;
    1717import org.openstreetmap.josm.tools.Pair;
     18import org.openstreetmap.josm.tools.Utils;
    1819
    1920/**
     
    122123            }
    123124        }
    124         if (location != null && text != null && !text.isEmpty()) {
     125        if (location != null && !Utils.isEmpty(text)) {
    125126            noteData.createNote(location, text);
    126127        }
  • trunk/src/org/openstreetmap/josm/io/OverpassDownloadReader.java

    r17988 r18211  
    265265        boolean javaDur = false;
    266266        if (matcher.matches()) {
    267             javaPer = matcher.group(1) != null && !matcher.group(1).isEmpty();
    268             javaDur = matcher.group(3) != null && !matcher.group(3).isEmpty();
     267            javaPer = !Utils.isEmpty(matcher.group(1));
     268            javaDur = !Utils.isEmpty(matcher.group(3));
    269269            duration = 'P' + matcher.group(1).replace('X', 'M') + matcher.group(2);
    270270            if (javaDur) {
  • trunk/src/org/openstreetmap/josm/io/auth/CredentialsManager.java

    r15757 r18211  
    1212import org.openstreetmap.josm.tools.CheckParameterUtil;
    1313import org.openstreetmap.josm.tools.Logging;
     14import org.openstreetmap.josm.tools.Utils;
    1415
    1516/**
     
    128129        if (requestorType == RequestorType.SERVER && Objects.equals(OsmApi.getOsmApi().getHost(), host)) {
    129130            String username = credentials.getUserName();
    130             if (username != null && !username.trim().isEmpty()) {
     131            if (!Utils.isBlank(username)) {
    131132                UserIdentityManager.getInstance().setPartiallyIdentified(username);
    132133            }
  • trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java

    r16630 r18211  
    705705            String name, List<LayerDetails> selectedLayers, List<String> selectedStyles, String format, boolean transparent) {
    706706        ImageryInfo i = new ImageryInfo(name, buildGetMapUrl(selectedLayers, selectedStyles, format, transparent));
    707         if (selectedLayers != null && !selectedLayers.isEmpty()) {
     707        if (!selectedLayers.isEmpty()) {
    708708            i.setServerProjections(getServerProjections(selectedLayers));
    709709        }
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/RequestProcessor.java

    r17656 r18211  
    456456            usage.append("<li>")
    457457                 .append(handler.getKey());
    458             if (sample.getUsage() != null && !sample.getUsage().isEmpty()) {
     458            if (!Utils.isEmpty(sample.getUsage())) {
    459459                usage.append(" &mdash; <i>").append(sample.getUsage()).append("</i>");
    460460            }
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/ImportHandler.java

    r16324 r18211  
    8686        // For user-friendliness, let's try to decode these OSM API calls to give a better confirmation message.
    8787        Set<String> taskMessages = new LinkedHashSet<>();
    88         if (suitableDownloadTasks != null && !suitableDownloadTasks.isEmpty()) {
     88        if (!Utils.isEmpty(suitableDownloadTasks)) {
    8989            for (DownloadTask task : suitableDownloadTasks) {
    9090                taskMessages.add(Utils.firstNonNull(task.getConfirmationMessage(url), url.toString()));
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java

    r18208 r18211  
    343343    private <T> T get(String key, Function<String, T> parser, Supplier<T> defaultSupplier) {
    344344        String val = args.get(key);
    345         return val != null && !val.isEmpty() ? parser.apply(val) : defaultSupplier.get();
     345        return !Utils.isEmpty(val) ? parser.apply(val) : defaultSupplier.get();
    346346    }
    347347
  • trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java

    r18201 r18211  
    11411141                plugins = buildListOfPluginsToLoad(parent, monitor.createSubTaskMonitor(1, false));
    11421142                // If only some plugins have to be updated, filter the list
    1143                 if (pluginsWanted != null && !pluginsWanted.isEmpty()) {
     1143                if (!Utils.isEmpty(pluginsWanted)) {
    11441144                    final Collection<String> pluginsWantedName = Utils.transform(pluginsWanted, piw -> piw.name);
    11451145                    plugins = SubclassFilteredCollection.filter(plugins, pi -> pluginsWantedName.contains(pi.name));
     
    15941594            PluginInformation pi = pp.getPluginInformation();
    15951595            pl.remove(pi.name);
    1596             pl.add(pi.name + " (" + (pi.localversion != null && !pi.localversion.isEmpty()
     1596            pl.add(pi.name + " (" + (!Utils.isEmpty(pi.localversion)
    15971597                    ? pi.localversion : "unknown") + ')');
    15981598        }
     
    16081608        for (final PluginInformation info : getPlugins()) {
    16091609            String name = info.name
    1610             + (info.localversion != null && !info.localversion.isEmpty() ? " Version: " + info.localversion : "");
     1610            + (!Utils.isEmpty(info.localversion) ? " Version: " + info.localversion : "");
    16111611            pluginTab.add(new JLabel(name), GBC.std());
    16121612            pluginTab.add(Box.createHorizontalGlue(), GBC.std().fill(GBC.HORIZONTAL));
  • trunk/src/org/openstreetmap/josm/plugins/PluginInformation.java

    r17573 r18211  
    261261        stage = stageStr == null ? 50 : Integer.parseInt(stageStr);
    262262        version = attr.getValue("Plugin-Version");
    263         if (version != null && !version.isEmpty() && version.charAt(0) == '$') {
     263        if (!Utils.isEmpty(version) && version.charAt(0) == '$') {
    264264            invalidManifestEntries.add("Plugin-Version");
    265265        }
  • trunk/src/org/openstreetmap/josm/plugins/ReadRemotePluginInformationTask.java

    r18208 r18211  
    225225            }
    226226            panel.add(new JLabel("<html><body width=\"500\"><b>"+b.toString().trim()+"</b></body></html>"), GBC.eol().insets(0, 0, 0, 10));
    227             if (details != null && !details.isEmpty()) {
     227            if (!Utils.isEmpty(details)) {
    228228                panel.add(new JLabel(tr("Details:")), GBC.eol().insets(0, 0, 0, 10));
    229229                JosmTextArea area = new JosmTextArea(details);
  • trunk/src/org/openstreetmap/josm/tools/ExceptionUtil.java

    r18208 r18211  
    313313        String msg = e.getDisplayMessage();
    314314
    315         if (msg != null && !msg.isEmpty()) {
     315        if (!Utils.isEmpty(msg)) {
    316316            return tr("<html>"
    317317                    + "Authorisation at the OSM server failed.<br>"
  • trunk/src/org/openstreetmap/josm/tools/HttpClient.java

    r17076 r18211  
    147147                }
    148148                cr = performConnection();
    149                 final boolean hasReason = reasonForRequest != null && !reasonForRequest.isEmpty();
     149                final boolean hasReason = !Utils.isEmpty(reasonForRequest);
    150150                logRequest("{0} {1}{2} -> {3} {4} ({5}{6})",
    151151                        getRequestMethod(), getURL(), hasReason ? (" (" + reasonForRequest + ')') : "",
  • trunk/src/org/openstreetmap/josm/tools/ImageProvider.java

    r18178 r18211  
    898898                String cacheName = prefix + fullName;
    899899                /* cache separately */
    900                 if (dirs != null && !dirs.isEmpty()) {
     900                if (!Utils.isEmpty(dirs)) {
    901901                    cacheName = "id:" + id + ':' + fullName;
    902902                    if (archive != null) {
     
    19561956    public String toString() {
    19571957        return ("ImageProvider ["
    1958                 + (dirs != null && !dirs.isEmpty() ? "dirs=" + dirs + ", " : "") + (id != null ? "id=" + id + ", " : "")
    1959                 + (subdir != null && !subdir.isEmpty() ? "subdir=" + subdir + ", " : "") + "name=" + name + ", "
     1958                + (!Utils.isEmpty(dirs) ? "dirs=" + dirs + ", " : "") + (id != null ? "id=" + id + ", " : "")
     1959                + (!Utils.isEmpty(subdir) ? "subdir=" + subdir + ", " : "") + "name=" + name + ", "
    19601960                + (archive != null ? "archive=" + archive + ", " : "")
    1961                 + (inArchiveDir != null && !inArchiveDir.isEmpty() ? "inArchiveDir=" + inArchiveDir : "") + ']').replaceAll(", \\]", "]");
     1961                + (!Utils.isEmpty(inArchiveDir) ? "inArchiveDir=" + inArchiveDir : "") + ']').replaceAll(", \\]", "]");
    19621962    }
    19631963}
  • trunk/src/org/openstreetmap/josm/tools/LanguageInfo.java

    r17787 r18211  
    306306        if (c.isEmpty())
    307307            c = null;
    308         if (v != null && !v.isEmpty()) {
     308        if (!Utils.isEmpty(v)) {
    309309            if (c != null)
    310310                list.add(lang+'_'+c+'@'+v);
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookUnixoid.java

    r17679 r18211  
    156156                    try {
    157157                        String version = Utils.execOutput(Arrays.asList(args));
    158                         if (version != null && !version.isEmpty()) {
     158                        if (!Utils.isEmpty(version)) {
    159159                            return packageName + ':' + version;
    160160                        }
     
    240240                // see https://www.linuxbase.org/lsb-cert/productdir.php?by_prod )
    241241                String line = exec("lsb_release", "-ds");
    242                 if (line != null && !line.isEmpty()) {
     242                if (!Utils.isEmpty(line)) {
    243243                    line = line.replaceAll("\"+", "");
    244244                    line = line.replace("NAME=", ""); // strange code for some Gentoo's
     
    262262                }) {
    263263                    String description = info.extractDescription();
    264                     if (description != null && !description.isEmpty()) {
     264                    if (!Utils.isEmpty(description)) {
    265265                        return "Linux " + description;
    266266                    }
     
    356356            }
    357357            // Append prefix if any
    358             if (result != null && !result.isEmpty() && prefix != null && !prefix.isEmpty()) {
     358            if (!Utils.isEmpty(result) && !Utils.isEmpty(prefix)) {
    359359                result = prefix + result;
    360360            }
     
    390390        } else {
    391391            String xdgCacheDir = getSystemEnv("XDG_CACHE_HOME");
    392             if (xdgCacheDir != null && !xdgCacheDir.isEmpty()) {
     392            if (!Utils.isEmpty(xdgCacheDir)) {
    393393                return new File(xdgCacheDir, Preferences.getJOSMDirectoryBaseName());
    394394            } else {
     
    405405        } else {
    406406            String xdgConfigDir = getSystemEnv("XDG_CONFIG_HOME");
    407             if (xdgConfigDir != null && !xdgConfigDir.isEmpty()) {
     407            if (!Utils.isEmpty(xdgConfigDir)) {
    408408                return new File(xdgConfigDir, Preferences.getJOSMDirectoryBaseName());
    409409            } else {
     
    420420        } else {
    421421            String xdgDataDir = getSystemEnv("XDG_DATA_HOME");
    422             if (xdgDataDir != null && !xdgDataDir.isEmpty()) {
     422            if (!Utils.isEmpty(xdgDataDir)) {
    423423                return new File(xdgDataDir, Preferences.getJOSMDirectoryBaseName());
    424424            } else {
  • trunk/src/org/openstreetmap/josm/tools/template_engine/ContextSwitchTemplate.java

    r16493 r18211  
    2323import org.openstreetmap.josm.data.osm.search.SearchCompiler.Or;
    2424import org.openstreetmap.josm.data.osm.search.SearchCompiler.Parent;
     25import org.openstreetmap.josm.tools.Utils;
    2526
    2627/**
     
    369370        if (dataProvider instanceof OsmPrimitive) {
    370371            List<OsmPrimitive> primitives = context.getPrimitives((OsmPrimitive) dataProvider);
    371             if (primitives != null && !primitives.isEmpty()) {
     372            if (!Utils.isEmpty(primitives)) {
    372373                template.appendText(result, primitives.get(0));
    373374            }
     
    380381        if (dataProvider instanceof OsmPrimitive) {
    381382            List<OsmPrimitive> primitives = context.getPrimitives((OsmPrimitive) dataProvider);
    382             if (primitives != null && !primitives.isEmpty()) {
     383            if (!Utils.isEmpty(primitives)) {
    383384                return template.isValid(primitives.get(0));
    384385            }
Note: See TracChangeset for help on using the changeset viewer.