From 80cb1ed2514b97a8f0cc76d0ab8bc9cf934d4570 Mon Sep 17 00:00:00 2001 From: mlobstein Date: Sun, 27 Mar 2022 05:39:02 -0500 Subject: [PATCH] [denonmarantz] Remove Apache StringUtils (#12526) Signed-off-by: Michael Lobstein --- .../connector/telnet/DenonMarantzTelnetConnector.java | 9 ++++----- .../internal/xml/adapters/StringAdapter.java | 4 +--- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/bundles/org.openhab.binding.denonmarantz/src/main/java/org/openhab/binding/denonmarantz/internal/connector/telnet/DenonMarantzTelnetConnector.java b/bundles/org.openhab.binding.denonmarantz/src/main/java/org/openhab/binding/denonmarantz/internal/connector/telnet/DenonMarantzTelnetConnector.java index 589c87ee2a98f..2d1a14b82b38b 100644 --- a/bundles/org.openhab.binding.denonmarantz/src/main/java/org/openhab/binding/denonmarantz/internal/connector/telnet/DenonMarantzTelnetConnector.java +++ b/bundles/org.openhab.binding.denonmarantz/src/main/java/org/openhab/binding/denonmarantz/internal/connector/telnet/DenonMarantzTelnetConnector.java @@ -20,7 +20,6 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.regex.Pattern; -import org.apache.commons.lang3.StringUtils; import org.openhab.binding.denonmarantz.internal.DenonMarantzState; import org.openhab.binding.denonmarantz.internal.config.DenonMarantzConfiguration; import org.openhab.binding.denonmarantz.internal.connector.DenonMarantzConnector; @@ -166,7 +165,7 @@ public void receivedLine(String line) { state.setSurroundProgram(value); break; case "MV": // Main zone volume - if (StringUtils.isNumeric(value)) { + if (value.chars().allMatch(Character::isDigit)) { state.setMainVolume(fromDenonValue(value)); } break; @@ -183,7 +182,7 @@ public void receivedLine(String line) { state.setZone2Power(value.equals("ON")); } else if (value.equals("MUON") || value.equals("MUOFF")) { state.setZone2Mute(value.equals("MUON")); - } else if (StringUtils.isNumeric(value)) { + } else if (value.chars().allMatch(Character::isDigit)) { state.setZone2Volume(fromDenonValue(value)); } else { state.setZone2Input(value); @@ -194,7 +193,7 @@ public void receivedLine(String line) { state.setZone3Power(value.equals("ON")); } else if (value.equals("MUON") || value.equals("MUOFF")) { state.setZone3Mute(value.equals("MUON")); - } else if (StringUtils.isNumeric(value)) { + } else if (value.chars().allMatch(Character::isDigit)) { state.setZone3Volume(fromDenonValue(value)); } else { state.setZone3Input(value); @@ -205,7 +204,7 @@ public void receivedLine(String line) { state.setZone4Power(value.equals("ON")); } else if (value.equals("MUON") || value.equals("MUOFF")) { state.setZone4Mute(value.equals("MUON")); - } else if (StringUtils.isNumeric(value)) { + } else if (value.chars().allMatch(Character::isDigit)) { state.setZone4Volume(fromDenonValue(value)); } else { state.setZone4Input(value); diff --git a/bundles/org.openhab.binding.denonmarantz/src/main/java/org/openhab/binding/denonmarantz/internal/xml/adapters/StringAdapter.java b/bundles/org.openhab.binding.denonmarantz/src/main/java/org/openhab/binding/denonmarantz/internal/xml/adapters/StringAdapter.java index 25a5dc88a1dc0..24255eaba4641 100644 --- a/bundles/org.openhab.binding.denonmarantz/src/main/java/org/openhab/binding/denonmarantz/internal/xml/adapters/StringAdapter.java +++ b/bundles/org.openhab.binding.denonmarantz/src/main/java/org/openhab/binding/denonmarantz/internal/xml/adapters/StringAdapter.java @@ -14,8 +14,6 @@ import javax.xml.bind.annotation.adapters.XmlAdapter; -import org.apache.commons.lang3.StringUtils; - /** * Adapter to clean up string values * @@ -27,7 +25,7 @@ public class StringAdapter extends XmlAdapter { public String unmarshal(String v) throws Exception { String val = v; if (val != null) { - val = StringUtils.trimToEmpty(val); + return val.trim(); } return val; }