Skip to content

Commit 4465838

Browse files
committed
Remove last part of error msg starting with "(through reference chain"
Signed-off-by: Laurent Garnier <lg.hc@free.fr>
1 parent 66217d6 commit 4465838

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

bundles/org.openhab.core.model.yaml/src/main/java/org/openhab/core/model/yaml/internal/YamlModelRepositoryImpl.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ public class YamlModelRepositoryImpl implements WatchService.WatchEventListener,
9595
);
9696

9797
private static final String UNWANTED_EXCEPTION_TEXT = "at [Source: UNKNOWN; byte offset: #UNKNOWN] ";
98+
private static final String UNWANTED_EXCEPTION_TEXT2 = "\\n \\(through reference chain: .*";
9899

99100
private final Logger logger = LoggerFactory.getLogger(YamlModelRepositoryImpl.class);
100101

@@ -754,7 +755,8 @@ private <T extends YamlElement> Optional<T> parseJsonNode(JsonNode node, Class<T
754755
if (errors != null) {
755756
String msg = e.getMessage();
756757
errors.add("Could not parse element %s to %s: %s".formatted(node.toPrettyString(),
757-
elementClass.getSimpleName(), msg == null ? "" : msg.replace(UNWANTED_EXCEPTION_TEXT, "")));
758+
elementClass.getSimpleName(), msg == null ? ""
759+
: msg.replace(UNWANTED_EXCEPTION_TEXT, "").replaceAll(UNWANTED_EXCEPTION_TEXT2, "")));
758760
}
759761
return Optional.empty();
760762
}
@@ -790,7 +792,9 @@ private <T extends YamlElement> List<T> parseJsonMapNode(@Nullable JsonNode mapN
790792
String msg = e.getMessage();
791793
errors.add("could not parse element with ID %s to %s: %s".formatted(id,
792794
elementClass.getSimpleName(),
793-
msg == null ? "" : msg.replace(UNWANTED_EXCEPTION_TEXT, "")));
795+
msg == null ? ""
796+
: msg.replace(UNWANTED_EXCEPTION_TEXT, "")
797+
.replaceAll(UNWANTED_EXCEPTION_TEXT2, "")));
794798
}
795799
}
796800
}

0 commit comments

Comments
 (0)