Check if entry value can be cast to a Map, if not fail with a better error.

This commit is contained in:
Martijn van Groningen 2014-01-13 16:45:15 +01:00
parent 2ea93a6ad9
commit c4c918b3a5
1 changed files with 3 additions and 0 deletions

View File

@ -244,6 +244,9 @@ public class TypeParsers {
Map<String, Object> multiFieldsPropNodes = (Map<String, Object>) propNode;
for (Map.Entry<String, Object> multiFieldEntry : multiFieldsPropNodes.entrySet()) {
String multiFieldName = multiFieldEntry.getKey();
if (!(multiFieldEntry.getValue() instanceof Map)) {
throw new MapperParsingException("Illegal field [" + multiFieldName + "], only fields can be specified inside fields");
}
@SuppressWarnings("unchecked")
Map<String, Object> multiFieldNodes = (Map<String, Object>) multiFieldEntry.getValue();