Skip to content

Commit 1ebd6f4

Browse files
committed
Parse ints unsigned
1 parent f554d71 commit 1ebd6f4

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/io/calimero/mgmt/PropertyClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -769,8 +769,8 @@ private static int parseAccessPolicy(final String attribute) throws KNXFormatExc
769769
if (attribute == null || attribute.isEmpty())
770770
return 0;
771771
final int slash = attribute.indexOf('/');
772-
final int off = Integer.parseInt(attribute.substring(0, slash), 16);
773-
final int on = Integer.parseInt(attribute.substring(slash + 1), 16);
772+
final int off = Integer.parseUnsignedInt(attribute.substring(0, slash), 16);
773+
final int on = Integer.parseUnsignedInt(attribute.substring(slash + 1), 16);
774774
if (off > 0x3ff || on > 0x3ff)
775775
throw new KNXFormatException("invalid access policy", attribute);
776776
return (off << 10) | on;

src/io/calimero/secure/Keyring.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Calimero 3 - A library for KNX network access
3-
Copyright (c) 2019, 2024 B. Malinowsky
3+
Copyright (c) 2019, 2025 B. Malinowsky
44
55
This program is free software; you can redistribute it and/or modify
66
it under the terms of the GNU General Public License as published by
@@ -463,7 +463,7 @@ void load() {
463463
final var groupKey = val != null ? decode(val) : null;
464464

465465
val = reader.getAttributeValue(null, "Latency");
466-
final var latency = val != null ? Duration.ofMillis(Integer.parseInt(val)) : Duration.ZERO;
466+
final var latency = val != null ? Duration.ofMillis(Integer.parseUnsignedInt(val)) : Duration.ZERO;
467467

468468
backbone = new Backbone(mcastGroup, groupKey, latency);
469469
}
@@ -476,7 +476,7 @@ else if ("Interface".equals(name)) { // [0, *]
476476
final var host = attr != null ? new IndividualAddress(attr) : new IndividualAddress(0);
477477
attr = reader.getAttributeValue(null, "IndividualAddress");
478478
final var addr = attr != null ? new IndividualAddress(attr) : new IndividualAddress(0);
479-
final var user = readAttribute(reader, "UserID", Integer::parseInt, 0);
479+
final var user = readAttribute(reader, "UserID", Integer::parseUnsignedInt, 0);
480480
final var pwd = readAttribute(reader, "Password", Keyring::decode, null);
481481
final var auth = readAttribute(reader, "Authentication", Keyring::decode, null);
482482

0 commit comments

Comments
 (0)