elasticsearch/elasticsearch — pull request #2221 by lindstromhenrik (2012-08-31 14:25:25+00:00)
Title: Throw MapperParserException if trying to parse value as object.

When a value type is passed to the object parser it will call nextToken() until it finds an END_OBJECT token (an END_OBJECT for another object). When nested in an array the serializeArray call never exits (the extra nextToken() in parse forwards the stream out of the array).

Example:

{
"object": {
"array":[
{
"object": { "value": "value" }
},
{
"object":"value"
}
]
},
"value":"value"
}

This fix makes the object parser throw a MapperParsingException if a value type is passed to it.