diff --git a/core/src/main/java/org/elasticsearch/cluster/metadata/MappingMetaData.java b/core/src/main/java/org/elasticsearch/cluster/metadata/MappingMetaData.java index 1f6aeb11220..83a06d9c4ca 100644 --- a/core/src/main/java/org/elasticsearch/cluster/metadata/MappingMetaData.java +++ b/core/src/main/java/org/elasticsearch/cluster/metadata/MappingMetaData.java @@ -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 { /** * Converts the serialized compressed form of the mappings into a parsed map. */ - public Map sourceAsMap() throws IOException { + public Map sourceAsMap() throws ElasticsearchParseException { Map 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 { /** * Converts the serialized compressed form of the mappings into a parsed map. */ - public Map getSourceAsMap() throws IOException { + public Map getSourceAsMap() throws ElasticsearchParseException { return sourceAsMap(); } diff --git a/core/src/test/java/org/elasticsearch/indices/state/RareClusterStateIT.java b/core/src/test/java/org/elasticsearch/indices/state/RareClusterStateIT.java index f138afe35b0..805fcb4d501 100644 --- a/core/src/test/java/org/elasticsearch/indices/state/RareClusterStateIT.java +++ b/core/src/test/java/org/elasticsearch/indices/state/RareClusterStateIT.java @@ -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);