diff --git a/src/main/java/org/elasticsearch/common/settings/loader/XContentSettingsLoader.java b/src/main/java/org/elasticsearch/common/settings/loader/XContentSettingsLoader.java index 58bdae67768..3243f8fe631 100644 --- a/src/main/java/org/elasticsearch/common/settings/loader/XContentSettingsLoader.java +++ b/src/main/java/org/elasticsearch/common/settings/loader/XContentSettingsLoader.java @@ -19,6 +19,7 @@ package org.elasticsearch.common.settings.loader; +import org.elasticsearch.ElasticSearchParseException; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentType; @@ -66,6 +67,9 @@ public abstract class XContentSettingsLoader implements SettingsLoader { if (token == null) { return settings; } + if (token != XContentParser.Token.START_OBJECT) { + throw new ElasticSearchParseException("malformed, expected settings to start with 'object', instead was [" + token + "]"); + } serializeObject(settings, sb, path, jp, null); return settings; }