Remove unneeded empty string concatentation
This commit removes concatenation by empty string in places where it is simply not needed to obtain a string representation. Relates #24411
This commit is contained in:
parent
4027c9da7b
commit
13c17c75b5
|
@ -284,7 +284,7 @@ public class Segment implements Streamable {
|
||||||
out.writeBoolean(((SortedNumericSortField) field).getSelector() == SortedNumericSelector.Type.MAX);
|
out.writeBoolean(((SortedNumericSortField) field).getSelector() == SortedNumericSelector.Type.MAX);
|
||||||
out.writeBoolean(field.getReverse());
|
out.writeBoolean(field.getReverse());
|
||||||
} else {
|
} else {
|
||||||
throw new IOException("invalid index sort field:" + field + "");
|
throw new IOException("invalid index sort field:" + field);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -399,7 +399,7 @@ public class IndexShard extends AbstractIndexShardComponent implements IndicesCl
|
||||||
currentRouting = this.shardRouting;
|
currentRouting = this.shardRouting;
|
||||||
|
|
||||||
if (!newRouting.shardId().equals(shardId())) {
|
if (!newRouting.shardId().equals(shardId())) {
|
||||||
throw new IllegalArgumentException("Trying to set a routing entry with shardId " + newRouting.shardId() + " on a shard with shardId " + shardId() + "");
|
throw new IllegalArgumentException("Trying to set a routing entry with shardId " + newRouting.shardId() + " on a shard with shardId " + shardId());
|
||||||
}
|
}
|
||||||
if ((currentRouting == null || newRouting.isSameAllocation(currentRouting)) == false) {
|
if ((currentRouting == null || newRouting.isSameAllocation(currentRouting)) == false) {
|
||||||
throw new IllegalArgumentException("Trying to set a routing entry with a different allocation. Current " + currentRouting + ", new " + newRouting);
|
throw new IllegalArgumentException("Trying to set a routing entry with a different allocation. Current " + currentRouting + ", new " + newRouting);
|
||||||
|
|
|
@ -210,7 +210,7 @@ public final class RepositoryData {
|
||||||
public Set<SnapshotId> getSnapshots(final IndexId indexId) {
|
public Set<SnapshotId> getSnapshots(final IndexId indexId) {
|
||||||
Set<SnapshotId> snapshotIds = indexSnapshots.get(indexId);
|
Set<SnapshotId> snapshotIds = indexSnapshots.get(indexId);
|
||||||
if (snapshotIds == null) {
|
if (snapshotIds == null) {
|
||||||
throw new IllegalArgumentException("unknown snapshot index " + indexId + "");
|
throw new IllegalArgumentException("unknown snapshot index " + indexId);
|
||||||
}
|
}
|
||||||
return snapshotIds;
|
return snapshotIds;
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class LeafDocLookup implements Map<String, ScriptDocValues<?>> {
|
||||||
if (scriptValues == null) {
|
if (scriptValues == null) {
|
||||||
final MappedFieldType fieldType = mapperService.fullName(fieldName);
|
final MappedFieldType fieldType = mapperService.fullName(fieldName);
|
||||||
if (fieldType == null) {
|
if (fieldType == null) {
|
||||||
throw new IllegalArgumentException("No field found for [" + fieldName + "] in mapping with types " + Arrays.toString(types) + "");
|
throw new IllegalArgumentException("No field found for [" + fieldName + "] in mapping with types " + Arrays.toString(types));
|
||||||
}
|
}
|
||||||
// load fielddata on behalf of the script: otherwise it would need additional permissions
|
// load fielddata on behalf of the script: otherwise it would need additional permissions
|
||||||
// to deal with pagedbytes/ramusagestimator/etc
|
// to deal with pagedbytes/ramusagestimator/etc
|
||||||
|
|
|
@ -135,7 +135,7 @@ public class LeafFieldsLookup implements Map {
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
MappedFieldType fieldType = mapperService.fullName(name);
|
MappedFieldType fieldType = mapperService.fullName(name);
|
||||||
if (fieldType == null) {
|
if (fieldType == null) {
|
||||||
throw new IllegalArgumentException("No field found for [" + name + "] in mapping with types " + Arrays.toString(types) + "");
|
throw new IllegalArgumentException("No field found for [" + name + "] in mapping with types " + Arrays.toString(types));
|
||||||
}
|
}
|
||||||
data = new FieldLookup(fieldType);
|
data = new FieldLookup(fieldType);
|
||||||
cachedFieldData.put(name, data);
|
cachedFieldData.put(name, data);
|
||||||
|
|
|
@ -497,7 +497,7 @@ public class SnapshotShardsService extends AbstractLifecycleComponent implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "" + snapshot + ", shardId [" + shardId + "], status [" + status.state() + "]";
|
return snapshot + ", shardId [" + shardId + "], status [" + status.state() + "]";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -684,7 +684,7 @@ public abstract class TcpTransport<Channel> extends AbstractLifecycleComponent i
|
||||||
try {
|
try {
|
||||||
hostAddresses = networkService.resolveBindHostAddresses(bindHosts);
|
hostAddresses = networkService.resolveBindHostAddresses(bindHosts);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new BindTransportException("Failed to resolve host " + Arrays.toString(bindHosts) + "", e);
|
throw new BindTransportException("Failed to resolve host " + Arrays.toString(bindHosts), e);
|
||||||
}
|
}
|
||||||
if (logger.isDebugEnabled()) {
|
if (logger.isDebugEnabled()) {
|
||||||
String[] addresses = new String[hostAddresses.length];
|
String[] addresses = new String[hostAddresses.length];
|
||||||
|
|
|
@ -379,8 +379,10 @@ public class DefMath {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Object add(Object left, Object right) {
|
private static Object add(Object left, Object right) {
|
||||||
if (left instanceof String || right instanceof String) {
|
if (left instanceof String) {
|
||||||
return "" + left + right;
|
return (String) left + right;
|
||||||
|
} else if (right instanceof String) {
|
||||||
|
return left + (String) right;
|
||||||
} else if (left instanceof Number) {
|
} else if (left instanceof Number) {
|
||||||
if (right instanceof Number) {
|
if (right instanceof Number) {
|
||||||
if (left instanceof Double || right instanceof Double) {
|
if (left instanceof Double || right instanceof Double) {
|
||||||
|
|
|
@ -291,7 +291,7 @@ public final class EBinary extends AExpression {
|
||||||
} else if (sort == Sort.DOUBLE) {
|
} else if (sort == Sort.DOUBLE) {
|
||||||
constant = (double)left.constant + (double)right.constant;
|
constant = (double)left.constant + (double)right.constant;
|
||||||
} else if (sort == Sort.STRING) {
|
} else if (sort == Sort.STRING) {
|
||||||
constant = "" + left.constant + right.constant;
|
constant = left.constant.toString() + right.constant.toString();
|
||||||
} else {
|
} else {
|
||||||
throw createError(new IllegalStateException("Illegal tree structure."));
|
throw createError(new IllegalStateException("Illegal tree structure."));
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ public abstract class AbstractNumericTestCase extends ESIntegTestCase {
|
||||||
|
|
||||||
final int numDocs = 10;
|
final int numDocs = 10;
|
||||||
for (int i = 0; i < numDocs; i++) { // TODO randomize the size and the params in here?
|
for (int i = 0; i < numDocs; i++) { // TODO randomize the size and the params in here?
|
||||||
builders.add(client().prepareIndex("idx", "type", ""+i).setSource(jsonBuilder()
|
builders.add(client().prepareIndex("idx", "type", String.valueOf(i)).setSource(jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.field("value", i+1)
|
.field("value", i+1)
|
||||||
.startArray("values").value(i+2).value(i+3).endArray()
|
.startArray("values").value(i+2).value(i+3).endArray()
|
||||||
|
@ -58,7 +58,7 @@ public abstract class AbstractNumericTestCase extends ESIntegTestCase {
|
||||||
prepareCreate("empty_bucket_idx").addMapping("type", "value", "type=integer").execute().actionGet();
|
prepareCreate("empty_bucket_idx").addMapping("type", "value", "type=integer").execute().actionGet();
|
||||||
builders = new ArrayList<>();
|
builders = new ArrayList<>();
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
builders.add(client().prepareIndex("empty_bucket_idx", "type", ""+i).setSource(jsonBuilder()
|
builders.add(client().prepareIndex("empty_bucket_idx", "type", String.valueOf(i)).setSource(jsonBuilder()
|
||||||
.startObject()
|
.startObject()
|
||||||
.field("value", i*2)
|
.field("value", i*2)
|
||||||
.endObject()));
|
.endObject()));
|
||||||
|
|
|
@ -110,7 +110,7 @@ public class NetworkDisruption implements ServiceDisruptionScheme {
|
||||||
|
|
||||||
protected void ensureNodeCount(InternalTestCluster cluster) {
|
protected void ensureNodeCount(InternalTestCluster cluster) {
|
||||||
assertFalse("cluster failed to form after disruption was healed", cluster.client().admin().cluster().prepareHealth()
|
assertFalse("cluster failed to form after disruption was healed", cluster.client().admin().cluster().prepareHealth()
|
||||||
.setWaitForNodes("" + cluster.size())
|
.setWaitForNodes(String.valueOf(cluster.size()))
|
||||||
.setWaitForNoRelocatingShards(true)
|
.setWaitForNoRelocatingShards(true)
|
||||||
.get().isTimedOut());
|
.get().isTimedOut());
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@ public abstract class SingleNodeDisruption implements ServiceDisruptionScheme {
|
||||||
|
|
||||||
protected void ensureNodeCount(InternalTestCluster cluster) {
|
protected void ensureNodeCount(InternalTestCluster cluster) {
|
||||||
assertFalse("cluster failed to form after disruption was healed", cluster.client().admin().cluster().prepareHealth()
|
assertFalse("cluster failed to form after disruption was healed", cluster.client().admin().cluster().prepareHealth()
|
||||||
.setWaitForNodes("" + cluster.size())
|
.setWaitForNodes(String.valueOf(cluster.size()))
|
||||||
.setWaitForNoRelocatingShards(true)
|
.setWaitForNoRelocatingShards(true)
|
||||||
.get().isTimedOut());
|
.get().isTimedOut());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue