diff --git a/server/src/main/java/org/elasticsearch/common/compress/CompressedXContent.java b/server/src/main/java/org/elasticsearch/common/compress/CompressedXContent.java index 991dfccf7f994..9bc3eab00a564 100644 --- a/server/src/main/java/org/elasticsearch/common/compress/CompressedXContent.java +++ b/server/src/main/java/org/elasticsearch/common/compress/CompressedXContent.java @@ -146,7 +146,7 @@ public byte[] uncompressed() { } } - public String string() throws IOException { + public String string() { return new BytesRef(uncompressed()).utf8ToString(); } @@ -188,10 +188,6 @@ public int hashCode() { @Override public String toString() { - try { - return string(); - } catch (IOException e) { - return "_na_"; - } + return string(); } } diff --git a/server/src/main/java/org/elasticsearch/index/mapper/MapperService.java b/server/src/main/java/org/elasticsearch/index/mapper/MapperService.java index 076f6e7ebe030..6aab34c5f7676 100644 --- a/server/src/main/java/org/elasticsearch/index/mapper/MapperService.java +++ b/server/src/main/java/org/elasticsearch/index/mapper/MapperService.java @@ -21,14 +21,12 @@ import com.carrotsearch.hppc.ObjectHashSet; import com.carrotsearch.hppc.cursors.ObjectCursor; - import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.message.ParameterizedMessage; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.DelegatingAnalyzerWrapper; import org.apache.lucene.index.Term; import org.elasticsearch.Assertions; -import org.elasticsearch.ElasticsearchGenerationException; import org.elasticsearch.Version; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.metadata.MappingMetaData; @@ -336,11 +334,7 @@ private synchronized Map internalMerge(Map { assert recoveryState.getRecoverySource().getType() == RecoverySource.Type.LOCAL_SHARDS: "mapping update consumer only required by local shards recovery"; - try { - client.admin().indices().preparePutMapping() - .setConcreteIndex(shardRouting.index()) // concrete index - no name clash, it uses uuid - .setType(type) - .setSource(mapping.source().string(), XContentType.JSON) - .get(); - } catch (IOException ex) { - throw new ElasticsearchException("failed to stringify mapping source", ex); - } + client.admin().indices().preparePutMapping() + .setConcreteIndex(shardRouting.index()) // concrete index - no name clash, it uses uuid + .setType(type) + .setSource(mapping.source().string(), XContentType.JSON) + .get(); }, this); return indexShard; }