Skip to content

Commit

Permalink
Ignore malformed config keys
Browse files Browse the repository at this point in the history
  • Loading branch information
hpehl committed Mar 8, 2019
1 parent 0747a20 commit 2f8c4e9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public class ConfigProcessor {
*/
ConfigConfig config;


@ConfigRoot(name = "config")
static final class ConfigConfig {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()) {
Expand All @@ -74,7 +77,12 @@ JsonObject dump(Config config, JsonBuilderFactory factory) {
SortedSet<String> 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);
}
Expand Down

0 comments on commit 2f8c4e9

Please sign in to comment.