From: Mark Herwege Date: Mon, 6 Jun 2022 09:38:50 +0000 (+0200) Subject: Fix array out of bound exception (#12889) X-Git-Url: https://git.basschouten.com/?a=commitdiff_plain;h=654fa3e9ed6cc7e03dd51603b6469f3344c12ead;p=openhab-addons.git Fix array out of bound exception (#12889) Signed-off-by: Mark Herwege --- diff --git a/bundles/org.openhab.binding.elroconnects/src/main/java/org/openhab/binding/elroconnects/internal/util/ElroConnectsUtil.java b/bundles/org.openhab.binding.elroconnects/src/main/java/org/openhab/binding/elroconnects/internal/util/ElroConnectsUtil.java index 8c6207a7f8..0de20f6d20 100644 --- a/bundles/org.openhab.binding.elroconnects/src/main/java/org/openhab/binding/elroconnects/internal/util/ElroConnectsUtil.java +++ b/bundles/org.openhab.binding.elroconnects/src/main/java/org/openhab/binding/elroconnects/internal/util/ElroConnectsUtil.java @@ -48,7 +48,7 @@ public final class ElroConnectsUtil { byte[] bytes = input.getBytes(StandardCharsets.UTF_8); String content = "@".repeat((length > bytes.length) ? (length - bytes.length) : 0) + new String(bytes, StandardCharsets.UTF_8); - bytes = Arrays.copyOf(content.getBytes(StandardCharsets.UTF_8), length); + bytes = Arrays.copyOf(content.getBytes(StandardCharsets.UTF_8), length + 1); bytes[length] = (byte) "$".charAt(0); return HexUtils.bytesToHex(bytes); }