correct expected thrown exception in mappingMetaData to ElasticsearchParseException (#25410)

This commit is contained in:
Tal Levy 2017-06-27 08:55:24 -07:00 committed by GitHub
parent c85ac402b0
commit cbcf6a4f55
2 changed files with 5 additions and 3 deletions

View File

@ -19,6 +19,7 @@
package org.elasticsearch.cluster.metadata;
import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.Version;
import org.elasticsearch.cluster.AbstractDiffable;
import org.elasticsearch.cluster.Diff;
@ -170,7 +171,7 @@ public class MappingMetaData extends AbstractDiffable<MappingMetaData> {
/**
* Converts the serialized compressed form of the mappings into a parsed map.
*/
public Map<String, Object> sourceAsMap() throws IOException {
public Map<String, Object> sourceAsMap() throws ElasticsearchParseException {
Map<String, Object> mapping = XContentHelper.convertToMap(source.compressedReference(), true).v2();
if (mapping.size() == 1 && mapping.containsKey(type())) {
// the type name is the root value, reduce it
@ -182,7 +183,7 @@ public class MappingMetaData extends AbstractDiffable<MappingMetaData> {
/**
* Converts the serialized compressed form of the mappings into a parsed map.
*/
public Map<String, Object> getSourceAsMap() throws IOException {
public Map<String, Object> getSourceAsMap() throws ElasticsearchParseException {
return sourceAsMap();
}

View File

@ -19,6 +19,7 @@
package org.elasticsearch.indices.state;
import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.Version;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse;
@ -274,7 +275,7 @@ public class RareClusterStateIT extends ESIntegTestCase {
Object properties;
try {
properties = typeMappings.getSourceAsMap().get("properties");
} catch (IOException e) {
} catch (ElasticsearchParseException e) {
throw new AssertionError(e);
}
assertNotNull(properties);