Changeset 18211 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2021-09-12T02:10:25+02:00 (3 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 87 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/AboutAction.java
r17663 r18211 140 140 // Get the list of Launchpad contributors using customary msgid “translator-credits” 141 141 String translators = tr("translator-credits"); 142 if (translators != null && !translators.isEmpty() && !"translator-credits".equals(translators)) {142 if (!Utils.isEmpty(translators) && !"translator-credits".equals(translators)) { 143 143 about.addTab(tr("Translators"), createScrollPane(new JosmTextArea(translators))); 144 144 } … … 211 211 symbol.setFont(GuiHelper.getMonospacedFont(symbol)); 212 212 JosmTextArea dirLabel = new JosmTextArea(); 213 if ( dir != null && !dir.isEmpty()) {213 if (!Utils.isEmpty(dir)) { 214 214 dirLabel.setText(dir); 215 215 dirLabel.setEditable(false); -
trunk/src/org/openstreetmap/josm/actions/AbstractInfoAction.java
r18014 r18211 19 19 import org.openstreetmap.josm.tools.OpenBrowser; 20 20 import org.openstreetmap.josm.tools.Shortcut; 21 import org.openstreetmap.josm.tools.Utils; 21 22 22 23 /** … … 115 116 @Override 116 117 protected void updateEnabledState(Collection<? extends OsmPrimitive> selection) { 117 setEnabled(selection != null && !selection.isEmpty());118 setEnabled(!Utils.isEmpty(selection)); 118 119 } 119 120 } -
trunk/src/org/openstreetmap/josm/actions/AutoScaleAction.java
r18005 r18211 40 40 import org.openstreetmap.josm.spi.preferences.Config; 41 41 import org.openstreetmap.josm.tools.Shortcut; 42 import org.openstreetmap.josm.tools.Utils; 42 43 43 44 /** … … 421 422 protected void updateEnabledState(Collection<? extends OsmPrimitive> selection) { 422 423 if (AutoScaleMode.SELECTION == mode) { 423 setEnabled(selection != null && !selection.isEmpty());424 setEnabled(!Utils.isEmpty(selection)); 424 425 } 425 426 } -
trunk/src/org/openstreetmap/josm/actions/CopyAction.java
r14397 r18211 21 21 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 22 22 import org.openstreetmap.josm.tools.Shortcut; 23 import org.openstreetmap.josm.tools.Utils; 23 24 24 25 /** … … 70 71 @Override 71 72 protected void updateEnabledState(Collection<? extends OsmPrimitive> selection) { 72 setEnabled(selection != null && !selection.isEmpty());73 setEnabled(!Utils.isEmpty(selection)); 73 74 } 74 75 -
trunk/src/org/openstreetmap/josm/actions/DownloadReferrersAction.java
r18208 r18211 69 69 protected void updateEnabledState(Collection<? extends OsmPrimitive> selection) { 70 70 updateEnabledStateOnModifiableSelection(selection); 71 if (isEnabled() && selection != null && !selection.isEmpty()71 if (isEnabled() && !Utils.isEmpty(selection) 72 72 && DownloadPolicy.BLOCKED.equals(selection.iterator().next().getDataSet().getDownloadPolicy())) { 73 73 setEnabled(false); -
trunk/src/org/openstreetmap/josm/actions/ImageryAdjustAction.java
r16882 r18211 37 37 import org.openstreetmap.josm.tools.JosmDecimalFormatSymbolsProvider; 38 38 import org.openstreetmap.josm.tools.Logging; 39 import org.openstreetmap.josm.tools.Utils; 39 40 40 41 /** … … 328 329 protected void buttonAction(int buttonIndex, ActionEvent evt) { 329 330 restoreOldMode = true; 330 if (buttonIndex == 0 && tBookmarkName.getText() != null && !tBookmarkName.getText().isEmpty() &&331 if (buttonIndex == 0 && !Utils.isEmpty(tBookmarkName.getText()) && 331 332 OffsetBookmark.getBookmarkByName(layer, tBookmarkName.getText()) != null && 332 333 !confirmOverwriteBookmark()) { … … 346 347 if (getValue() != 1) { 347 348 layer.getDisplaySettings().setOffsetBookmark(old); 348 } else if (tBookmarkName.getText() != null && !tBookmarkName.getText().isEmpty()) {349 } else if (!Utils.isEmpty(tBookmarkName.getText())) { 349 350 OffsetBookmark.bookmarkOffset(tBookmarkName.getText(), layer); 350 351 } -
trunk/src/org/openstreetmap/josm/actions/SelectNonBranchingWaySequences.java
r16913 r18211 12 12 import org.openstreetmap.josm.data.osm.OsmPrimitive; 13 13 import org.openstreetmap.josm.data.osm.Way; 14 import org.openstreetmap.josm.tools.Utils; 14 15 15 16 /** … … 77 78 */ 78 79 public boolean canExtend() { 79 return outerNodes != null && !outerNodes.isEmpty();80 return !Utils.isEmpty(outerNodes); 80 81 } 81 82 -
trunk/src/org/openstreetmap/josm/actions/SessionLoadAction.java
r15070 r18211 135 135 136 136 private void addLayers() { 137 if ( layers != null && !layers.isEmpty()) {137 if (!Utils.isEmpty(layers)) { 138 138 boolean noMap = MainApplication.getMap() == null; 139 139 for (Layer l : layers) { -
trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java
r18024 r18211 51 51 import org.openstreetmap.josm.tools.GBC; 52 52 import org.openstreetmap.josm.tools.Shortcut; 53 import org.openstreetmap.josm.tools.Utils; 53 54 54 55 /** … … 384 385 UndoRedoHandler.getInstance().add(result); 385 386 List<? extends PrimitiveId> newSel = result.getNewSelection(); 386 if ( newSel != null && !newSel.isEmpty()) {387 if (!Utils.isEmpty(newSel)) { 387 388 way.getDataSet().setSelected(newSel); 388 389 } -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java
r18208 r18211 502 502 } 503 503 String remark = dataSet.getRemark(); 504 if ( remark != null && !remark.isEmpty()) {504 if (!Utils.isEmpty(remark)) { 505 505 rememberErrorMessage(remark); 506 506 } -
trunk/src/org/openstreetmap/josm/actions/mapmode/AddNoteAction.java
r17414 r18211 20 20 import org.openstreetmap.josm.tools.ImageProvider; 21 21 import org.openstreetmap.josm.tools.Logging; 22 import org.openstreetmap.josm.tools.Utils; 22 23 23 24 /** … … 78 79 } 79 80 String input = dialog.getInputText(); 80 if ( input != null && !input.isEmpty()) {81 if (!Utils.isEmpty(input)) { 81 82 LatLon latlon = map.mapView.getLatLon(e.getPoint().x, e.getPoint().y); 82 83 noteData.createNote(latlon, input); -
trunk/src/org/openstreetmap/josm/actions/relation/AddSelectionToRelations.java
r16441 r18211 70 70 71 71 private void selectionChanged(final Collection<? extends IPrimitive> newSelection) { 72 GuiHelper.runInEDT(() -> setEnabled(newSelection != null && !newSelection.isEmpty()72 GuiHelper.runInEDT(() -> setEnabled(!Utils.isEmpty(newSelection) 73 73 && OsmUtils.isOsmCollectionEditable(relations))); 74 74 } -
trunk/src/org/openstreetmap/josm/actions/relation/ExportRelationToGpxAction.java
r15496 r18211 39 39 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 40 40 import org.openstreetmap.josm.tools.SubclassFilteredCollection; 41 import org.openstreetmap.josm.tools.Utils; 41 42 42 43 /** … … 214 215 public void setPrimitives(Collection<? extends IPrimitive> primitives) { 215 216 relations = Collections.<Relation>emptySet(); 216 if (primitives != null && !primitives.isEmpty()) {217 if (!Utils.isEmpty(primitives)) { 217 218 relations = new SubclassFilteredCollection<>(primitives, 218 219 r -> r instanceof Relation && r.hasTag("type", Arrays.asList("route", "superroute"))); -
trunk/src/org/openstreetmap/josm/data/UserIdentityManager.java
r18208 r18211 217 217 String credentialsUserName = CredentialsManager.getInstance().getUsername(); 218 218 if (isAnonymous()) { 219 if (credentialsUserName != null && !credentialsUserName.trim().isEmpty()) {219 if (!Utils.isBlank(credentialsUserName)) { 220 220 setPartiallyIdentified(credentialsUserName); 221 221 } -
trunk/src/org/openstreetmap/josm/data/Version.java
r16436 r18211 178 178 int v = getVersion(); 179 179 String s = (v == JOSM_UNKNOWN_VERSION) ? "UNKNOWN" : Integer.toString(v); 180 if (buildName != null && !buildName.isEmpty()) {180 if (!Utils.isEmpty(buildName)) { 181 181 s += ' ' + buildName; 182 182 } -
trunk/src/org/openstreetmap/josm/data/gpx/GpxImageCorrelation.java
r18130 r18211 197 197 if (wp != null) { 198 198 String value = wp.getString(GpxConstants.PT_ELE); 199 if ( value != null && !value.isEmpty()) {199 if (!Utils.isEmpty(value)) { 200 200 try { 201 201 return Double.valueOf(value); -
trunk/src/org/openstreetmap/josm/data/gpx/GpxTrack.java
r18014 r18211 15 15 import org.openstreetmap.josm.tools.Logging; 16 16 import org.openstreetmap.josm.tools.StreamUtils; 17 import org.openstreetmap.josm.tools.Utils; 17 18 18 19 /** … … 38 39 public GpxTrack(Collection<Collection<WayPoint>> trackSegs, Map<String, Object> attributes) { 39 40 this.segments = trackSegs.stream() 40 .filter(trackSeg -> trackSeg != null && !trackSeg.isEmpty())41 .filter(trackSeg -> !Utils.isEmpty(trackSeg)) 41 42 .map(GpxTrackSegment::new) 42 43 .collect(StreamUtils.toUnmodifiableList()); -
trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java
r18193 r18211 278 278 projections = String.join(",", i.serverProjections); 279 279 } 280 if (i.noTileHeaders != null && !i.noTileHeaders.isEmpty()) {280 if (!Utils.isEmpty(i.noTileHeaders)) { 281 281 noTileHeaders = new MultiMap<>(i.noTileHeaders); 282 282 } 283 283 284 if (i.noTileChecksums != null && !i.noTileChecksums.isEmpty()) {284 if (!Utils.isEmpty(i.noTileChecksums)) { 285 285 noTileChecksums = new MultiMap<>(i.noTileChecksums); 286 286 } 287 287 288 if (i.metadataHeaders != null && !i.metadataHeaders.isEmpty()) {288 if (!Utils.isEmpty(i.metadataHeaders)) { 289 289 metadataHeaders = i.metadataHeaders; 290 290 } … … 363 363 if (t != null) { 364 364 this.sourceType = t; 365 } else if ( type != null && !type.isEmpty()) {365 } else if (!Utils.isEmpty(type)) { 366 366 throw new IllegalArgumentException("unknown type: "+type); 367 367 } … … 411 411 } 412 412 } 413 if (e.projections != null && !e.projections.isEmpty()) {413 if (!Utils.isEmpty(e.projections)) { 414 414 // split generates null element on empty string which gives one element Array[null] 415 415 setServerProjections(Arrays.asList(e.projections.split(",", -1))); … … 717 717 boolean html = false; 718 718 String dateStr = getDate(); 719 if ( dateStr != null && !dateStr.isEmpty()) {719 if (!Utils.isEmpty(dateStr)) { 720 720 html = addNewLineInTooltip(res, tr("Date of imagery: {0}", dateStr), htmlSupported); 721 721 } … … 730 730 } 731 731 String desc = getDescription(); 732 if ( desc != null && !desc.isEmpty()) {732 if (!Utils.isEmpty(desc)) { 733 733 html = addNewLineInTooltip(res, desc, htmlSupported); 734 734 } -
trunk/src/org/openstreetmap/josm/data/imagery/ImageryLayerInfo.java
r17093 r18211 333 333 // some additional checks to respect extended URLs in preferences (legacy workaround) 334 334 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))); 336 336 } 337 337 -
trunk/src/org/openstreetmap/josm/data/imagery/TMSCachedTileLoaderJob.java
r17862 r18211 142 142 if (isNotImage(headers, statusCode)) { 143 143 String message = detectErrorMessage(new String(content, StandardCharsets.UTF_8)); 144 if ( message != null && !message.isEmpty()) {144 if (!Utils.isEmpty(message)) { 145 145 tile.setError(message); 146 146 } -
trunk/src/org/openstreetmap/josm/data/imagery/vectortile/mapbox/style/Layers.java
r18115 r18211 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.data.imagery.vectortile.mapbox.style; 3 4 import org.openstreetmap.josm.gui.mappaint.StyleKeys;5 3 6 4 import java.awt.Font; … … 22 20 import javax.json.JsonString; 23 21 import javax.json.JsonValue; 22 23 import org.openstreetmap.josm.gui.mappaint.StyleKeys; 24 import org.openstreetmap.josm.tools.Utils; 24 25 25 26 /** … … 267 268 if (layoutObject.containsKey("icon-image")) { 268 269 sb.append(/* NO-ICON */"icon-image:concat("); 269 if (this.styleId != null && !this.styleId.trim().isEmpty()) {270 if (!Utils.isBlank(this.styleId)) { 270 271 sb.append('"').append(this.styleId).append('/').append("\","); 271 272 } -
trunk/src/org/openstreetmap/josm/data/imagery/vectortile/mapbox/style/MapboxVectorStyle.java
r18011 r18211 37 37 import org.openstreetmap.josm.spi.preferences.Config; 38 38 import org.openstreetmap.josm.tools.Logging; 39 import org.openstreetmap.josm.tools.Utils; 39 40 40 41 /** … … 141 142 this.sources.put(source, new ElemStyles(Collections.singleton(style))); 142 143 } 143 if (this.spriteUrl != null && !this.spriteUrl.trim().isEmpty()) {144 if (!Utils.isBlank(this.spriteUrl)) { 144 145 MainApplication.worker.execute(this::fetchSprites); 145 146 } -
trunk/src/org/openstreetmap/josm/data/osm/Tagged.java
r17881 r18211 8 8 import java.util.stream.Collectors; 9 9 import java.util.stream.Stream; 10 11 import org.openstreetmap.josm.tools.Utils; 10 12 11 13 /** … … 111 113 */ 112 114 default boolean hasTag(String key) { 113 String v = get(key); 114 return v != null && !v.isEmpty(); 115 return !Utils.isEmpty(get(key)); 115 116 } 116 117 -
trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/relations/Multipolygon.java
r17761 r18211 32 32 import org.openstreetmap.josm.tools.Geometry.AreaAndPerimeter; 33 33 import org.openstreetmap.josm.tools.Logging; 34 import org.openstreetmap.josm.tools.Utils; 34 35 35 36 /** … … 100 101 Collection<String> literals; 101 102 literals = Config.getPref().getList(PREF_KEY_OUTER_ROLES); 102 if ( literals != null && !literals.isEmpty()) {103 if (!Utils.isEmpty(literals)) { 103 104 setNormalized(literals, outerExactRoles); 104 105 } 105 106 literals = Config.getPref().getList(PREF_KEY_OUTER_ROLE_PREFIXES); 106 if ( literals != null && !literals.isEmpty()) {107 if (!Utils.isEmpty(literals)) { 107 108 setNormalized(literals, outerRolePrefixes); 108 109 } 109 110 literals = Config.getPref().getList(PREF_KEY_INNER_ROLES); 110 if ( literals != null && !literals.isEmpty()) {111 if (!Utils.isEmpty(literals)) { 111 112 setNormalized(literals, innerExactRoles); 112 113 } 113 114 literals = Config.getPref().getList(PREF_KEY_INNER_ROLE_PREFIXES); 114 if ( literals != null && !literals.isEmpty()) {115 if (!Utils.isEmpty(literals)) { 115 116 setNormalized(literals, innerRolePrefixes); 116 117 } -
trunk/src/org/openstreetmap/josm/data/preferences/NamedColorProperty.java
r17119 r18211 10 10 import org.openstreetmap.josm.tools.CheckParameterUtil; 11 11 import org.openstreetmap.josm.tools.ColorHelper; 12 import org.openstreetmap.josm.tools.Utils; 12 13 13 14 /** … … 84 85 public Color get() { 85 86 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)) { 87 88 return ColorHelper.html2color(data.get(0)); 88 89 } -
trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2Proj4DirGridShiftFileSource.java
r16436 r18211 51 51 if (grid == null) { 52 52 String projLib = Utils.getSystemProperty("PROJ_LIB"); 53 if ( projLib != null && !projLib.isEmpty()) {53 if (!Utils.isEmpty(projLib)) { 54 54 File dir = new File(projLib); 55 55 if (dir.exists() && dir.isDirectory()) { -
trunk/src/org/openstreetmap/josm/data/sources/SourceInfo.java
r18208 r18211 502 502 } 503 503 return entries.stream() 504 .filter(prefEntry -> prefEntry.id != null && !prefEntry.id.isEmpty())504 .filter(prefEntry -> !Utils.isEmpty(prefEntry.id)) 505 505 .map(prefEntry -> prefEntry.id) 506 506 .sorted() … … 517 517 boolean html = false; 518 518 String dateStr = getDate(); 519 if ( dateStr != null && !dateStr.isEmpty()) {519 if (!Utils.isEmpty(dateStr)) { 520 520 res.append("<br>").append(tr("Date of imagery: {0}", dateStr)); 521 521 html = true; … … 526 526 } 527 527 String desc = getDescription(); 528 if ( desc != null && !desc.isEmpty()) {528 if (!Utils.isEmpty(desc)) { 529 529 res.append("<br>").append(Utils.escapeReservedCharactersHTML(desc)); 530 530 html = true; -
trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java
r18208 r18211 392 392 DefaultMutableTreeNode branch; 393 393 394 if (description != null && !description.isEmpty()) {394 if (!Utils.isEmpty(description)) { 395 395 trunk = inTree(root, description); 396 396 branch = inTree(trunk, key); -
trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java
r17756 r18211 297 297 private static String findURLTitle(String url) { 298 298 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)) { 300 300 return source.title; 301 301 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java
r18208 r18211 240 240 continue; 241 241 Set<String> values = TaggingPresets.getPresetValues(key); 242 boolean allNumerical = values != null && !values.isEmpty()242 boolean allNumerical = !Utils.isEmpty(values) 243 243 && values.stream().allMatch(TagChecker::isNum); 244 244 if (allNumerical) { … … 428 428 */ 429 429 static boolean containsUnwantedNonPrintingControlCharacter(String s) { 430 return s != null && !s.isEmpty() && (430 return !Utils.isEmpty(s) && ( 431 431 isJoiningChar(s.charAt(0)) || 432 432 isJoiningChar(s.charAt(s.length() - 1)) || … … 640 640 checkSingleTagComplex(withErrors, p, key, value); 641 641 } 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")) { 643 643 errors.add(TestError.builder(this, Severity.OTHER, FIXME) 644 644 .message(tr("fixme")) -
trunk/src/org/openstreetmap/josm/data/validation/util/MultipleNameVisitor.java
r14865 r18211 13 13 import org.openstreetmap.josm.data.preferences.IntegerProperty; 14 14 import org.openstreetmap.josm.tools.ImageProvider; 15 import org.openstreetmap.josm.tools.Utils; 15 16 16 17 /** … … 44 45 for (OsmPrimitive osm : data) { 45 46 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()) { 47 48 if (multipleName.length() > 0) { 48 49 multipleName.append(", "); -
trunk/src/org/openstreetmap/josm/gui/ExtendedDialog.java
r17738 r18211 509 509 @Override 510 510 public final boolean toggleCheckState() { 511 toggleable = togglePref != null && !togglePref.isEmpty();511 toggleable = !Utils.isEmpty(togglePref); 512 512 toggleValue = ConditionalOptionPaneUtil.getDialogReturnValue(togglePref); 513 513 return toggleable && toggleValue != -1; -
trunk/src/org/openstreetmap/josm/gui/MapStatus.java
r17733 r18211 195 195 196 196 private void updateText() { 197 if (customText != null && !customText.isEmpty()) {197 if (!Utils.isEmpty(customText)) { 198 198 progressBar.setToolTipText(tr("{0} ({1})", title, customText)); 199 199 } else { … … 234 234 @Override 235 235 public void appendLogMessage(String message) { 236 if ( message != null && !message.isEmpty()) {236 if (!Utils.isEmpty(message)) { 237 237 Logging.info("appendLogMessage not implemented for background tasks. Message was: " + message); 238 238 } -
trunk/src/org/openstreetmap/josm/gui/MapView.java
r17452 r18211 76 76 import org.openstreetmap.josm.tools.Logging; 77 77 import org.openstreetmap.josm.tools.Shortcut; 78 import org.openstreetmap.josm.tools.Utils; 78 79 import org.openstreetmap.josm.tools.bugreport.BugReport; 79 80 … … 819 820 public String getLayerInformationForSourceTag() { 820 821 return layerManager.getVisibleLayersInZOrder().stream() 821 .filter(layer -> layer.getChangesetSourceTag() != null && !layer.getChangesetSourceTag().trim().isEmpty())822 .filter(layer -> !Utils.isBlank(layer.getChangesetSourceTag())) 822 823 .map(layer -> layer.getChangesetSourceTag().trim()) 823 824 .distinct() -
trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
r17896 r18211 1345 1345 return ws; 1346 1346 } 1347 if (preferredRefs != null && !preferredRefs.isEmpty()) {1347 if (!Utils.isEmpty(preferredRefs)) { 1348 1348 // prefer ways containing given nodes 1349 1349 if (preferredRefs.contains(ws.getFirstNode()) || preferredRefs.contains(ws.getSecondNode())) { -
trunk/src/org/openstreetmap/josm/gui/SplashScreen.java
r17704 r18211 234 234 @Override 235 235 public void beginTask(String title) { 236 if ( title != null && !title.isEmpty()) {236 if (!Utils.isEmpty(title)) { 237 237 Logging.debug(title); 238 238 final MeasurableTask task = new MeasurableTask(title); -
trunk/src/org/openstreetmap/josm/gui/bbox/JosmMapViewer.java
r15853 r18211 30 30 import org.openstreetmap.josm.gui.layer.TMSLayer; 31 31 import org.openstreetmap.josm.tools.Logging; 32 import org.openstreetmap.josm.tools.Utils; 32 33 33 34 /** … … 77 78 Logging.trace(ex); 78 79 Logging.warn(ex.getMessage()); 79 if (ex.getMessage() != null && !ex.getMessage().isEmpty()) {80 if (!Utils.isEmpty(ex.getMessage())) { 80 81 new Notification(ex.getMessage()).setIcon(JOptionPane.WARNING_MESSAGE).show(); 81 82 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/LatLonDialog.java
r17078 r18211 295 295 296 296 private void setOkEnabled(boolean b) { 297 if ( buttons != null && !buttons.isEmpty()) {297 if (!Utils.isEmpty(buttons)) { 298 298 buttons.get(0).setEnabled(b); 299 299 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
r18208 r18211 588 588 */ 589 589 public void setSelectedRelations(Collection<? extends IRelation<?>> sel) { 590 if ( sel != null && !sel.isEmpty()) {590 if (!Utils.isEmpty(sel)) { 591 591 if (!getVisibleRelations().containsAll(sel)) { 592 592 resetFilter(); -
trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java
r18066 r18211 75 75 import org.openstreetmap.josm.tools.Logging; 76 76 import org.openstreetmap.josm.tools.Shortcut; 77 import org.openstreetmap.josm.tools.Utils; 77 78 78 79 /** … … 953 954 } 954 955 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))) { 956 957 buttonsPanel = new JPanel(new GridLayout(buttons.size(), 1)); 957 958 for (Collection<SideButton> buttonRow : buttons) { -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/HelpAction.java
r17032 r18211 87 87 } 88 88 89 if ( type != null && !type.isEmpty()) {89 if (!Utils.isEmpty(type)) { 90 90 pages.add(String.format("%sRelation:%s", lang, type)); 91 91 pages.add(String.format("Relation:%s", type)); -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java
r17427 r18211 994 994 return presets.stream() 995 995 .map(preset -> preset.suggestRoleForOsmPrimitive(p)) 996 .filter(role -> role != null && !role.isEmpty())996 .filter(role -> !Utils.isEmpty(role)) 997 997 .collect(Collectors.toSet()); 998 998 } -
trunk/src/org/openstreetmap/josm/gui/download/BookmarkSelection.java
r18208 r18211 204 204 ); 205 205 b.setArea(currentArea); 206 if (b.getName() != null && !b.getName().isEmpty()) {206 if (!Utils.isEmpty(b.getName())) { 207 207 ((DefaultListModel<BookmarkList.Bookmark>) bookmarks.getModel()).addElement(b); 208 208 bookmarks.save(); -
trunk/src/org/openstreetmap/josm/gui/io/CloseChangesetDialog.java
r14153 r18211 12 12 import java.util.ArrayList; 13 13 import java.util.Collection; 14 import java.util.List;15 14 16 15 import javax.swing.AbstractAction; … … 32 31 import org.openstreetmap.josm.tools.ImageProvider; 33 32 import org.openstreetmap.josm.tools.InputMapUtils; 33 import org.openstreetmap.josm.tools.Utils; 34 34 35 35 /** … … 128 128 129 129 protected void refreshEnabledState() { 130 List<Changeset> list = lstOpenChangesets.getSelectedValuesList(); 131 setEnabled(list != null && !list.isEmpty()); 130 setEnabled(!Utils.isEmpty(lstOpenChangesets.getSelectedValuesList())); 132 131 } 133 132 -
trunk/src/org/openstreetmap/josm/gui/io/LayerNameAndFilePathTableCell.java
r18208 r18211 184 184 private String makePathFit(String t) { 185 185 boolean hasEllipsis = false; 186 while ( t != null && !t.isEmpty()) {186 while (!Utils.isEmpty(t)) { 187 187 int txtwidth = lblFilename.getFontMetrics(lblFilename.getFont()).stringWidth(t); 188 188 if (txtwidth < lblFilename.getWidth() || t.lastIndexOf(File.separator) < ELLIPSIS.length()) { -
trunk/src/org/openstreetmap/josm/gui/io/UploadParameterSummaryPanel.java
r17709 r18211 25 25 import org.openstreetmap.josm.tools.ImageProvider; 26 26 import org.openstreetmap.josm.tools.StreamUtils; 27 import org.openstreetmap.josm.tools.Utils; 27 28 28 29 /** … … 167 168 .orElse(""); 168 169 final String html = Stream.of(buildChangesetSummary(), buildChangesetSummary2(), buildStrategySummary(), server) 169 .filter(s -> s != null && !s.isEmpty())170 .filter(s -> !Utils.isEmpty(s)) 170 171 .collect(StreamUtils.toHtmlList()); 171 172 jepMessage.setText(html); -
trunk/src/org/openstreetmap/josm/gui/layer/NoteLayer.java
r18208 r18211 312 312 String commentText = comment.getText(); 313 313 //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)) { 315 315 sb.append("<hr/>"); 316 316 String userName = XmlWriter.encode(comment.getUser().getName()); -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageDisplay.java
r18150 r18211 40 40 import org.openstreetmap.josm.tools.ImageProcessor; 41 41 import org.openstreetmap.josm.tools.Logging; 42 import org.openstreetmap.josm.tools.Utils; 42 43 43 44 /** … … 792 793 errorMessage = null; 793 794 } 794 if (errorMessage != null && !errorMessage.trim().isEmpty()) {795 if (!Utils.isBlank(errorMessage)) { 795 796 Rectangle2D errorStringSize = g.getFontMetrics(g.getFont()).getStringBounds(errorMessage, g); 796 797 if (Boolean.TRUE.equals(ERROR_MESSAGE_BACKGROUND.get())) { -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/ConvertFromGpxLayerAction.java
r18208 r18211 157 157 for (GpxExtension ext : exts) { 158 158 String value = ext.getValue(); 159 if ( value != null && !value.isEmpty()) {159 if (!Utils.isEmpty(value)) { 160 160 String extpre = "extension:"; 161 161 String pre = ext.getPrefix(); -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/ImportAudioAction.java
r16953 r18211 124 124 private void importAudio(File audioFile, MarkerLayer ml, double firstStartTime, Markers markers) { 125 125 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); 128 128 Collection<WayPoint> waypoints = new ArrayList<>(); 129 129 boolean timedMarkersOmitted = false; -
trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceTabbedPane.java
r17865 r18211 437 437 final Set<PluginInformation> toDownload = preference.getPluginsScheduledForUpdateOrDownload(); 438 438 final PluginDownloadTask task; 439 if (toDownload != null && !toDownload.isEmpty()) {439 if (!Utils.isEmpty(toDownload)) { 440 440 task = new PluginDownloadTask(this, toDownload, tr("Download plugins")); 441 441 } else { -
trunk/src/org/openstreetmap/josm/gui/preferences/advanced/ListEditor.java
r16960 r18211 21 21 import org.openstreetmap.josm.tools.GBC; 22 22 import org.openstreetmap.josm.tools.SubclassFilteredCollection; 23 import org.openstreetmap.josm.tools.Utils; 23 24 24 25 /** … … 44 45 @Override 45 46 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))); 47 48 } 48 49 -
trunk/src/org/openstreetmap/josm/gui/preferences/display/GPXSettingsPanel.java
r18208 r18211 696 696 putPref("colormode.heatmap.lower-limit", colorTypeHeatMapLowerLimit.getValue()); 697 697 698 if (!global && layers != null && !layers.isEmpty()) {698 if (!global && !Utils.isEmpty(layers)) { 699 699 layers.forEach(l -> l.data.invalidate()); 700 700 } -
trunk/src/org/openstreetmap/josm/gui/preferences/imagery/ImageryProvidersPanel.java
r18208 r18211 369 369 int viewIndex = defaultTable.convertRowIndexToView(i); 370 370 List<Shape> shapes = bounds.getShapes(); 371 if ( shapes != null && !shapes.isEmpty()) {371 if (!Utils.isEmpty(shapes)) { 372 372 if (defaultTable.getSelectionModel().isSelectedIndex(viewIndex)) { 373 373 if (!mapPolygons.containsKey(i)) { -
trunk/src/org/openstreetmap/josm/gui/preferences/map/MapPaintPreference.java
r17648 r18211 32 32 import org.openstreetmap.josm.tools.GBC; 33 33 import org.openstreetmap.josm.tools.Logging; 34 import org.openstreetmap.josm.tools.Utils; 34 35 35 36 /** … … 169 170 final MapCSSStyleSource css = new MapCSSStyleSource(entry); 170 171 css.loadStyleSource(); 171 if (css.title != null && !css.title.isEmpty()) {172 if (!Utils.isEmpty(css.title)) { 172 173 return css.title; 173 174 } -
trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginListPanel.java
r18208 r18211 137 137 final PluginCheckBox cbPlugin = new PluginCheckBox(pi, selected, this, model); 138 138 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)) { 140 140 pluginText += tr(" (requires: {0})", pi.requires); 141 141 } -
trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreference.java
r17784 r18211 63 63 import org.openstreetmap.josm.tools.ImageProvider; 64 64 import org.openstreetmap.josm.tools.Logging; 65 import org.openstreetmap.josm.tools.Utils; 65 66 66 67 /** … … 556 557 JOptionPane.QUESTION_MESSAGE 557 558 ); 558 if ( s != null && !s.isEmpty()) {559 if (!Utils.isEmpty(s)) { 559 560 model.addElement(s); 560 561 } … … 582 583 list.getSelectedValue() 583 584 ); 584 if ( s != null && !s.isEmpty()) {585 if (!Utils.isEmpty(s)) { 585 586 model.setElementAt(s, list.getSelectedIndex()); 586 587 } -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/CodeProjectionChoice.java
r13544 r18211 16 16 import org.openstreetmap.josm.data.projection.Projection; 17 17 import org.openstreetmap.josm.data.projection.Projections; 18 import org.openstreetmap.josm.tools.Utils; 18 19 19 20 /** … … 78 79 @Override 79 80 public void setPreferences(Collection<String> args) { 80 if ( args != null && !args.isEmpty()) {81 if (!Utils.isEmpty(args)) { 81 82 code = args.iterator().next(); 82 83 } -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/CustomProjectionChoice.java
r18173 r18211 31 31 import org.openstreetmap.josm.tools.ImageProvider; 32 32 import org.openstreetmap.josm.tools.Logging; 33 import org.openstreetmap.josm.tools.Utils; 33 34 34 35 /** … … 187 188 @Override 188 189 public void setPreferences(Collection<String> args) { 189 if ( args != null && !args.isEmpty()) {190 if (!Utils.isEmpty(args)) { 190 191 pref = args.iterator().next(); 191 192 } -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/ListProjectionChoice.java
r16553 r18211 70 70 public void setPreferences(Collection<String> args) { 71 71 String zone = null; 72 if ( args != null && !args.isEmpty()) {72 if (!Utils.isEmpty(args)) { 73 73 zone = args.iterator().next(); 74 74 } -
trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionManager.java
r18170 r18211 291 291 CheckParameterUtil.ensureParameterNotNull(list, "list"); 292 292 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)) { 294 294 for (TaggingPreset tp : presets) { 295 295 if (tp.roles != null) { … … 481 481 tagCache = null; 482 482 roleCache = null; 483 ds = null; 483 ds = null; 484 484 } 485 485 } -
trunk/src/org/openstreetmap/josm/gui/widgets/AbstractIdTextField.java
r18170 r18211 6 6 import org.openstreetmap.josm.gui.datatransfer.ClipboardUtils; 7 7 import org.openstreetmap.josm.tools.Logging; 8 import org.openstreetmap.josm.tools.Utils; 8 9 9 10 /** … … 80 81 */ 81 82 public boolean tryToPasteFrom(String contents) { 82 if (contents != null && !contents.trim().isEmpty()) {83 if (!Utils.isBlank(contents)) { 83 84 setText(contents.trim()); 84 85 clearTextIfInvalid(); -
trunk/src/org/openstreetmap/josm/gui/widgets/ChangesetIdTextField.java
r14930 r18211 7 7 8 8 import org.openstreetmap.josm.tools.Logging; 9 import org.openstreetmap.josm.tools.Utils; 9 10 10 11 /** … … 74 75 public boolean readChangesetId() { 75 76 String value = getComponent().getText(); 76 if ( value != null && !value.trim().isEmpty()) {77 if (!Utils.isBlank(value)) { 77 78 value = value.trim(); 78 79 id = 0; -
trunk/src/org/openstreetmap/josm/gui/widgets/EditableList.java
r16438 r18211 20 20 import org.openstreetmap.josm.gui.MainApplication; 21 21 import org.openstreetmap.josm.tools.GBC; 22 import org.openstreetmap.josm.tools.Utils; 22 23 23 24 /** … … 66 67 title, 67 68 JOptionPane.QUESTION_MESSAGE); 68 if ( source != null && !source.isEmpty()) {69 if (!Utils.isEmpty(source)) { 69 70 ((DefaultListModel<String>) sourcesList.getModel()).addElement(source); 70 71 } … … 81 82 if (sourcesList.getModel().getSize() == 0) { 82 83 String source1 = JOptionPane.showInputDialog(MainApplication.getMainFrame(), title, title, JOptionPane.QUESTION_MESSAGE); 83 if ( source1 != null && !source1.isEmpty()) {84 if (!Utils.isEmpty(source1)) { 84 85 ((DefaultListModel<String>) sourcesList.getModel()).addElement(source1); 85 86 } … … 98 99 JOptionPane.QUESTION_MESSAGE, null, null, 99 100 sourcesList.getSelectedValue()); 100 if ( source2 != null && !source2.isEmpty()) {101 if (!Utils.isEmpty(source2)) { 101 102 ((DefaultListModel<String>) sourcesList.getModel()).setElementAt(source2, row); 102 103 } -
trunk/src/org/openstreetmap/josm/gui/widgets/JosmTextField.java
r17768 r18211 20 20 import org.openstreetmap.josm.gui.MapFrame; 21 21 import org.openstreetmap.josm.tools.Destroyable; 22 import org.openstreetmap.josm.tools.Utils; 22 23 23 24 /** … … 192 193 icon.paintIcon(this, g, Math.min(leftInsets, h / 2), h / 2); 193 194 } 194 if ( hint != null && !hint.isEmpty() && getText().isEmpty() && !isFocusOwner()) {195 if (!Utils.isEmpty(hint) && getText().isEmpty() && !isFocusOwner()) { 195 196 // Taken from http://stackoverflow.com/a/24571681/2257172 196 197 int h = getHeight(); -
trunk/src/org/openstreetmap/josm/gui/widgets/UrlLabel.java
r17605 r18211 92 92 93 93 protected final void refresh() { 94 if ( url != null && !url.isEmpty()) {94 if (!Utils.isEmpty(url)) { 95 95 refresh("<html><a color=\"" + JosmEditorPane.getLinkColor() + "\" href=\"" + url + "\">" + description + "</a></html>", 96 96 Cursor.getPredefinedCursor(Cursor.HAND_CURSOR), … … 147 147 @Override 148 148 public void mouseClicked(MouseEvent e) { 149 if ( url != null && !url.isEmpty()) {149 if (!Utils.isEmpty(url)) { 150 150 if (SwingUtilities.isLeftMouseButton(e)) { 151 151 OpenBrowser.displayUrl(url); -
trunk/src/org/openstreetmap/josm/io/DefaultProxySelector.java
r14273 r18211 142 142 httpProxySocketAddress = null; 143 143 if (proxyPolicy == ProxyPolicy.USE_HTTP_PROXY) { 144 if ( host != null && !host.trim().isEmpty() && port > 0) {144 if (!Utils.isBlank(host) && port > 0) { 145 145 httpProxySocketAddress = new InetSocketAddress(host, port); 146 146 } else { … … 154 154 socksProxySocketAddress = null; 155 155 if (proxyPolicy == ProxyPolicy.USE_SOCKS_PROXY) { 156 if ( host != null && !host.trim().isEmpty() && port > 0) {156 if (!Utils.isBlank(host) && port > 0) { 157 157 socksProxySocketAddress = new InetSocketAddress(host, port); 158 158 } else { -
trunk/src/org/openstreetmap/josm/io/GpxReader.java
r18051 r18211 32 32 import org.openstreetmap.josm.tools.Logging; 33 33 import org.openstreetmap.josm.tools.UncheckedParseException; 34 import org.openstreetmap.josm.tools.Utils; 34 35 import org.openstreetmap.josm.tools.XmlUtils; 35 36 import org.openstreetmap.josm.tools.date.DateUtils; … … 661 662 message += '.'; 662 663 } 663 if (parser.data.creator != null && !parser.data.creator.trim().isEmpty()) {664 if (!Utils.isBlank(parser.data.creator)) { 664 665 message += "\n" + tr("The file was created by \"{0}\".", parser.data.creator); 665 666 } -
trunk/src/org/openstreetmap/josm/io/GpxWriter.java
r18207 r18211 36 36 import org.openstreetmap.josm.tools.JosmRuntimeException; 37 37 import org.openstreetmap.josm.tools.Logging; 38 import org.openstreetmap.josm.tools.Utils; 38 39 39 40 /** … … 134 135 135 136 for (XMLNamespace n : namespaces) { 136 if (n.getURI() != null && n.getPrefix() != null && !n.getPrefix().isEmpty()) {137 if (n.getURI() != null && !Utils.isEmpty(n.getPrefix())) { 137 138 out.println(String.format(" xmlns:%s=\"%s\"", n.getPrefix(), n.getURI())); 138 139 if (n.getLocation() != null) { … … 323 324 */ 324 325 private void simpleTag(String tag, String content) { 325 if ( content != null && !content.isEmpty()) {326 if (!Utils.isEmpty(content)) { 326 327 open(tag); 327 328 out.print(encode(content)); … … 332 333 333 334 private void simpleTag(String tag, String content, String attributes) { 334 if ( content != null && !content.isEmpty()) {335 if (!Utils.isEmpty(content)) { 335 336 open(tag, attributes); 336 337 out.print(encode(content)); -
trunk/src/org/openstreetmap/josm/io/MessageNotifier.java
r17333 r18211 149 149 String username = Config.getPref().get("osm-server.username", null); 150 150 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); 152 152 } 153 153 } else { … … 157 157 String username = credentials.getUsername(); 158 158 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; 160 160 } 161 161 } -
trunk/src/org/openstreetmap/josm/io/OsmApiException.java
r18208 r18211 218 218 sb.append(tr("The server replied an error with code {0}.", responseCode)); 219 219 } else { 220 if ( header != null && !header.isEmpty()) {220 if (!Utils.isEmpty(header)) { 221 221 sb.append(tr(header)); 222 222 } 223 if ( body != null && !body.isEmpty() && !body.equals(header)) {223 if (!Utils.isEmpty(body) && !body.equals(header)) { 224 224 if (sb.length() > 0) { 225 225 sb.append(". "); -
trunk/src/org/openstreetmap/josm/io/OsmChangeReader.java
r14314 r18211 16 16 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 17 17 import org.openstreetmap.josm.tools.Pair; 18 import org.openstreetmap.josm.tools.Utils; 18 19 19 20 /** … … 122 123 } 123 124 } 124 if (location != null && text != null && !text.isEmpty()) {125 if (location != null && !Utils.isEmpty(text)) { 125 126 noteData.createNote(location, text); 126 127 } -
trunk/src/org/openstreetmap/josm/io/OverpassDownloadReader.java
r17988 r18211 265 265 boolean javaDur = false; 266 266 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)); 269 269 duration = 'P' + matcher.group(1).replace('X', 'M') + matcher.group(2); 270 270 if (javaDur) { -
trunk/src/org/openstreetmap/josm/io/auth/CredentialsManager.java
r15757 r18211 12 12 import org.openstreetmap.josm.tools.CheckParameterUtil; 13 13 import org.openstreetmap.josm.tools.Logging; 14 import org.openstreetmap.josm.tools.Utils; 14 15 15 16 /** … … 128 129 if (requestorType == RequestorType.SERVER && Objects.equals(OsmApi.getOsmApi().getHost(), host)) { 129 130 String username = credentials.getUserName(); 130 if (username != null && !username.trim().isEmpty()) {131 if (!Utils.isBlank(username)) { 131 132 UserIdentityManager.getInstance().setPartiallyIdentified(username); 132 133 } -
trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java
r16630 r18211 705 705 String name, List<LayerDetails> selectedLayers, List<String> selectedStyles, String format, boolean transparent) { 706 706 ImageryInfo i = new ImageryInfo(name, buildGetMapUrl(selectedLayers, selectedStyles, format, transparent)); 707 if ( selectedLayers != null &&!selectedLayers.isEmpty()) {707 if (!selectedLayers.isEmpty()) { 708 708 i.setServerProjections(getServerProjections(selectedLayers)); 709 709 } -
trunk/src/org/openstreetmap/josm/io/remotecontrol/RequestProcessor.java
r17656 r18211 456 456 usage.append("<li>") 457 457 .append(handler.getKey()); 458 if (sample.getUsage() != null && !sample.getUsage().isEmpty()) {458 if (!Utils.isEmpty(sample.getUsage())) { 459 459 usage.append(" — <i>").append(sample.getUsage()).append("</i>"); 460 460 } -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/ImportHandler.java
r16324 r18211 86 86 // For user-friendliness, let's try to decode these OSM API calls to give a better confirmation message. 87 87 Set<String> taskMessages = new LinkedHashSet<>(); 88 if (suitableDownloadTasks != null && !suitableDownloadTasks.isEmpty()) {88 if (!Utils.isEmpty(suitableDownloadTasks)) { 89 89 for (DownloadTask task : suitableDownloadTasks) { 90 90 taskMessages.add(Utils.firstNonNull(task.getConfirmationMessage(url), url.toString())); -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java
r18208 r18211 343 343 private <T> T get(String key, Function<String, T> parser, Supplier<T> defaultSupplier) { 344 344 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(); 346 346 } 347 347 -
trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
r18201 r18211 1141 1141 plugins = buildListOfPluginsToLoad(parent, monitor.createSubTaskMonitor(1, false)); 1142 1142 // If only some plugins have to be updated, filter the list 1143 if (pluginsWanted != null && !pluginsWanted.isEmpty()) {1143 if (!Utils.isEmpty(pluginsWanted)) { 1144 1144 final Collection<String> pluginsWantedName = Utils.transform(pluginsWanted, piw -> piw.name); 1145 1145 plugins = SubclassFilteredCollection.filter(plugins, pi -> pluginsWantedName.contains(pi.name)); … … 1594 1594 PluginInformation pi = pp.getPluginInformation(); 1595 1595 pl.remove(pi.name); 1596 pl.add(pi.name + " (" + (pi.localversion != null && !pi.localversion.isEmpty()1596 pl.add(pi.name + " (" + (!Utils.isEmpty(pi.localversion) 1597 1597 ? pi.localversion : "unknown") + ')'); 1598 1598 } … … 1608 1608 for (final PluginInformation info : getPlugins()) { 1609 1609 String name = info.name 1610 + (info.localversion != null && !info.localversion.isEmpty() ? " Version: " + info.localversion : "");1610 + (!Utils.isEmpty(info.localversion) ? " Version: " + info.localversion : ""); 1611 1611 pluginTab.add(new JLabel(name), GBC.std()); 1612 1612 pluginTab.add(Box.createHorizontalGlue(), GBC.std().fill(GBC.HORIZONTAL)); -
trunk/src/org/openstreetmap/josm/plugins/PluginInformation.java
r17573 r18211 261 261 stage = stageStr == null ? 50 : Integer.parseInt(stageStr); 262 262 version = attr.getValue("Plugin-Version"); 263 if ( version != null && !version.isEmpty() && version.charAt(0) == '$') {263 if (!Utils.isEmpty(version) && version.charAt(0) == '$') { 264 264 invalidManifestEntries.add("Plugin-Version"); 265 265 } -
trunk/src/org/openstreetmap/josm/plugins/ReadRemotePluginInformationTask.java
r18208 r18211 225 225 } 226 226 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)) { 228 228 panel.add(new JLabel(tr("Details:")), GBC.eol().insets(0, 0, 0, 10)); 229 229 JosmTextArea area = new JosmTextArea(details); -
trunk/src/org/openstreetmap/josm/tools/ExceptionUtil.java
r18208 r18211 313 313 String msg = e.getDisplayMessage(); 314 314 315 if ( msg != null && !msg.isEmpty()) {315 if (!Utils.isEmpty(msg)) { 316 316 return tr("<html>" 317 317 + "Authorisation at the OSM server failed.<br>" -
trunk/src/org/openstreetmap/josm/tools/HttpClient.java
r17076 r18211 147 147 } 148 148 cr = performConnection(); 149 final boolean hasReason = reasonForRequest != null && !reasonForRequest.isEmpty();149 final boolean hasReason = !Utils.isEmpty(reasonForRequest); 150 150 logRequest("{0} {1}{2} -> {3} {4} ({5}{6})", 151 151 getRequestMethod(), getURL(), hasReason ? (" (" + reasonForRequest + ')') : "", -
trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
r18178 r18211 898 898 String cacheName = prefix + fullName; 899 899 /* cache separately */ 900 if ( dirs != null && !dirs.isEmpty()) {900 if (!Utils.isEmpty(dirs)) { 901 901 cacheName = "id:" + id + ':' + fullName; 902 902 if (archive != null) { … … 1956 1956 public String toString() { 1957 1957 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 + ", " 1960 1960 + (archive != null ? "archive=" + archive + ", " : "") 1961 + (inArchiveDir != null && !inArchiveDir.isEmpty() ? "inArchiveDir=" + inArchiveDir : "") + ']').replaceAll(", \\]", "]");1961 + (!Utils.isEmpty(inArchiveDir) ? "inArchiveDir=" + inArchiveDir : "") + ']').replaceAll(", \\]", "]"); 1962 1962 } 1963 1963 } -
trunk/src/org/openstreetmap/josm/tools/LanguageInfo.java
r17787 r18211 306 306 if (c.isEmpty()) 307 307 c = null; 308 if ( v != null && !v.isEmpty()) {308 if (!Utils.isEmpty(v)) { 309 309 if (c != null) 310 310 list.add(lang+'_'+c+'@'+v); -
trunk/src/org/openstreetmap/josm/tools/PlatformHookUnixoid.java
r17679 r18211 156 156 try { 157 157 String version = Utils.execOutput(Arrays.asList(args)); 158 if ( version != null && !version.isEmpty()) {158 if (!Utils.isEmpty(version)) { 159 159 return packageName + ':' + version; 160 160 } … … 240 240 // see https://www.linuxbase.org/lsb-cert/productdir.php?by_prod ) 241 241 String line = exec("lsb_release", "-ds"); 242 if ( line != null && !line.isEmpty()) {242 if (!Utils.isEmpty(line)) { 243 243 line = line.replaceAll("\"+", ""); 244 244 line = line.replace("NAME=", ""); // strange code for some Gentoo's … … 262 262 }) { 263 263 String description = info.extractDescription(); 264 if (description != null && !description.isEmpty()) {264 if (!Utils.isEmpty(description)) { 265 265 return "Linux " + description; 266 266 } … … 356 356 } 357 357 // Append prefix if any 358 if ( result != null && !result.isEmpty() && prefix != null && !prefix.isEmpty()) {358 if (!Utils.isEmpty(result) && !Utils.isEmpty(prefix)) { 359 359 result = prefix + result; 360 360 } … … 390 390 } else { 391 391 String xdgCacheDir = getSystemEnv("XDG_CACHE_HOME"); 392 if (xdgCacheDir != null && !xdgCacheDir.isEmpty()) {392 if (!Utils.isEmpty(xdgCacheDir)) { 393 393 return new File(xdgCacheDir, Preferences.getJOSMDirectoryBaseName()); 394 394 } else { … … 405 405 } else { 406 406 String xdgConfigDir = getSystemEnv("XDG_CONFIG_HOME"); 407 if (xdgConfigDir != null && !xdgConfigDir.isEmpty()) {407 if (!Utils.isEmpty(xdgConfigDir)) { 408 408 return new File(xdgConfigDir, Preferences.getJOSMDirectoryBaseName()); 409 409 } else { … … 420 420 } else { 421 421 String xdgDataDir = getSystemEnv("XDG_DATA_HOME"); 422 if (xdgDataDir != null && !xdgDataDir.isEmpty()) {422 if (!Utils.isEmpty(xdgDataDir)) { 423 423 return new File(xdgDataDir, Preferences.getJOSMDirectoryBaseName()); 424 424 } else { -
trunk/src/org/openstreetmap/josm/tools/template_engine/ContextSwitchTemplate.java
r16493 r18211 23 23 import org.openstreetmap.josm.data.osm.search.SearchCompiler.Or; 24 24 import org.openstreetmap.josm.data.osm.search.SearchCompiler.Parent; 25 import org.openstreetmap.josm.tools.Utils; 25 26 26 27 /** … … 369 370 if (dataProvider instanceof OsmPrimitive) { 370 371 List<OsmPrimitive> primitives = context.getPrimitives((OsmPrimitive) dataProvider); 371 if (primitives != null && !primitives.isEmpty()) {372 if (!Utils.isEmpty(primitives)) { 372 373 template.appendText(result, primitives.get(0)); 373 374 } … … 380 381 if (dataProvider instanceof OsmPrimitive) { 381 382 List<OsmPrimitive> primitives = context.getPrimitives((OsmPrimitive) dataProvider); 382 if (primitives != null && !primitives.isEmpty()) {383 if (!Utils.isEmpty(primitives)) { 383 384 return template.isValid(primitives.get(0)); 384 385 }
Note:
See TracChangeset
for help on using the changeset viewer.