diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapillary/MapillaryKeyListener.java b/src/main/java/org/openstreetmap/josm/plugins/mapillary/MapillaryKeyListener.java index 2ad34901d..9ecf4e8d8 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapillary/MapillaryKeyListener.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapillary/MapillaryKeyListener.java @@ -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); diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapillary/gui/dialog/TrafficSignFilter.java b/src/main/java/org/openstreetmap/josm/plugins/mapillary/gui/dialog/TrafficSignFilter.java index 59774e830..2675053a8 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapillary/gui/dialog/TrafficSignFilter.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapillary/gui/dialog/TrafficSignFilter.java @@ -401,7 +401,7 @@ private static void updateNearbyOsmKey(Collection 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); } }); diff --git a/src/main/java/org/openstreetmap/josm/plugins/mapillary/spi/preferences/ApiKeyReader.java b/src/main/java/org/openstreetmap/josm/plugins/mapillary/spi/preferences/ApiKeyReader.java index 4c576b79e..47387d93f 100644 --- a/src/main/java/org/openstreetmap/josm/plugins/mapillary/spi/preferences/ApiKeyReader.java +++ b/src/main/java/org/openstreetmap/josm/plugins/mapillary/spi/preferences/ApiKeyReader.java @@ -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 diff --git a/test/unit/org/openstreetmap/josm/plugins/mapillary/testutils/annotations/MapillaryURLWireMock.java b/test/unit/org/openstreetmap/josm/plugins/mapillary/testutils/annotations/MapillaryURLWireMock.java index 8bca5bcb9..f1100a436 100644 --- a/test/unit/org/openstreetmap/josm/plugins/mapillary/testutils/annotations/MapillaryURLWireMock.java +++ b/test/unit/org/openstreetmap/josm/plugins/mapillary/testutils/annotations/MapillaryURLWireMock.java @@ -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; @@ -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() + "/"); @@ -307,7 +308,7 @@ public Response transform(Response response, ServeEvent serveEvent) { if (request.queryParameter("fields").isPresent()) { final List 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();