Avoid star imports and add missing braces (#10521)
Fixes the following SAT findings: * AvoidStarImportCheck (125) * NeedBracesCheck (39) Signed-off-by: Wouter Born <github@maindrain.net>
This commit is contained in:
@@ -15,7 +15,11 @@ package org.openhab.binding.unifiedremote.internal;
|
||||
import static org.openhab.binding.unifiedremote.internal.UnifiedRemoteBindingConstants.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.*;
|
||||
import java.net.DatagramPacket;
|
||||
import java.net.DatagramSocket;
|
||||
import java.net.InetAddress;
|
||||
import java.net.SocketException;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.text.ParseException;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
@@ -107,8 +111,9 @@ public class UnifiedRemoteDiscoveryService extends AbstractDiscoveryService {
|
||||
String host = receivePacket.getAddress().getHostAddress();
|
||||
String reply = new String(receivePacket.getData()).replaceAll("[\\p{C}]", NON_PRINTABLE_CHARTS_REPLACEMENT)
|
||||
.replaceAll("[^\\x00-\\x7F]", NON_PRINTABLE_CHARTS_REPLACEMENT);
|
||||
if (!reply.startsWith(DISCOVERY_RESPONSE_PREFIX))
|
||||
if (!reply.startsWith(DISCOVERY_RESPONSE_PREFIX)) {
|
||||
throw new ParseException("Bad discovery response prefix", 0);
|
||||
}
|
||||
String[] parts = Arrays
|
||||
.stream(reply.replace(DISCOVERY_RESPONSE_PREFIX, "").split(NON_PRINTABLE_CHARTS_REPLACEMENT))
|
||||
.filter((String e) -> e.length() != 0).toArray(String[]::new);
|
||||
|
||||
@@ -12,8 +12,7 @@
|
||||
*/
|
||||
package org.openhab.binding.unifiedremote.internal;
|
||||
|
||||
import static org.openhab.binding.unifiedremote.internal.UnifiedRemoteBindingConstants.MOUSE_CHANNEL;
|
||||
import static org.openhab.binding.unifiedremote.internal.UnifiedRemoteBindingConstants.SEND_KEY_CHANNEL;
|
||||
import static org.openhab.binding.unifiedremote.internal.UnifiedRemoteBindingConstants.*;
|
||||
|
||||
import java.net.ConnectException;
|
||||
import java.net.NoRouteToHostException;
|
||||
@@ -54,8 +53,9 @@ public class UnifiedRemoteHandler extends BaseThingHandler {
|
||||
@Override
|
||||
public void handleCommand(ChannelUID channelUID, Command command) {
|
||||
String channelId = channelUID.getId();
|
||||
if (!isLinked(channelId))
|
||||
if (!isLinked(channelId)) {
|
||||
return;
|
||||
}
|
||||
String stringCommand = command.toFullString();
|
||||
UnifiedRemoteConnection urConnection = connection;
|
||||
try {
|
||||
@@ -107,8 +107,9 @@ public class UnifiedRemoteHandler extends BaseThingHandler {
|
||||
connectionCheckerSchedule = scheduler.scheduleWithFixedDelay(() -> {
|
||||
try {
|
||||
UnifiedRemoteConnection urConnection = connection;
|
||||
if (urConnection == null)
|
||||
if (urConnection == null) {
|
||||
return;
|
||||
}
|
||||
ThingStatus status = thing.getStatus();
|
||||
if ((status == ThingStatus.OFFLINE || status == ThingStatus.UNKNOWN) && connection != null) {
|
||||
urConnection.authenticate();
|
||||
|
||||
Reference in New Issue
Block a user