From 6c734e14f7fd94ab49f57c8884492e9a1e7a684c Mon Sep 17 00:00:00 2001 From: lsiepel Date: Sun, 23 Jun 2024 14:30:22 +0200 Subject: [PATCH] Remove apache commons (#16920) Signed-off-by: Leo Siepel --- .../java/org/openhab/io/neeo/internal/TokenSearch.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bundles/org.openhab.io.neeo/src/main/java/org/openhab/io/neeo/internal/TokenSearch.java b/bundles/org.openhab.io.neeo/src/main/java/org/openhab/io/neeo/internal/TokenSearch.java index b9e51e97f1c61..177295646464d 100644 --- a/bundles/org.openhab.io.neeo/src/main/java/org/openhab/io/neeo/internal/TokenSearch.java +++ b/bundles/org.openhab.io.neeo/src/main/java/org/openhab/io/neeo/internal/TokenSearch.java @@ -19,7 +19,6 @@ import java.util.Objects; import java.util.stream.Collectors; -import org.apache.commons.lang3.StringUtils; import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.NonNullByDefault; import org.openhab.core.addon.AddonInfo; @@ -27,6 +26,7 @@ import org.openhab.core.thing.type.ThingType; import org.openhab.io.neeo.internal.models.NeeoDevice; import org.openhab.io.neeo.internal.models.TokenScore; +import org.openhab.io.neeo.internal.util.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -91,8 +91,7 @@ public Result search(String query) { NeeoUtil.requireNotEmpty(query, "query cannot be empty"); final List> results = new ArrayList<>(); - - final String[] needles = StringUtils.split(query, DELIMITER); + final String[] needles = StringUtils.split(query, String.valueOf(DELIMITER)); int maxScore = -1; for (NeeoDevice device : context.getDefinitions().getExposed()) { @@ -142,7 +141,8 @@ public Result search(String query) { * @return the score of the match */ private int search(String haystack, String[] needles) { - return Arrays.stream(StringUtils.split(haystack, DELIMITER)).mapToInt(hs -> searchAlgorithm(hs, needles)).sum(); + return Arrays.stream(StringUtils.split(haystack, String.valueOf(DELIMITER))) + .mapToInt(hs -> searchAlgorithm(hs, needles)).sum(); } /**