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(field.getReverse());
|
||||
} 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;
|
||||
|
||||
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) {
|
||||
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) {
|
||||
Set<SnapshotId> snapshotIds = indexSnapshots.get(indexId);
|
||||
if (snapshotIds == null) {
|
||||
throw new IllegalArgumentException("unknown snapshot index " + indexId + "");
|
||||
throw new IllegalArgumentException("unknown snapshot index " + indexId);
|
||||
}
|
||||
return snapshotIds;
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ public class LeafDocLookup implements Map<String, ScriptDocValues<?>> {
|
|||
if (scriptValues == null) {
|
||||
final MappedFieldType fieldType = mapperService.fullName(fieldName);
|
||||
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
|
||||
// to deal with pagedbytes/ramusagestimator/etc
|
||||
|
|
|
@ -135,7 +135,7 @@ public class LeafFieldsLookup implements Map {
|
|||
if (data == null) {
|
||||
MappedFieldType fieldType = mapperService.fullName(name);
|
||||
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);
|
||||
cachedFieldData.put(name, data);
|
||||
|
|
|
@ -497,7 +497,7 @@ public class SnapshotShardsService extends AbstractLifecycleComponent implements
|
|||
|
||||
@Override
|
||||
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 {
|
||||
hostAddresses = networkService.resolveBindHostAddresses(bindHosts);
|
||||
} 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()) {
|
||||
String[] addresses = new String[hostAddresses.length];
|
||||
|
|
|
@ -379,8 +379,10 @@ public class DefMath {
|
|||
}
|
||||
|
||||
private static Object add(Object left, Object right) {
|
||||
if (left instanceof String || right instanceof String) {
|
||||
return "" + left + right;
|
||||
if (left instanceof String) {
|
||||
return (String) left + right;
|
||||
} else if (right instanceof String) {
|
||||
return left + (String) right;
|
||||
} else if (left instanceof Number) {
|
||||
if (right instanceof Number) {
|
||||
if (left instanceof Double || right instanceof Double) {
|
||||
|
|
|
@ -291,7 +291,7 @@ public final class EBinary extends AExpression {
|
|||
} else if (sort == Sort.DOUBLE) {
|
||||
constant = (double)left.constant + (double)right.constant;
|
||||
} else if (sort == Sort.STRING) {
|
||||
constant = "" + left.constant + right.constant;
|
||||
constant = left.constant.toString() + right.constant.toString();
|
||||
} else {
|
||||
throw createError(new IllegalStateException("Illegal tree structure."));
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ public abstract class AbstractNumericTestCase extends ESIntegTestCase {
|
|||
|
||||
final int numDocs = 10;
|
||||
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()
|
||||
.field("value", i+1)
|
||||
.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();
|
||||
builders = new ArrayList<>();
|
||||
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()
|
||||
.field("value", i*2)
|
||||
.endObject()));
|
||||
|
@ -96,4 +96,4 @@ public abstract class AbstractNumericTestCase extends ESIntegTestCase {
|
|||
public abstract void testScriptMultiValuedWithParams() throws Exception;
|
||||
|
||||
public abstract void testOrderByEmptyAggregation() throws Exception;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ public class NetworkDisruption implements ServiceDisruptionScheme {
|
|||
|
||||
protected void ensureNodeCount(InternalTestCluster cluster) {
|
||||
assertFalse("cluster failed to form after disruption was healed", cluster.client().admin().cluster().prepareHealth()
|
||||
.setWaitForNodes("" + cluster.size())
|
||||
.setWaitForNodes(String.valueOf(cluster.size()))
|
||||
.setWaitForNoRelocatingShards(true)
|
||||
.get().isTimedOut());
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ public abstract class SingleNodeDisruption implements ServiceDisruptionScheme {
|
|||
|
||||
protected void ensureNodeCount(InternalTestCluster cluster) {
|
||||
assertFalse("cluster failed to form after disruption was healed", cluster.client().admin().cluster().prepareHealth()
|
||||
.setWaitForNodes("" + cluster.size())
|
||||
.setWaitForNodes(String.valueOf(cluster.size()))
|
||||
.setWaitForNoRelocatingShards(true)
|
||||
.get().isTimedOut());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue