Skip to content

Commit

Permalink
See #23671: Deprecate Utils#isBlank and replace instances of it with …
Browse files Browse the repository at this point in the history
…Utils#isStripEmpty

As noted in r19079, the two functions were identical in behavior.
  • Loading branch information
tsmock committed May 14, 2024
1 parent 6ff61bf commit f16972a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void popupMenuCanceled(PopupMenuEvent e) {
}

private void addAction(JPopupMenu popup, String key, String value) {
if (Utils.isBlank(value) || !MapillaryLayer.hasInstance()) {
if (Utils.isStripEmpty(value) || !MapillaryLayer.hasInstance()) {
return;
}
String lowerKey = key.toLowerCase(Locale.ENGLISH);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ private static void updateNearbyOsmKey(Collection<? extends IPrimitive> primitiv
.map(OsmDataLayer::getDataSet).flatMap(d -> d.searchPrimitives(searchBBox).stream())
.filter(pr -> !pr.isDeleted()).filter(pr -> tagMapIsSubset(pr.getKeys(), tags))
.map(o -> o.getOsmPrimitiveId().toString()).collect(Collectors.joining(";"));
if (!Utils.isBlank(nearby)) {
if (!Utils.isStripEmpty(nearby)) {
p.put(NEARBY_KEY, nearby);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ static String readValue(final String key) {
return System.getProperty(key);
}
// Then check if there was something stored in JOSM preferences
if (Config.getPref() != null && !Utils.isBlank(Config.getPref().get("mapillary.api." + key))) {
if (Config.getPref() != null && !Utils.isStripEmpty(Config.getPref().get("mapillary.api." + key))) {
return Config.getPref().get("mapillary.api." + key);
}
// Then check and see if the api key file has the key
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.plugins.mapillary.testutils.annotations;

import static java.util.function.Predicate.not;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.fail;

Expand Down Expand Up @@ -274,7 +275,7 @@ public Response transform(Response response, ServeEvent serveEvent) {
return response;
}
final String origBody = response.getBodyAsString();
if (Utils.isBlank(origBody)) {
if (Utils.isStripEmpty(origBody)) {
return response;
}
String newBody = origBody.replaceAll("https?://.*?/", server.baseUrl() + "/");
Expand Down Expand Up @@ -307,7 +308,7 @@ public Response transform(Response response, ServeEvent serveEvent) {
if (request.queryParameter("fields").isPresent()) {
final List<String> fields = request.queryParameter("fields").values().stream()
.flatMap(string -> Stream.of(string.split(",", -1))).filter(Objects::nonNull)
.filter(string -> !Utils.isStripEmpty(string)).collect(Collectors.toList());
.filter(not(Utils::isStripEmpty)).collect(Collectors.toList());
try (JsonReader reader = Json
.createReader(new ByteArrayInputStream(newBody.getBytes(StandardCharsets.UTF_8)))) {
final JsonValue jsonValue = reader.readValue();
Expand Down

0 comments on commit f16972a

Please sign in to comment.