#9444 throw StrictDynamicMappingException exception if dynamic is 'strict' and undeclared field value is NULL, test for this
Fixes #9445
This commit is contained in:
parent
39c064ce8b
commit
f3e1a66133
|
@ -587,6 +587,10 @@ public class ObjectMapper implements Mapper, AllFieldMapper.IncludeInAll {
|
|||
}
|
||||
}
|
||||
mapper.parse(context);
|
||||
} else {
|
||||
if (dynamic == Dynamic.STRICT) {
|
||||
throw new StrictDynamicMappingException(fullPath, lastFieldName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -98,6 +98,17 @@ public class DynamicMappingTests extends ElasticsearchSingleNodeTest {
|
|||
} catch (StrictDynamicMappingException e) {
|
||||
// all is well
|
||||
}
|
||||
|
||||
try {
|
||||
defaultMapper.parse("type", "1", XContentFactory.jsonBuilder()
|
||||
.startObject()
|
||||
.field("field1", "value1")
|
||||
.field("field2", (String) null)
|
||||
.bytes());
|
||||
fail();
|
||||
} catch (StrictDynamicMappingException e) {
|
||||
// all is well
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue