From 2f8c4e902d14eb32d29789bab2c57d8fc39c5179 Mon Sep 17 00:00:00 2001 From: Harald Pehl Date: Fri, 8 Mar 2019 17:36:27 +0100 Subject: [PATCH] Ignore malformed config keys --- .../io/quarkus/config/deployment/ConfigProcessor.java | 1 - .../java/io/quarkus/config/runtime/ConfigDumper.java | 10 +++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/deployment/src/main/java/io/quarkus/config/deployment/ConfigProcessor.java b/deployment/src/main/java/io/quarkus/config/deployment/ConfigProcessor.java index c156387..41cf334 100644 --- a/deployment/src/main/java/io/quarkus/config/deployment/ConfigProcessor.java +++ b/deployment/src/main/java/io/quarkus/config/deployment/ConfigProcessor.java @@ -41,7 +41,6 @@ public class ConfigProcessor { */ ConfigConfig config; - @ConfigRoot(name = "config") static final class ConfigConfig { diff --git a/runtime/src/main/java/io/quarkus/config/runtime/ConfigDumper.java b/runtime/src/main/java/io/quarkus/config/runtime/ConfigDumper.java index 0efcf5a..3fac9a0 100644 --- a/runtime/src/main/java/io/quarkus/config/runtime/ConfigDumper.java +++ b/runtime/src/main/java/io/quarkus/config/runtime/ConfigDumper.java @@ -18,6 +18,7 @@ import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; +import java.util.logging.Logger; import javax.json.JsonArrayBuilder; import javax.json.JsonBuilderFactory; @@ -60,6 +61,8 @@ */ class ConfigDumper { + private static final Logger log = Logger.getLogger("io.quarkus.config"); + JsonObject dump(Config config, JsonBuilderFactory factory) { if (config != null) { if (config.getConfigSources().iterator().hasNext()) { @@ -74,7 +77,12 @@ JsonObject dump(Config config, JsonBuilderFactory factory) { SortedSet sortedPropertyNames = new TreeSet<>(propertyNames); JsonObjectBuilder jsonProperties = factory.createObjectBuilder(); for (String propertyName : sortedPropertyNames) { - jsonProperties.add(propertyName, source.getValue(propertyName)); + try { + jsonProperties.add(propertyName, source.getValue(propertyName)); + } catch (Throwable t) { + log.severe("Cannot get configuration value for '" + propertyName + "': " + + t.getMessage()); + } } jsonSource.add("properties", jsonProperties); }