From 6cf1d6e5b1b83210c4d55aec7f949999334905bf Mon Sep 17 00:00:00 2001 From: Mark Herwege Date: Mon, 19 Jun 2023 09:10:35 +0200 Subject: [PATCH] no regex iteration Signed-off-by: Mark Herwege --- .../org/openhab/core/ui/internal/items/ItemUIRegistryImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/internal/items/ItemUIRegistryImpl.java b/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/internal/items/ItemUIRegistryImpl.java index 733ba3badd9..f5d5bba76fb 100644 --- a/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/internal/items/ItemUIRegistryImpl.java +++ b/bundles/org.openhab.core.ui/src/main/java/org/openhab/core/ui/internal/items/ItemUIRegistryImpl.java @@ -500,7 +500,7 @@ private QuantityType convertStateToWidgetUnit(QuantityType quantityState, if (item instanceof NumberItem numberItem && numberItem.getDimension() != null) { Matcher m = FORMAT_PATTERN.matcher(pattern); int matcherEnd = 0; - while (m.find() && m.group(1) == null) { + if (m.matches() && m.group(1) == null) { matcherEnd = m.end(); } String unit = pattern.substring(matcherEnd).trim();