[knx] Code cleanup (#15141)
* cleanup * [knx] Replace StringBuffer with StringBuilder Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
This commit is contained in:
parent
f6a4397483
commit
985f89315d
|
@ -228,7 +228,7 @@ public class DeviceInspector {
|
||||||
byte[] count = getClient().readDeviceProperties(address, ROUTER_OBJECT, PID.FRIENDLY_NAME, 0, 1, false,
|
byte[] count = getClient().readDeviceProperties(address, ROUTER_OBJECT, PID.FRIENDLY_NAME, 0, 1, false,
|
||||||
OPERATION_TIMEOUT);
|
OPERATION_TIMEOUT);
|
||||||
if ((count != null) && (toUnsigned(count) == 30)) {
|
if ((count != null) && (toUnsigned(count) == 30)) {
|
||||||
StringBuffer buf = new StringBuffer(30);
|
StringBuilder buf = new StringBuilder(30);
|
||||||
for (int i = 1; i <= 30; i++) {
|
for (int i = 1; i <= 30; i++) {
|
||||||
Thread.sleep(OPERATION_INTERVAL);
|
Thread.sleep(OPERATION_INTERVAL);
|
||||||
// for some reason, reading more than one character per message fails
|
// for some reason, reading more than one character per message fails
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
*/
|
*/
|
||||||
package org.openhab.binding.knx.internal.console;
|
package org.openhab.binding.knx.internal.console;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
@ -56,7 +55,6 @@ public class KNXCommandExtension extends AbstractConsoleCommandExtension impleme
|
||||||
for (KNXBridgeBaseThingHandler bridgeHandler : knxHandlerFactory.getBridges()) {
|
for (KNXBridgeBaseThingHandler bridgeHandler : knxHandlerFactory.getBridges()) {
|
||||||
console.println("KNX bridge \"" + bridgeHandler.getThing().getLabel()
|
console.println("KNX bridge \"" + bridgeHandler.getThing().getLabel()
|
||||||
+ "\": group address, type, number of bytes, and number of occurence since last reload of binding:");
|
+ "\": group address, type, number of bytes, and number of occurence since last reload of binding:");
|
||||||
// console.println(handler.getCommandExtensionData().unknownGA().toString());
|
|
||||||
for (Entry<String, Long> entry : bridgeHandler.getCommandExtensionData().unknownGA().entrySet()) {
|
for (Entry<String, Long> entry : bridgeHandler.getCommandExtensionData().unknownGA().entrySet()) {
|
||||||
console.println(entry.getKey() + " " + entry.getValue());
|
console.println(entry.getKey() + " " + entry.getValue());
|
||||||
}
|
}
|
||||||
|
@ -68,8 +66,8 @@ public class KNXCommandExtension extends AbstractConsoleCommandExtension impleme
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getUsages() {
|
public List<String> getUsages() {
|
||||||
return Arrays.asList(
|
return List
|
||||||
buildCommandUsage(CMD_LIST_UNKNOWN_GA, "list group addresses which are not configured in openHAB"));
|
.of(buildCommandUsage(CMD_LIST_UNKNOWN_GA, "list group addresses which are not configured in openHAB"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -14,7 +14,6 @@ package org.openhab.binding.knx.internal.handler;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
|
||||||
|
@ -30,9 +29,7 @@ import org.openhab.core.thing.ThingStatusDetail;
|
||||||
import org.openhab.core.thing.binding.BaseBridgeHandler;
|
import org.openhab.core.thing.binding.BaseBridgeHandler;
|
||||||
import org.openhab.core.types.Command;
|
import org.openhab.core.types.Command;
|
||||||
|
|
||||||
import tuwien.auto.calimero.IndividualAddress;
|
|
||||||
import tuwien.auto.calimero.knxnetip.SecureConnection;
|
import tuwien.auto.calimero.knxnetip.SecureConnection;
|
||||||
import tuwien.auto.calimero.mgmt.Destination;
|
|
||||||
import tuwien.auto.calimero.secure.KnxSecureException;
|
import tuwien.auto.calimero.secure.KnxSecureException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -74,7 +71,6 @@ public abstract class KNXBridgeBaseThingHandler extends BaseBridgeHandler implem
|
||||||
public record CommandExtensionData(Map<String, Long> unknownGA) {
|
public record CommandExtensionData(Map<String, Long> unknownGA) {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ConcurrentHashMap<IndividualAddress, Destination> destinations = new ConcurrentHashMap<>();
|
|
||||||
private final ScheduledExecutorService knxScheduler = ThreadPoolManager.getScheduledPool("knx");
|
private final ScheduledExecutorService knxScheduler = ThreadPoolManager.getScheduledPool("knx");
|
||||||
private final ScheduledExecutorService backgroundScheduler = Executors.newSingleThreadScheduledExecutor();
|
private final ScheduledExecutorService backgroundScheduler = Executors.newSingleThreadScheduledExecutor();
|
||||||
protected SecureRoutingConfig secureRouting;
|
protected SecureRoutingConfig secureRouting;
|
||||||
|
|
|
@ -83,7 +83,7 @@ public enum KNXTranslationProvider {
|
||||||
* translated)]), empty string for null. May possibly change in further releases.
|
* translated)]), empty string for null. May possibly change in further releases.
|
||||||
*/
|
*/
|
||||||
public String getLocalizedException(final Throwable e) {
|
public String getLocalizedException(final Throwable e) {
|
||||||
StringBuffer res = new StringBuffer();
|
StringBuilder res = new StringBuilder();
|
||||||
final String exName = e.getClass().getSimpleName();
|
final String exName = e.getClass().getSimpleName();
|
||||||
final String key = "exception." + exName;
|
final String key = "exception." + exName;
|
||||||
final String translatedDescription = KNXTranslationProvider.I18N.get(key);
|
final String translatedDescription = KNXTranslationProvider.I18N.get(key);
|
||||||
|
|
Loading…
Reference in New Issue