mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-25 14:55:55 +01:00
[insteon] remove dependency on org.apache.commons.lang.StringUtils (#8630)
Signed-off-by: Rob Nielsen <rob.nielsen@yahoo.com>
This commit is contained in:
parent
817e02b53f
commit
3abe27b224
@ -23,7 +23,6 @@ import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Base64;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.openhab.binding.insteon.internal.driver.IOStream;
|
||||
@ -213,7 +212,7 @@ public class HubIOStream extends IOStream implements Runnable {
|
||||
return; // XXX why return here????
|
||||
}
|
||||
|
||||
if (StringUtils.repeat("0", data.length()).equals(data)) {
|
||||
if (allZeros(data)) {
|
||||
logger.trace("skip cleared buffer");
|
||||
bufferIdx = 0;
|
||||
return;
|
||||
@ -223,7 +222,7 @@ public class HubIOStream extends IOStream implements Runnable {
|
||||
if (nIdx < bufferIdx) {
|
||||
String msgStart = data.substring(bufferIdx, data.length());
|
||||
String msgEnd = data.substring(0, nIdx);
|
||||
if (StringUtils.repeat("0", msgStart.length()).equals(msgStart)) {
|
||||
if (allZeros(msgStart)) {
|
||||
logger.trace("discard cleared buffer wrap around msg start");
|
||||
msgStart = "";
|
||||
}
|
||||
@ -241,6 +240,10 @@ public class HubIOStream extends IOStream implements Runnable {
|
||||
bufferIdx = nIdx;
|
||||
}
|
||||
|
||||
private boolean allZeros(String s) {
|
||||
return "0".repeat(s.length()).equals(s);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to fetch url from http server
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user