mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
Correct error for long thing names (#12708)
Signed-off-by: Mark Herwege <mark.herwege@telenet.be>
This commit is contained in:
parent
888f962116
commit
9d594469df
@ -46,8 +46,10 @@ public final class ElroConnectsUtil {
|
||||
*/
|
||||
public static String encode(String input, int length) {
|
||||
byte[] bytes = input.getBytes(StandardCharsets.UTF_8);
|
||||
String content = "@".repeat(length - bytes.length) + new String(bytes, StandardCharsets.UTF_8) + "$";
|
||||
bytes = content.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[length] = (byte) "$".charAt(0);
|
||||
return HexUtils.bytesToHex(bytes);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user