mirror of
https://github.com/danieldemus/openhab-addons
synced 2026-07-29 12:34:21 +02:00
fix checkstyle (#21102)
Signed-off-by: Bernd Weymann <bernd.weymann@gmail.com>
This commit is contained in:
+1
-1
@@ -487,7 +487,7 @@ public class Authorization {
|
||||
|
||||
private String generateCodeVerifier(int size) {
|
||||
String verifierBytes = StringUtils.getRandomAlphanumeric(size);
|
||||
return Base64.getUrlEncoder().withoutPadding().encodeToString(verifierBytes.getBytes());
|
||||
return Base64.getUrlEncoder().withoutPadding().encodeToString(verifierBytes.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
public void addBasicHeaders(Request req) {
|
||||
|
||||
+2
-1
@@ -15,6 +15,7 @@ package org.openhab.binding.mercedesme.internal.api;
|
||||
import static org.openhab.binding.mercedesme.internal.Constants.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
@@ -149,7 +150,7 @@ public class RestApi extends Authorization {
|
||||
for (int i = 0; i < words.length; i++) {
|
||||
String word = words[i];
|
||||
word = word.isEmpty() ? word
|
||||
: Character.toUpperCase(word.charAt(0)) + word.substring(1).toLowerCase();
|
||||
: Character.toUpperCase(word.charAt(0)) + word.substring(1).toLowerCase(Locale.ROOT);
|
||||
builder.append(word);
|
||||
}
|
||||
String value = ((JSONObject) object).get("isAvailable").toString();
|
||||
|
||||
+3
-2
@@ -16,6 +16,7 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -320,7 +321,7 @@ public class Websocket extends RestApi {
|
||||
try {
|
||||
String pingId = UUID.randomUUID().toString();
|
||||
pingPongMap.put(pingId, Instant.now());
|
||||
localSession.getRemote().sendPing(ByteBuffer.wrap(pingId.getBytes()));
|
||||
localSession.getRemote().sendPing(ByteBuffer.wrap(pingId.getBytes(StandardCharsets.UTF_8)));
|
||||
} catch (IOException e) {
|
||||
logger.warn("Websocket ping failed {}", e.getMessage());
|
||||
}
|
||||
@@ -333,7 +334,7 @@ public class Websocket extends RestApi {
|
||||
for (int i = 0; i < frame.getPayloadLength(); i++) {
|
||||
bytes[i] = buffer.get(i);
|
||||
}
|
||||
String payloadString = new String(bytes);
|
||||
String payloadString = new String(bytes, StandardCharsets.UTF_8);
|
||||
Instant sent = pingPongMap.remove(payloadString);
|
||||
if (sent == null) {
|
||||
logger.debug("Websocket received pong without ping {}", payloadString);
|
||||
|
||||
+2
-1
@@ -12,6 +12,7 @@
|
||||
*/
|
||||
package org.openhab.binding.mercedesme.internal.discovery;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
@@ -61,7 +62,7 @@ public class MercedesMeDiscoveryService extends AbstractDiscoveryService {
|
||||
properties.put("vin", vin);
|
||||
thingDiscovered(DiscoveryResultBuilder.create(new ThingUID(ttuid, ac.getThing().getUID(), vin))
|
||||
.withBridge(ac.getThing().getUID()).withProperties(properties).withRepresentationProperty("vin")
|
||||
.withLabel("Mercedes Benz " + ttuid.getId().toUpperCase()).build());
|
||||
.withLabel("Mercedes Benz " + ttuid.getId().toUpperCase(Locale.ROOT)).build());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+7
-4
@@ -21,7 +21,6 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
@@ -55,11 +54,15 @@ public class ThingCallbackListener implements ThingHandlerCallback {
|
||||
public Map<String, State> updatesReceived = new HashMap<>();
|
||||
public Map<String, Map<String, State>> updatesPerGroupMap = new HashMap<>();
|
||||
public boolean linked = false;
|
||||
public Optional<ThingStatusInfo> status = Optional.empty();
|
||||
private @Nullable ThingStatusInfo status;
|
||||
private Instant waitTime = Instant.MAX;
|
||||
|
||||
public ThingStatusInfo getThingStatus() {
|
||||
return status.get();
|
||||
ThingStatusInfo localStatus = status;
|
||||
if (localStatus == null) {
|
||||
throw new IllegalStateException("No status update received yet");
|
||||
}
|
||||
return localStatus;
|
||||
}
|
||||
|
||||
public int getUpdatesForGroup(String group) {
|
||||
@@ -108,7 +111,7 @@ public class ThingCallbackListener implements ThingHandlerCallback {
|
||||
|
||||
@Override
|
||||
public void statusUpdated(Thing thing, ThingStatusInfo thingStatus) {
|
||||
status = Optional.of(thingStatus);
|
||||
status = thingStatus;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user