mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-24 22:09:24 +00:00
Remove unnecessary throws IOException in CompressedXContent.string() (#35821)
This commit is contained in:
parent
e37a0ef844
commit
43d6ec8bcd
@ -146,7 +146,7 @@ public final class CompressedXContent {
|
||||
}
|
||||
}
|
||||
|
||||
public String string() throws IOException {
|
||||
public String string() {
|
||||
return new BytesRef(uncompressed()).utf8ToString();
|
||||
}
|
||||
|
||||
@ -188,10 +188,6 @@ public final class CompressedXContent {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
try {
|
||||
return string();
|
||||
} catch (IOException e) {
|
||||
return "_na_";
|
||||
}
|
||||
return string();
|
||||
}
|
||||
}
|
||||
|
@ -21,14 +21,12 @@ package org.elasticsearch.index.mapper;
|
||||
|
||||
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 @@ public class MapperService extends AbstractIndexComponent implements Closeable {
|
||||
} catch (Exception e) {
|
||||
throw new MapperParsingException("Failed to parse mapping [{}]: {}", e, DEFAULT_MAPPING, e.getMessage());
|
||||
}
|
||||
try {
|
||||
defaultMappingSource = mappings.get(DEFAULT_MAPPING).string();
|
||||
} catch (IOException e) {
|
||||
throw new ElasticsearchGenerationException("failed to un-compress", e);
|
||||
}
|
||||
defaultMappingSource = mappings.get(DEFAULT_MAPPING).string();
|
||||
}
|
||||
|
||||
final String defaultMappingSourceOrLastStored;
|
||||
|
@ -613,15 +613,11 @@ public class IndicesService extends AbstractLifecycleComponent
|
||||
(type, mapping) -> {
|
||||
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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user