Skip to content

Commit

Permalink
[Apps Plugin] Allow bad enum constants (#545)
Browse files Browse the repository at this point in the history
The metadata plugin currently barfs when it encounters a config item
with an enum field that references itself (e.g. `JdbcDatabaseDialect`).
This commit allows processing to continue when the bad enums are
encountered.
  • Loading branch information
onobc authored Jun 2, 2024
1 parent 47696d6 commit 294e807
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -522,8 +522,16 @@ void addEnumHints(ConfigurationMetadata configurationMetadata, ClassLoader class
Class<?> clazz = ClassUtils.resolveClassName(property.getType(), classLoader);
if (clazz.isEnum()) {
List<ValueHint> valueHints = new ArrayList<>();
for (Object o : clazz.getEnumConstants()) {
valueHints.add(new ValueHint(o, null));
Object[] enumConstants;
try {
enumConstants = clazz.getEnumConstants();
}
catch (NoClassDefFoundError ex) {
getLog().error("Failed to resolve enum constants for property = " + property + " and class = " + clazz, ex);
continue;
}
for (Object enumConstant : enumConstants) {
valueHints.add(new ValueHint(enumConstant, null));
}

if (!providers.containsKey(property.getType())) {
Expand Down

0 comments on commit 294e807

Please sign in to comment.