Skip to content

Commit aa91fe4

Browse files
fix: catch errors in type parsing when there are multiple candidates (#448)
1 parent ac370c8 commit aa91fe4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tzatziki-common/src/main/java/com/decathlon/tzatziki/utils/TypeParser.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,15 @@ private static Type parseType(String name) {
7676
default -> classes()
7777
.stream()
7878
.filter(clazz -> clazz.getName().equals(n) || clazz.getSimpleName().equals(n))
79+
.map((ClassPath.ClassInfo classInfo) -> {
80+
try {
81+
return (Type) classInfo.load();
82+
} catch (NoClassDefFoundError e) {
83+
return null;
84+
}
85+
})
86+
.filter(Objects::nonNull)
7987
.findFirst()
80-
.map((ClassPath.ClassInfo classInfo) -> (Type) classInfo.load())
8188
.orElseGet(() -> {
8289
try {
8390
return Class.forName(n);

0 commit comments

Comments
 (0)