From 115e2de1ba7ff0b4427abfc964bbe59066fe76ca Mon Sep 17 00:00:00 2001 From: Tanguy Leroux Date: Tue, 27 Sep 2022 18:20:45 +0200 Subject: [PATCH] Fix unnecessary string concatenations (#90405) (#90410) Co-authored-by: Elastic Machine --- .../org/elasticsearch/client/DeadHostState.java | 2 +- .../java/org/elasticsearch/client/Response.java | 2 +- .../org/elasticsearch/client/ResponseException.java | 2 +- .../java/org/elasticsearch/client/RestClient.java | 4 +--- .../elasticsearch/client/DeadHostStateTests.java | 2 +- .../client/RestClientBuilderTests.java | 2 +- .../org/elasticsearch/client/sniff/Sniffer.java | 2 +- .../core/internal/provider/EmbeddedModulePath.java | 2 +- .../geometry/utils/GeographyValidator.java | 4 +--- .../geometry/utils/StandardValidator.java | 4 +--- .../org/elasticsearch/geometry/LinearRingTests.java | 2 +- .../org/elasticsearch/geometry/PolygonTests.java | 2 +- .../action/admin/ReloadSecureSettingsIT.java | 4 +--- .../allocation/ClusterAllocationExplainIT.java | 2 +- .../coordination/RemoveCustomsCommandIT.java | 5 +---- .../coordination/RemoveSettingsCommandIT.java | 2 +- .../discovery/ClusterDisruptionIT.java | 2 +- .../indices/recovery/IndexRecoveryIT.java | 2 +- .../indices/template/SimpleIndexTemplateIT.java | 4 ++-- .../IngestProcessorNotInstalledOnAllNodesIT.java | 2 +- .../aggregations/pipeline/BucketScriptIT.java | 2 +- .../search/aggregations/pipeline/BucketSortIT.java | 2 +- .../subphase/highlight/HighlighterSearchIT.java | 13 +++---------- .../versioning/ConcurrentSeqNoVersioningIT.java | 2 +- .../versioning/SimpleVersioningIT.java | 4 +--- .../main/java/org/elasticsearch/env/ShardLock.java | 2 +- .../index/cache/bitset/BitsetFilterCache.java | 2 +- .../index/codec/PerFieldMapperCodec.java | 2 +- .../index/engine/DeleteVersionValue.java | 2 +- .../ElasticsearchConcurrentMergeScheduler.java | 2 +- .../java/org/elasticsearch/index/engine/Engine.java | 2 +- .../index/engine/IndexVersionValue.java | 2 +- .../elasticsearch/index/engine/VersionValue.java | 2 +- .../elasticsearch/index/mapper/RuntimeField.java | 2 +- .../org/elasticsearch/index/mapper/TypeParsers.java | 2 +- .../mapper/flattened/FlattenedFieldParser.java | 4 ++-- .../mapper/vectors/DenseVectorFieldMapper.java | 4 ++-- .../index/query/AbstractQueryBuilder.java | 2 +- .../index/query/FieldMaskingSpanQueryBuilder.java | 2 +- .../org/elasticsearch/index/query/Rewriteable.java | 4 ++-- .../index/seqno/LocalCheckpointTracker.java | 2 +- .../elasticsearch/index/seqno/RetentionLeases.java | 2 +- .../elasticsearch/index/seqno/SequenceNumbers.java | 2 +- .../org/elasticsearch/index/shard/ShardPath.java | 2 +- .../src/main/java/org/elasticsearch/node/Node.java | 2 +- .../java/org/elasticsearch/rest/RestRequest.java | 2 +- .../admin/cluster/RestClusterHealthAction.java | 2 +- .../action/admin/cluster/RestNodesStatsAction.java | 2 +- .../admin/indices/RestGetFieldMappingAction.java | 4 ++-- .../action/admin/indices/RestGetMappingAction.java | 2 +- .../admin/indices/RestIndicesStatsAction.java | 2 +- .../action/admin/indices/RestPutMappingAction.java | 2 +- .../admin/indices/RestValidateQueryAction.java | 2 +- .../rest/action/cat/RestNodesAction.java | 2 +- .../rest/action/document/RestBulkAction.java | 2 +- .../rest/action/document/RestMultiGetAction.java | 2 +- .../action/document/RestMultiTermVectorsAction.java | 2 +- .../rest/action/document/RestTermVectorsAction.java | 2 +- .../rest/action/search/RestExplainAction.java | 4 ++-- .../rest/action/search/RestSearchAction.java | 6 +++--- .../index/query/BoolQueryBuilderTests.java | 2 +- .../index/query/TermQueryBuilderTests.java | 2 +- .../index/query/TermsQueryBuilderTests.java | 2 +- .../query/functionscore/FunctionScoreTests.java | 2 +- 64 files changed, 74 insertions(+), 94 deletions(-) diff --git a/client/rest/src/main/java/org/elasticsearch/client/DeadHostState.java b/client/rest/src/main/java/org/elasticsearch/client/DeadHostState.java index 1858644ce5a07..52f8caff39eea 100644 --- a/client/rest/src/main/java/org/elasticsearch/client/DeadHostState.java +++ b/client/rest/src/main/java/org/elasticsearch/client/DeadHostState.java @@ -92,7 +92,7 @@ int getFailedAttempts() { public int compareTo(DeadHostState other) { if (timeSupplier != other.timeSupplier) { throw new IllegalArgumentException( - "can't compare DeadHostStates holding different time suppliers as they may " + "be based on different clocks" + "can't compare DeadHostStates holding different time suppliers as they may be based on different clocks" ); } return Long.compare(deadUntilNanos, other.deadUntilNanos); diff --git a/client/rest/src/main/java/org/elasticsearch/client/Response.java b/client/rest/src/main/java/org/elasticsearch/client/Response.java index 9dbac4287212c..7249fe4f06568 100644 --- a/client/rest/src/main/java/org/elasticsearch/client/Response.java +++ b/client/rest/src/main/java/org/elasticsearch/client/Response.java @@ -201,6 +201,6 @@ HttpResponse getHttpResponse() { @Override public String toString() { - return "Response{" + "requestLine=" + requestLine + ", host=" + host + ", response=" + response.getStatusLine() + '}'; + return "Response{requestLine=" + requestLine + ", host=" + host + ", response=" + response.getStatusLine() + '}'; } } diff --git a/client/rest/src/main/java/org/elasticsearch/client/ResponseException.java b/client/rest/src/main/java/org/elasticsearch/client/ResponseException.java index 52d59019a5fc0..d083bbe4fe616 100644 --- a/client/rest/src/main/java/org/elasticsearch/client/ResponseException.java +++ b/client/rest/src/main/java/org/elasticsearch/client/ResponseException.java @@ -50,7 +50,7 @@ static String buildMessage(Response response) throws IOException { ); if (response.hasWarnings()) { - message += "\n" + "Warnings: " + response.getWarnings(); + message += "\nWarnings: " + response.getWarnings(); } HttpEntity entity = response.getEntity(); diff --git a/client/rest/src/main/java/org/elasticsearch/client/RestClient.java b/client/rest/src/main/java/org/elasticsearch/client/RestClient.java index d27d46df451f4..7154a2be5bbd8 100644 --- a/client/rest/src/main/java/org/elasticsearch/client/RestClient.java +++ b/client/rest/src/main/java/org/elasticsearch/client/RestClient.java @@ -513,9 +513,7 @@ static Iterable selectNodes( return singletonList(Collections.min(selectedDeadNodes).node); } } - throw new IOException( - "NodeSelector [" + nodeSelector + "] rejected all nodes, " + "living " + livingNodes + " and dead " + deadNodes - ); + throw new IOException("NodeSelector [" + nodeSelector + "] rejected all nodes, living " + livingNodes + " and dead " + deadNodes); } /** diff --git a/client/rest/src/test/java/org/elasticsearch/client/DeadHostStateTests.java b/client/rest/src/test/java/org/elasticsearch/client/DeadHostStateTests.java index a7fc42f2c3a51..859db4eea6db7 100644 --- a/client/rest/src/test/java/org/elasticsearch/client/DeadHostStateTests.java +++ b/client/rest/src/test/java/org/elasticsearch/client/DeadHostStateTests.java @@ -79,7 +79,7 @@ public void testCompareToDifferingTimeSupplier() { fail("expected failure"); } catch (IllegalArgumentException e) { assertEquals( - "can't compare DeadHostStates holding different time suppliers as they may " + "be based on different clocks", + "can't compare DeadHostStates holding different time suppliers as they may be based on different clocks", e.getMessage() ); } diff --git a/client/rest/src/test/java/org/elasticsearch/client/RestClientBuilderTests.java b/client/rest/src/test/java/org/elasticsearch/client/RestClientBuilderTests.java index 9e2f2c1b05c80..c7fc59361e920 100644 --- a/client/rest/src/test/java/org/elasticsearch/client/RestClientBuilderTests.java +++ b/client/rest/src/test/java/org/elasticsearch/client/RestClientBuilderTests.java @@ -182,7 +182,7 @@ public void testBuildCloudId() throws IOException { RestClient.builder(badId + ":"); fail("should have failed"); } catch (IllegalStateException e) { - assertEquals("cloudId " + badId + ":" + " must begin with a human readable identifier followed by a colon", e.getMessage()); + assertEquals("cloudId " + badId + ": must begin with a human readable identifier followed by a colon", e.getMessage()); } RestClient client = RestClient.builder(encodedId).build(); diff --git a/client/sniffer/src/main/java/org/elasticsearch/client/sniff/Sniffer.java b/client/sniffer/src/main/java/org/elasticsearch/client/sniff/Sniffer.java index ea434d054a90a..ca17db3ef3a3d 100644 --- a/client/sniffer/src/main/java/org/elasticsearch/client/sniff/Sniffer.java +++ b/client/sniffer/src/main/java/org/elasticsearch/client/sniff/Sniffer.java @@ -147,7 +147,7 @@ public void run() { ScheduledTask previousTask = nextScheduledTask; nextScheduledTask = new ScheduledTask(task, future); assert initialized.get() == false || previousTask.task.isSkipped() || previousTask.task.hasStarted() - : "task that we are replacing is neither " + "cancelled nor has it ever started"; + : "task that we are replacing is neither cancelled nor has it ever started"; } } diff --git a/libs/core/src/main/java/org/elasticsearch/core/internal/provider/EmbeddedModulePath.java b/libs/core/src/main/java/org/elasticsearch/core/internal/provider/EmbeddedModulePath.java index 4e880a416e609..abf29c3c43656 100644 --- a/libs/core/src/main/java/org/elasticsearch/core/internal/provider/EmbeddedModulePath.java +++ b/libs/core/src/main/java/org/elasticsearch/core/internal/provider/EmbeddedModulePath.java @@ -213,7 +213,7 @@ static Optional toPackageName(Path file, String separator) { if (parent == null) { String name = file.toString(); if (name.endsWith(".class") && name.equals(MODULE_INFO) == false) { - String msg = name + " found in top-level directory" + " (unnamed package not allowed in module)"; + String msg = name + " found in top-level directory (unnamed package not allowed in module)"; throw new InvalidModuleDescriptorException(msg); } return Optional.empty(); diff --git a/libs/geo/src/main/java/org/elasticsearch/geometry/utils/GeographyValidator.java b/libs/geo/src/main/java/org/elasticsearch/geometry/utils/GeographyValidator.java index 83d19244dce24..08250417d76c1 100644 --- a/libs/geo/src/main/java/org/elasticsearch/geometry/utils/GeographyValidator.java +++ b/libs/geo/src/main/java/org/elasticsearch/geometry/utils/GeographyValidator.java @@ -84,9 +84,7 @@ protected void checkLongitude(double longitude) { protected void checkAltitude(double zValue) { if (ignoreZValue == false && Double.isNaN(zValue) == false) { - throw new IllegalArgumentException( - "found Z value [" + zValue + "] but [ignore_z_value] " + "parameter is [" + ignoreZValue + "]" - ); + throw new IllegalArgumentException("found Z value [" + zValue + "] but [ignore_z_value] parameter is [" + ignoreZValue + "]"); } } diff --git a/libs/geo/src/main/java/org/elasticsearch/geometry/utils/StandardValidator.java b/libs/geo/src/main/java/org/elasticsearch/geometry/utils/StandardValidator.java index fd45b01565e38..a6c992878d14b 100644 --- a/libs/geo/src/main/java/org/elasticsearch/geometry/utils/StandardValidator.java +++ b/libs/geo/src/main/java/org/elasticsearch/geometry/utils/StandardValidator.java @@ -41,9 +41,7 @@ public static GeometryValidator instance(boolean ignoreZValue) { protected void checkZ(double zValue) { if (ignoreZValue == false && Double.isNaN(zValue) == false) { - throw new IllegalArgumentException( - "found Z value [" + zValue + "] but [ignore_z_value] " + "parameter is [" + ignoreZValue + "]" - ); + throw new IllegalArgumentException("found Z value [" + zValue + "] but [ignore_z_value] parameter is [" + ignoreZValue + "]"); } } diff --git a/libs/geo/src/test/java/org/elasticsearch/geometry/LinearRingTests.java b/libs/geo/src/test/java/org/elasticsearch/geometry/LinearRingTests.java index 0ebe257d5aaa3..f154e339d3dd1 100644 --- a/libs/geo/src/test/java/org/elasticsearch/geometry/LinearRingTests.java +++ b/libs/geo/src/test/java/org/elasticsearch/geometry/LinearRingTests.java @@ -31,7 +31,7 @@ public void testInitValidation() { () -> validator.validate(new LinearRing(new double[] { 3, 4, 5 }, new double[] { 1, 2, 3 })) ); assertEquals( - "first and last points of the linear ring must be the same (it must close itself): x[0]=3.0 x[2]=5.0 y[0]=1.0 " + "y[2]=3.0", + "first and last points of the linear ring must be the same (it must close itself): x[0]=3.0 x[2]=5.0 y[0]=1.0 y[2]=3.0", ex.getMessage() ); diff --git a/libs/geo/src/test/java/org/elasticsearch/geometry/PolygonTests.java b/libs/geo/src/test/java/org/elasticsearch/geometry/PolygonTests.java index 80e371b1f0993..5445de367c218 100644 --- a/libs/geo/src/test/java/org/elasticsearch/geometry/PolygonTests.java +++ b/libs/geo/src/test/java/org/elasticsearch/geometry/PolygonTests.java @@ -128,7 +128,7 @@ public void testWKTValidation() { ) ); assertEquals( - "first and last points of the linear ring must be the same (it must close itself): " + "x[0]=0.5 x[2]=2.0 y[0]=1.5 y[2]=1.0", + "first and last points of the linear ring must be the same (it must close itself): x[0]=0.5 x[2]=2.0 y[0]=1.5 y[2]=1.0", ex.getMessage() ); } diff --git a/server/src/internalClusterTest/java/org/elasticsearch/action/admin/ReloadSecureSettingsIT.java b/server/src/internalClusterTest/java/org/elasticsearch/action/admin/ReloadSecureSettingsIT.java index 71fd02deecc2a..41a4c8342431b 100644 --- a/server/src/internalClusterTest/java/org/elasticsearch/action/admin/ReloadSecureSettingsIT.java +++ b/server/src/internalClusterTest/java/org/elasticsearch/action/admin/ReloadSecureSettingsIT.java @@ -189,9 +189,7 @@ public void onFailure(Exception e) { assertThat(e, instanceOf(ElasticsearchException.class)); assertThat( e.getMessage(), - containsString( - "Secure settings cannot be updated cluster wide when TLS for the " + "transport layer is not enabled" - ) + containsString("Secure settings cannot be updated cluster wide when TLS for the transport layer is not enabled") ); } finally { latch.countDown(); diff --git a/server/src/internalClusterTest/java/org/elasticsearch/action/admin/cluster/allocation/ClusterAllocationExplainIT.java b/server/src/internalClusterTest/java/org/elasticsearch/action/admin/cluster/allocation/ClusterAllocationExplainIT.java index e8411b5124113..6859f484aea36 100644 --- a/server/src/internalClusterTest/java/org/elasticsearch/action/admin/cluster/allocation/ClusterAllocationExplainIT.java +++ b/server/src/internalClusterTest/java/org/elasticsearch/action/admin/cluster/allocation/ClusterAllocationExplainIT.java @@ -470,7 +470,7 @@ public void testAllocationFilteringOnIndexCreation() throws Exception { if (d.label().equals("filter")) { assertEquals(Decision.Type.NO, d.type()); assertEquals( - "node does not match index setting [index.routing.allocation.include] filters " + "[_name:\"non_existent_node\"]", + "node does not match index setting [index.routing.allocation.include] filters [_name:\"non_existent_node\"]", d.getExplanation() ); } diff --git a/server/src/internalClusterTest/java/org/elasticsearch/cluster/coordination/RemoveCustomsCommandIT.java b/server/src/internalClusterTest/java/org/elasticsearch/cluster/coordination/RemoveCustomsCommandIT.java index b898eafe0022a..3d120656c8d28 100644 --- a/server/src/internalClusterTest/java/org/elasticsearch/cluster/coordination/RemoveCustomsCommandIT.java +++ b/server/src/internalClusterTest/java/org/elasticsearch/cluster/coordination/RemoveCustomsCommandIT.java @@ -84,10 +84,7 @@ public void testCustomDoesNotMatch() throws Exception { UserException.class, () -> removeCustoms(environment, false, new String[] { "index-greveyard-with-typos" }) ); - assertThat( - ex.getMessage(), - containsString("No custom metadata matching [index-greveyard-with-typos] were " + "found on this node") - ); + assertThat(ex.getMessage(), containsString("No custom metadata matching [index-greveyard-with-typos] were found on this node")); } private MockTerminal executeCommand(ElasticsearchNodeCommand command, Environment environment, boolean abort, String... args) diff --git a/server/src/internalClusterTest/java/org/elasticsearch/cluster/coordination/RemoveSettingsCommandIT.java b/server/src/internalClusterTest/java/org/elasticsearch/cluster/coordination/RemoveSettingsCommandIT.java index cf64b1909c32d..1970928818a9e 100644 --- a/server/src/internalClusterTest/java/org/elasticsearch/cluster/coordination/RemoveSettingsCommandIT.java +++ b/server/src/internalClusterTest/java/org/elasticsearch/cluster/coordination/RemoveSettingsCommandIT.java @@ -130,7 +130,7 @@ public void testSettingDoesNotMatch() throws Exception { ); assertThat( ex.getMessage(), - containsString("No persistent cluster settings matching [cluster.routing.allocation.disk.bla.*] were " + "found on this node") + containsString("No persistent cluster settings matching [cluster.routing.allocation.disk.bla.*] were found on this node") ); } diff --git a/server/src/internalClusterTest/java/org/elasticsearch/discovery/ClusterDisruptionIT.java b/server/src/internalClusterTest/java/org/elasticsearch/discovery/ClusterDisruptionIT.java index 0483d8ba0e903..6f8f2eb11a802 100644 --- a/server/src/internalClusterTest/java/org/elasticsearch/discovery/ClusterDisruptionIT.java +++ b/server/src/internalClusterTest/java/org/elasticsearch/discovery/ClusterDisruptionIT.java @@ -530,7 +530,7 @@ public void testRestartNodeWhileIndexing() throws Exception { IndexShard shard = indicesService.getShardOrNull(shardRouting.shardId()); Set docs = IndexShardTestCase.getShardDocUIDs(shard); assertThat( - "shard [" + shard.routingEntry() + "] docIds [" + docs + "] vs " + " acked docIds [" + ackedDocs + "]", + "shard [" + shard.routingEntry() + "] docIds [" + docs + "] vs acked docIds [" + ackedDocs + "]", ackedDocs, everyItem(is(in(docs))) ); diff --git a/server/src/internalClusterTest/java/org/elasticsearch/indices/recovery/IndexRecoveryIT.java b/server/src/internalClusterTest/java/org/elasticsearch/indices/recovery/IndexRecoveryIT.java index 510011e183e80..5fc3f66ea5f33 100644 --- a/server/src/internalClusterTest/java/org/elasticsearch/indices/recovery/IndexRecoveryIT.java +++ b/server/src/internalClusterTest/java/org/elasticsearch/indices/recovery/IndexRecoveryIT.java @@ -1062,7 +1062,7 @@ public void testRecoverLocallyUpToGlobalCheckpoint() throws Exception { .getShard(0) .getRetentionLeases(); throw new AssertionError( - "expect an operation-based recovery:" + "retention leases" + Strings.toString(retentionLeases) + "]" + "expect an operation-based recovery:retention leases" + Strings.toString(retentionLeases) + "]" ); } connection.sendRequest(requestId, action, request, options); diff --git a/server/src/internalClusterTest/java/org/elasticsearch/indices/template/SimpleIndexTemplateIT.java b/server/src/internalClusterTest/java/org/elasticsearch/indices/template/SimpleIndexTemplateIT.java index 64760ee8c154c..3ea358aebcd44 100644 --- a/server/src/internalClusterTest/java/org/elasticsearch/indices/template/SimpleIndexTemplateIT.java +++ b/server/src/internalClusterTest/java/org/elasticsearch/indices/template/SimpleIndexTemplateIT.java @@ -964,7 +964,7 @@ public void testPartitionedTemplate() throws Exception { ); assertThat( eBadSettings.getMessage(), - containsString("partition size [6] should be a positive number " + "less than the number of shards [5]") + containsString("partition size [6] should be a positive number less than the number of shards [5]") ); // provide an invalid mapping for a partitioned index @@ -1003,7 +1003,7 @@ public void testPartitionedTemplate() throws Exception { assertThat( eBadIndex.getMessage(), - containsString("partition size [6] should be a positive number " + "less than the number of shards [5]") + containsString("partition size [6] should be a positive number less than the number of shards [5]") ); // finally, create a valid index diff --git a/server/src/internalClusterTest/java/org/elasticsearch/ingest/IngestProcessorNotInstalledOnAllNodesIT.java b/server/src/internalClusterTest/java/org/elasticsearch/ingest/IngestProcessorNotInstalledOnAllNodesIT.java index 0d178e09a3710..6706a4ec0fa87 100644 --- a/server/src/internalClusterTest/java/org/elasticsearch/ingest/IngestProcessorNotInstalledOnAllNodesIT.java +++ b/server/src/internalClusterTest/java/org/elasticsearch/ingest/IngestProcessorNotInstalledOnAllNodesIT.java @@ -99,7 +99,7 @@ public void testFailStartNode() throws Exception { assertThat(pipeline.getId(), equalTo("_id")); assertThat( pipeline.getDescription(), - equalTo("this is a place holder pipeline, " + "because pipeline with id [_id] could not be loaded") + equalTo("this is a place holder pipeline, because pipeline with id [_id] could not be loaded") ); } diff --git a/server/src/internalClusterTest/java/org/elasticsearch/search/aggregations/pipeline/BucketScriptIT.java b/server/src/internalClusterTest/java/org/elasticsearch/search/aggregations/pipeline/BucketScriptIT.java index 48dcb10b344e1..a40e9cc872904 100644 --- a/server/src/internalClusterTest/java/org/elasticsearch/search/aggregations/pipeline/BucketScriptIT.java +++ b/server/src/internalClusterTest/java/org/elasticsearch/search/aggregations/pipeline/BucketScriptIT.java @@ -531,7 +531,7 @@ public void testStoredScript() { .setId("my_script") // Script source is not interpreted but it references a pre-defined script from CustomScriptPlugin .setContent( - new BytesArray("{ \"script\": {\"lang\": \"" + CustomScriptPlugin.NAME + "\"," + " \"source\": \"my_script\" } }"), + new BytesArray("{ \"script\": {\"lang\": \"" + CustomScriptPlugin.NAME + "\", \"source\": \"my_script\" } }"), XContentType.JSON ) ); diff --git a/server/src/internalClusterTest/java/org/elasticsearch/search/aggregations/pipeline/BucketSortIT.java b/server/src/internalClusterTest/java/org/elasticsearch/search/aggregations/pipeline/BucketSortIT.java index dd8a3163b312a..b0e596d6e7ab0 100644 --- a/server/src/internalClusterTest/java/org/elasticsearch/search/aggregations/pipeline/BucketSortIT.java +++ b/server/src/internalClusterTest/java/org/elasticsearch/search/aggregations/pipeline/BucketSortIT.java @@ -529,7 +529,7 @@ public void testNeitherSortsNorSizeSpecifiedAndFromIsDefault_ShouldThrowValidati ); assertThat( e.getMessage(), - containsString("[bucketSort] is configured to perform nothing." + " Please set either of [sort, size, from] to use bucket_sort") + containsString("[bucketSort] is configured to perform nothing. Please set either of [sort, size, from] to use bucket_sort") ); } } diff --git a/server/src/internalClusterTest/java/org/elasticsearch/search/fetch/subphase/highlight/HighlighterSearchIT.java b/server/src/internalClusterTest/java/org/elasticsearch/search/fetch/subphase/highlight/HighlighterSearchIT.java index 56056fb120549..c5fdbc5a3973e 100644 --- a/server/src/internalClusterTest/java/org/elasticsearch/search/fetch/subphase/highlight/HighlighterSearchIT.java +++ b/server/src/internalClusterTest/java/org/elasticsearch/search/fetch/subphase/highlight/HighlighterSearchIT.java @@ -358,7 +358,7 @@ public void testEnsureNoNegativeOffsets() throws Exception { "no_long_term", "This is a test where foo is highlighed and should be highlighted", "long_term", - "This is a test thisisaverylongwordandmakessurethisfails where foo is highlighed " + "and should be highlighted" + "This is a test thisisaverylongwordandmakessurethisfails where foo is highlighed and should be highlighted" ) .get(); refresh(); @@ -1339,14 +1339,7 @@ public void testSameContent() throws Exception { .get(); for (int i = 0; i < 5; i++) { - assertHighlight( - search, - i, - "title", - 0, - 1, - equalTo("This is a test on the highlighting bug " + "present in elasticsearch") - ); + assertHighlight(search, i, "title", 0, 1, equalTo("This is a test on the highlighting bug present in elasticsearch")); } } @@ -1624,7 +1617,7 @@ public void testFastVectorHighlighterShouldFailIfNoTermVectors() throws Exceptio .highlighter(new HighlightBuilder().field("title", 50, 1, 10).highlighterType("fvh")), RestStatus.BAD_REQUEST, containsString( - "the field [title] should be indexed with term vector with position offsets to be " + "used with fast vector highlighter" + "the field [title] should be indexed with term vector with position offsets to be used with fast vector highlighter" ) ); diff --git a/server/src/internalClusterTest/java/org/elasticsearch/versioning/ConcurrentSeqNoVersioningIT.java b/server/src/internalClusterTest/java/org/elasticsearch/versioning/ConcurrentSeqNoVersioningIT.java index f5ab3d63f46e8..08cc5fa784fc1 100644 --- a/server/src/internalClusterTest/java/org/elasticsearch/versioning/ConcurrentSeqNoVersioningIT.java +++ b/server/src/internalClusterTest/java/org/elasticsearch/versioning/ConcurrentSeqNoVersioningIT.java @@ -335,7 +335,7 @@ public int compareTo(Version other) { @Override public String toString() { - return "{" + "primaryTerm=" + primaryTerm + ", seqNo=" + seqNo + '}'; + return "{primaryTerm=" + primaryTerm + ", seqNo=" + seqNo + '}'; } public Version nextSeqNo(int increment) { diff --git a/server/src/internalClusterTest/java/org/elasticsearch/versioning/SimpleVersioningIT.java b/server/src/internalClusterTest/java/org/elasticsearch/versioning/SimpleVersioningIT.java index 8d3123e9f115c..052c61635bab6 100644 --- a/server/src/internalClusterTest/java/org/elasticsearch/versioning/SimpleVersioningIT.java +++ b/server/src/internalClusterTest/java/org/elasticsearch/versioning/SimpleVersioningIT.java @@ -258,9 +258,7 @@ public void testRequireUnitsOnUpdateSettings() throws Exception { // expected assertTrue( iae.getMessage() - .contains( - "failed to parse setting [index.gc_deletes] with value [42] as a time value: unit is " + "missing or unrecognized" - ) + .contains("failed to parse setting [index.gc_deletes] with value [42] as a time value: unit is missing or unrecognized") ); } } diff --git a/server/src/main/java/org/elasticsearch/env/ShardLock.java b/server/src/main/java/org/elasticsearch/env/ShardLock.java index 06c62674c7471..7759cb555baed 100644 --- a/server/src/main/java/org/elasticsearch/env/ShardLock.java +++ b/server/src/main/java/org/elasticsearch/env/ShardLock.java @@ -53,7 +53,7 @@ public void setDetails(String details) {} @Override public String toString() { - return "ShardLock{" + "shardId=" + shardId + '}'; + return "ShardLock{shardId=" + shardId + '}'; } } diff --git a/server/src/main/java/org/elasticsearch/index/cache/bitset/BitsetFilterCache.java b/server/src/main/java/org/elasticsearch/index/cache/bitset/BitsetFilterCache.java index 27bf865ea8705..b228c68f2a631 100644 --- a/server/src/main/java/org/elasticsearch/index/cache/bitset/BitsetFilterCache.java +++ b/server/src/main/java/org/elasticsearch/index/cache/bitset/BitsetFilterCache.java @@ -288,7 +288,7 @@ public IndexWarmer.TerminationHandle warmReader(final IndexShard indexShard, fin ); } } catch (Exception e) { - indexShard.warmerService().logger().warn(() -> "failed to load " + "bitset for [" + filterToWarm + "]", e); + indexShard.warmerService().logger().warn(() -> "failed to load bitset for [" + filterToWarm + "]", e); } finally { latch.countDown(); } diff --git a/server/src/main/java/org/elasticsearch/index/codec/PerFieldMapperCodec.java b/server/src/main/java/org/elasticsearch/index/codec/PerFieldMapperCodec.java index e4bb82e585857..268ba302033ff 100644 --- a/server/src/main/java/org/elasticsearch/index/codec/PerFieldMapperCodec.java +++ b/server/src/main/java/org/elasticsearch/index/codec/PerFieldMapperCodec.java @@ -39,7 +39,7 @@ public class PerFieldMapperCodec extends Lucene94Codec { static { assert Codec.forName(Lucene.LATEST_CODEC).getClass().isAssignableFrom(PerFieldMapperCodec.class) - : "PerFieldMapperCodec must subclass the latest " + "lucene codec: " + Lucene.LATEST_CODEC; + : "PerFieldMapperCodec must subclass the latest lucene codec: " + Lucene.LATEST_CODEC; } public PerFieldMapperCodec(Mode compressionMode, MapperService mapperService, BigArrays bigArrays) { diff --git a/server/src/main/java/org/elasticsearch/index/engine/DeleteVersionValue.java b/server/src/main/java/org/elasticsearch/index/engine/DeleteVersionValue.java index 1bf47235d072f..629c68444ead8 100644 --- a/server/src/main/java/org/elasticsearch/index/engine/DeleteVersionValue.java +++ b/server/src/main/java/org/elasticsearch/index/engine/DeleteVersionValue.java @@ -53,6 +53,6 @@ public int hashCode() { @Override public String toString() { - return "DeleteVersionValue{" + "version=" + version + ", seqNo=" + seqNo + ", term=" + term + ",time=" + time + '}'; + return "DeleteVersionValue{version=" + version + ", seqNo=" + seqNo + ", term=" + term + ",time=" + time + '}'; } } diff --git a/server/src/main/java/org/elasticsearch/index/engine/ElasticsearchConcurrentMergeScheduler.java b/server/src/main/java/org/elasticsearch/index/engine/ElasticsearchConcurrentMergeScheduler.java index fc708555184c4..bb2cc34daae37 100644 --- a/server/src/main/java/org/elasticsearch/index/engine/ElasticsearchConcurrentMergeScheduler.java +++ b/server/src/main/java/org/elasticsearch/index/engine/ElasticsearchConcurrentMergeScheduler.java @@ -140,7 +140,7 @@ protected void doMerge(MergeSource mergeSource, MergePolicy.OneMerge merge) thro String message = String.format( Locale.ROOT, - "merge segment [%s] done: took [%s], [%,.1f MB], [%,d docs], [%s stopped], " + "[%s throttled]", + "merge segment [%s] done: took [%s], [%,.1f MB], [%,d docs], [%s stopped], [%s throttled]", getSegmentName(merge), TimeValue.timeValueMillis(tookMS), totalSizeInBytes / 1024f / 1024f, diff --git a/server/src/main/java/org/elasticsearch/index/engine/Engine.java b/server/src/main/java/org/elasticsearch/index/engine/Engine.java index 952ef783a2ea5..c05428e4abb24 100644 --- a/server/src/main/java/org/elasticsearch/index/engine/Engine.java +++ b/server/src/main/java/org/elasticsearch/index/engine/Engine.java @@ -1156,7 +1156,7 @@ public void failEngine(String reason, @Nullable Exception failure) { } } else { logger.debug( - () -> format("tried to fail engine but could not acquire lock - engine should " + "be failed by now [%s]", reason), + () -> format("tried to fail engine but could not acquire lock - engine should be failed by now [%s]", reason), failure ); } diff --git a/server/src/main/java/org/elasticsearch/index/engine/IndexVersionValue.java b/server/src/main/java/org/elasticsearch/index/engine/IndexVersionValue.java index 51d76db42959e..50953f4c26fd3 100644 --- a/server/src/main/java/org/elasticsearch/index/engine/IndexVersionValue.java +++ b/server/src/main/java/org/elasticsearch/index/engine/IndexVersionValue.java @@ -45,7 +45,7 @@ public int hashCode() { @Override public String toString() { - return "IndexVersionValue{" + "version=" + version + ", seqNo=" + seqNo + ", term=" + term + ", location=" + translogLocation + '}'; + return "IndexVersionValue{version=" + version + ", seqNo=" + seqNo + ", term=" + term + ", location=" + translogLocation + '}'; } @Override diff --git a/server/src/main/java/org/elasticsearch/index/engine/VersionValue.java b/server/src/main/java/org/elasticsearch/index/engine/VersionValue.java index b4d2767924df8..c1d66d98a1045 100644 --- a/server/src/main/java/org/elasticsearch/index/engine/VersionValue.java +++ b/server/src/main/java/org/elasticsearch/index/engine/VersionValue.java @@ -70,7 +70,7 @@ public int hashCode() { @Override public String toString() { - return "VersionValue{" + "version=" + version + ", seqNo=" + seqNo + ", term=" + term + '}'; + return "VersionValue{version=" + version + ", seqNo=" + seqNo + ", term=" + term + '}'; } /** diff --git a/server/src/main/java/org/elasticsearch/index/mapper/RuntimeField.java b/server/src/main/java/org/elasticsearch/index/mapper/RuntimeField.java index 1bf8c5d937e1c..9c9899b334827 100644 --- a/server/src/main/java/org/elasticsearch/index/mapper/RuntimeField.java +++ b/server/src/main/java/org/elasticsearch/index/mapper/RuntimeField.java @@ -162,7 +162,7 @@ static Map parseRuntimeFields( runtimeFields.put(fieldName, null); } else { throw new MapperParsingException( - "Runtime field [" + fieldName + "] was set to null but its removal is not supported " + "in this context" + "Runtime field [" + fieldName + "] was set to null but its removal is not supported in this context" ); } } else if (entry.getValue() instanceof Map) { diff --git a/server/src/main/java/org/elasticsearch/index/mapper/TypeParsers.java b/server/src/main/java/org/elasticsearch/index/mapper/TypeParsers.java index 4662c680d1561..16b2bab0d49ad 100644 --- a/server/src/main/java/org/elasticsearch/index/mapper/TypeParsers.java +++ b/server/src/main/java/org/elasticsearch/index/mapper/TypeParsers.java @@ -133,7 +133,7 @@ public static boolean parseMultiField( String multiFieldName = multiFieldEntry.getKey(); if (multiFieldName.contains(".")) { throw new MapperParsingException( - "Field name [" + multiFieldName + "] which is a multi field of [" + name + "] cannot" + " contain '.'" + "Field name [" + multiFieldName + "] which is a multi field of [" + name + "] cannot contain '.'" ); } if ((multiFieldEntry.getValue() instanceof Map) == false) { diff --git a/server/src/main/java/org/elasticsearch/index/mapper/flattened/FlattenedFieldParser.java b/server/src/main/java/org/elasticsearch/index/mapper/flattened/FlattenedFieldParser.java index 02ad93689dd7b..ecb7b1a736dbf 100644 --- a/server/src/main/java/org/elasticsearch/index/mapper/flattened/FlattenedFieldParser.java +++ b/server/src/main/java/org/elasticsearch/index/mapper/flattened/FlattenedFieldParser.java @@ -128,7 +128,7 @@ private void addField(ContentPath path, String currentName, String value, List depthLimit) { throw new IllegalArgumentException( - "The provided [flattened] field [" + rootFieldName + "]" + " exceeds the maximum depth limit of [" + depthLimit + "]." + "The provided [flattened] field [" + rootFieldName + "] exceeds the maximum depth limit of [" + depthLimit + "]." ); } } diff --git a/server/src/main/java/org/elasticsearch/index/mapper/vectors/DenseVectorFieldMapper.java b/server/src/main/java/org/elasticsearch/index/mapper/vectors/DenseVectorFieldMapper.java index 35525da88dec2..ffaa9d8340f60 100644 --- a/server/src/main/java/org/elasticsearch/index/mapper/vectors/DenseVectorFieldMapper.java +++ b/server/src/main/java/org/elasticsearch/index/mapper/vectors/DenseVectorFieldMapper.java @@ -306,7 +306,7 @@ public KnnVectorQuery createKnnQuery(float[] queryVector, int numCands, Query fi if (queryVector.length != dims) { throw new IllegalArgumentException( - "the query vector has a different dimension [" + queryVector.length + "] " + "than the index vectors [" + dims + "]" + "the query vector has a different dimension [" + queryVector.length + "] than the index vectors [" + dims + "]" ); } @@ -324,7 +324,7 @@ private void checkVectorMagnitude(float[] vector, float squaredMagnitude) { StringBuilder errorBuilder = null; if (similarity == VectorSimilarity.dot_product && Math.abs(squaredMagnitude - 1.0f) > 1e-4f) { errorBuilder = new StringBuilder( - "The [" + VectorSimilarity.dot_product.name() + "] similarity can " + "only be used with unit-length vectors." + "The [" + VectorSimilarity.dot_product.name() + "] similarity can only be used with unit-length vectors." ); } else if (similarity == VectorSimilarity.cosine && Math.sqrt(squaredMagnitude) == 0.0f) { errorBuilder = new StringBuilder( diff --git a/server/src/main/java/org/elasticsearch/index/query/AbstractQueryBuilder.java b/server/src/main/java/org/elasticsearch/index/query/AbstractQueryBuilder.java index f34bf256a56a5..e9ce701a75010 100644 --- a/server/src/main/java/org/elasticsearch/index/query/AbstractQueryBuilder.java +++ b/server/src/main/java/org/elasticsearch/index/query/AbstractQueryBuilder.java @@ -149,7 +149,7 @@ public final float boost() { protected final void checkNegativeBoost(float boost) { if (Float.compare(boost, 0f) < 0) { throw new IllegalArgumentException( - "negative [boost] are not allowed in [" + toString() + "], " + "use a value between 0 and 1 to deboost" + "negative [boost] are not allowed in [" + toString() + "], use a value between 0 and 1 to deboost" ); } } diff --git a/server/src/main/java/org/elasticsearch/index/query/FieldMaskingSpanQueryBuilder.java b/server/src/main/java/org/elasticsearch/index/query/FieldMaskingSpanQueryBuilder.java index dcb2e2d3e09ea..5ff78c048d383 100644 --- a/server/src/main/java/org/elasticsearch/index/query/FieldMaskingSpanQueryBuilder.java +++ b/server/src/main/java/org/elasticsearch/index/query/FieldMaskingSpanQueryBuilder.java @@ -110,7 +110,7 @@ public static FieldMaskingSpanQueryBuilder fromXContent(XContentParser parser) t if (query instanceof SpanQueryBuilder == false) { throw new ParsingException( parser.getTokenLocation(), - "[" + NAME.getPreferredName() + "] query must " + "be of type span query" + "[" + NAME.getPreferredName() + "] query must be of type span query" ); } inner = (SpanQueryBuilder) query; diff --git a/server/src/main/java/org/elasticsearch/index/query/Rewriteable.java b/server/src/main/java/org/elasticsearch/index/query/Rewriteable.java index c3d7dc1443210..b17cc77388fed 100644 --- a/server/src/main/java/org/elasticsearch/index/query/Rewriteable.java +++ b/server/src/main/java/org/elasticsearch/index/query/Rewriteable.java @@ -63,7 +63,7 @@ static > T rewrite(T original, QueryRewriteContext cont // this is some protection against user provided queries if they don't obey the contract of rewrite we allow 16 rounds // and then we fail to prevent infinite loops throw new IllegalStateException( - "too many rewrite rounds, rewriteable might return new objects even if they are not " + "rewritten" + "too many rewrite rounds, rewriteable might return new objects even if they are not rewritten" ); } } @@ -94,7 +94,7 @@ static > void rewriteAndFetch( // this is some protection against user provided queries if they don't obey the contract of rewrite we allow 16 rounds // and then we fail to prevent infinite loops throw new IllegalStateException( - "too many rewrite rounds, rewriteable might return new objects even if they are not " + "rewritten" + "too many rewrite rounds, rewriteable might return new objects even if they are not rewritten" ); } if (context.hasAsyncActions()) { diff --git a/server/src/main/java/org/elasticsearch/index/seqno/LocalCheckpointTracker.java b/server/src/main/java/org/elasticsearch/index/seqno/LocalCheckpointTracker.java index 1efe5b63329e5..c945fb4627611 100644 --- a/server/src/main/java/org/elasticsearch/index/seqno/LocalCheckpointTracker.java +++ b/server/src/main/java/org/elasticsearch/index/seqno/LocalCheckpointTracker.java @@ -62,7 +62,7 @@ public class LocalCheckpointTracker { public LocalCheckpointTracker(final long maxSeqNo, final long localCheckpoint) { if (localCheckpoint < 0 && localCheckpoint != SequenceNumbers.NO_OPS_PERFORMED) { throw new IllegalArgumentException( - "local checkpoint must be non-negative or [" + SequenceNumbers.NO_OPS_PERFORMED + "] " + "but was [" + localCheckpoint + "]" + "local checkpoint must be non-negative or [" + SequenceNumbers.NO_OPS_PERFORMED + "] but was [" + localCheckpoint + "]" ); } if (maxSeqNo < 0 && maxSeqNo != SequenceNumbers.NO_OPS_PERFORMED) { diff --git a/server/src/main/java/org/elasticsearch/index/seqno/RetentionLeases.java b/server/src/main/java/org/elasticsearch/index/seqno/RetentionLeases.java index bbb9806f92b75..57ee1ca69e750 100644 --- a/server/src/main/java/org/elasticsearch/index/seqno/RetentionLeases.java +++ b/server/src/main/java/org/elasticsearch/index/seqno/RetentionLeases.java @@ -274,7 +274,7 @@ public int hashCode() { @Override public String toString() { - return "RetentionLeases{" + "primaryTerm=" + primaryTerm + ", version=" + version + ", leases=" + leases + '}'; + return "RetentionLeases{primaryTerm=" + primaryTerm + ", version=" + version + ", leases=" + leases + '}'; } } diff --git a/server/src/main/java/org/elasticsearch/index/seqno/SequenceNumbers.java b/server/src/main/java/org/elasticsearch/index/seqno/SequenceNumbers.java index 79d19ded953b1..0cd451f6be2cf 100644 --- a/server/src/main/java/org/elasticsearch/index/seqno/SequenceNumbers.java +++ b/server/src/main/java/org/elasticsearch/index/seqno/SequenceNumbers.java @@ -114,7 +114,7 @@ public CommitInfo(long maxSeqNo, long localCheckpoint) { @Override public String toString() { - return "CommitInfo{" + "maxSeqNo=" + maxSeqNo + ", localCheckpoint=" + localCheckpoint + '}'; + return "CommitInfo{maxSeqNo=" + maxSeqNo + ", localCheckpoint=" + localCheckpoint + '}'; } } } diff --git a/server/src/main/java/org/elasticsearch/index/shard/ShardPath.java b/server/src/main/java/org/elasticsearch/index/shard/ShardPath.java index a31ac6903d03e..341276ecee76d 100644 --- a/server/src/main/java/org/elasticsearch/index/shard/ShardPath.java +++ b/server/src/main/java/org/elasticsearch/index/shard/ShardPath.java @@ -322,6 +322,6 @@ public int hashCode() { @Override public String toString() { - return "ShardPath{" + "path=" + path + ", shard=" + shardId + '}'; + return "ShardPath{path=" + path + ", shard=" + shardId + '}'; } } diff --git a/server/src/main/java/org/elasticsearch/node/Node.java b/server/src/main/java/org/elasticsearch/node/Node.java index 54ce372c9b1a3..87494341f4638 100644 --- a/server/src/main/java/org/elasticsearch/node/Node.java +++ b/server/src/main/java/org/elasticsearch/node/Node.java @@ -256,7 +256,7 @@ public class Node implements Closeable { (key) -> new Setting<>(key, "", (value) -> { if (value.length() > 0 && (Character.isWhitespace(value.charAt(0)) || Character.isWhitespace(value.charAt(value.length() - 1)))) { - throw new IllegalArgumentException(key + " cannot have leading or trailing whitespace " + "[" + value + "]"); + throw new IllegalArgumentException(key + " cannot have leading or trailing whitespace [" + value + "]"); } if (value.length() > 0 && "node.attr.server_name".equals(key)) { try { diff --git a/server/src/main/java/org/elasticsearch/rest/RestRequest.java b/server/src/main/java/org/elasticsearch/rest/RestRequest.java index d4e7486c8ad41..8835b8ca1ad61 100644 --- a/server/src/main/java/org/elasticsearch/rest/RestRequest.java +++ b/server/src/main/java/org/elasticsearch/rest/RestRequest.java @@ -144,7 +144,7 @@ protected RestRequest(RestRequest other) { if (header == null || header.isEmpty()) { return null; } else if (header.size() > 1) { - throw new IllegalArgumentException("Incorrect header [" + headerName + "]. " + "Only one value should be provided"); + throw new IllegalArgumentException("Incorrect header [" + headerName + "]. Only one value should be provided"); } String rawContentType = header.get(0); if (Strings.hasText(rawContentType)) { diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterHealthAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterHealthAction.java index df0b2c872a8fc..4b0340496120d 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterHealthAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterHealthAction.java @@ -70,7 +70,7 @@ public static ClusterHealthRequest fromRequest(final RestRequest request) { if (request.hasParam("wait_for_relocating_shards")) { // wait_for_relocating_shards has been removed in favor of wait_for_no_relocating_shards throw new IllegalArgumentException( - "wait_for_relocating_shards has been removed, " + "use wait_for_no_relocating_shards [true/false] instead" + "wait_for_relocating_shards has been removed, use wait_for_no_relocating_shards [true/false] instead" ); } String waitForActiveShards = request.param("wait_for_active_shards"); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsAction.java index 0b1b2e395715f..dfed1979120ee 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsAction.java @@ -34,7 +34,7 @@ public class RestNodesStatsAction extends BaseRestHandler { private final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestNodesStatsAction.class); - private static final String TYPES_DEPRECATION_MESSAGE = "[types removal] " + "Specifying types in nodes stats requests is deprecated."; + private static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Specifying types in nodes stats requests is deprecated."; @Override public List routes() { diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetFieldMappingAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetFieldMappingAction.java index 58d94047e805d..666d33a23bba9 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetFieldMappingAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetFieldMappingAction.java @@ -70,14 +70,14 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC boolean includeTypeName = request.paramAsBoolean(INCLUDE_TYPE_NAME_PARAMETER, DEFAULT_INCLUDE_TYPE_NAME_POLICY); final String[] types = request.paramAsStringArrayOrEmptyIfAll("type"); if (includeTypeName == false && types.length > 0) { - throw new IllegalArgumentException("Types cannot be specified unless include_type_name" + " is set to true."); + throw new IllegalArgumentException("Types cannot be specified unless include_type_name is set to true."); } if (request.hasParam("local")) { request.param("local"); deprecationLogger.compatibleCritical( "get_field_mapping_local", - "Use [local] in get field mapping requests is deprecated. " + "The parameter will be removed in the next major version" + "Use [local] in get field mapping requests is deprecated. The parameter will be removed in the next major version" ); } } diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java index a171db32fbc7a..d0bbd51da8d8b 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java @@ -66,7 +66,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC final String[] types = request.paramAsStringArrayOrEmptyIfAll("type"); if (request.paramAsBoolean(INCLUDE_TYPE_NAME_PARAMETER, DEFAULT_INCLUDE_TYPE_NAME_POLICY) == false && types.length > 0) { throw new IllegalArgumentException( - "Types cannot be provided in get mapping requests, unless" + " include_type_name is set to true." + "Types cannot be provided in get mapping requests, unless include_type_name is set to true." ); } if (request.method().equals(HEAD)) { diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsAction.java index dbe2f98d71e61..737c1ccc4cba6 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsAction.java @@ -82,7 +82,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC ? indicesStatsRequest.indicesOptions() : IndicesOptions.strictExpandOpen(); assert indicesStatsRequest.indicesOptions() == IndicesOptions.strictExpandOpenAndForbidClosed() - : "IndicesStats default indices " + "options changed"; + : "IndicesStats default indices options changed"; indicesStatsRequest.indicesOptions(IndicesOptions.fromRequest(request, defaultIndicesOption)); indicesStatsRequest.indices(Strings.splitStringByCommaToArray(request.param("index"))); diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java index a8b90878157ac..c657bb906ca01 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java @@ -74,7 +74,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC final String type = request.param("type"); if (includeTypeName == false && (type != null || isMappingSourceTyped(MapperService.SINGLE_MAPPING_NAME, sourceAsMap))) { throw new IllegalArgumentException( - "Types cannot be provided in put mapping requests, unless " + "the include_type_name parameter is set to true." + "Types cannot be provided in put mapping requests, unless the include_type_name parameter is set to true." ); } diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestValidateQueryAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestValidateQueryAction.java index 052ee9682e264..a211859c7236e 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestValidateQueryAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestValidateQueryAction.java @@ -34,7 +34,7 @@ public class RestValidateQueryAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestValidateQueryAction.class); - static final String TYPES_DEPRECATION_MESSAGE = "[types removal]" + " Specifying types in validate query requests is deprecated."; + static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Specifying types in validate query requests is deprecated."; @Override public List routes() { diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java index ac149b5d826d7..f1ab64fa0c662 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java @@ -241,7 +241,7 @@ protected Table getTableWithHeader(final RestRequest request) { ); table.addCell( "refresh.listeners", - "alias:rli,refreshListeners;default:false;text-align:right;" + "desc:number of pending refresh listeners" + "alias:rli,refreshListeners;default:false;text-align:right;desc:number of pending refresh listeners" ); table.addCell("script.compilations", "alias:scrcc,scriptCompilations;default:false;text-align:right;desc:script compilations"); diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestBulkAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestBulkAction.java index 286116f69d6ae..994b4fdf81b12 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestBulkAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestBulkAction.java @@ -37,7 +37,7 @@ * */ public class RestBulkAction extends BaseRestHandler { - public static final String TYPES_DEPRECATION_MESSAGE = "[types removal]" + " Specifying types in bulk requests is deprecated."; + public static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Specifying types in bulk requests is deprecated."; private final boolean allowExplicitIndex; diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiGetAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiGetAction.java index 3d6df0516fe7c..7637c553654a5 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiGetAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiGetAction.java @@ -26,7 +26,7 @@ import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestMultiGetAction extends BaseRestHandler { - public static final String TYPES_DEPRECATION_MESSAGE = "[types removal]" + " Specifying types in multi get requests is deprecated."; + public static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Specifying types in multi get requests is deprecated."; private final boolean allowExplicitIndex; diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiTermVectorsAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiTermVectorsAction.java index b5f542bc85f43..3881d0b916c65 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiTermVectorsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestMultiTermVectorsAction.java @@ -27,7 +27,7 @@ public class RestMultiTermVectorsAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestMultiTermVectorsAction.class); - static final String TYPES_DEPRECATION_MESSAGE = "[types removal] " + "Specifying types in multi term vector requests is deprecated."; + static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Specifying types in multi term vector requests is deprecated."; @Override public List routes() { diff --git a/server/src/main/java/org/elasticsearch/rest/action/document/RestTermVectorsAction.java b/server/src/main/java/org/elasticsearch/rest/action/document/RestTermVectorsAction.java index 9cc4b01576cbc..a67f346f86eaa 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/document/RestTermVectorsAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/document/RestTermVectorsAction.java @@ -32,7 +32,7 @@ * TermVectorsRequest. */ public class RestTermVectorsAction extends BaseRestHandler { - public static final String TYPES_DEPRECATION_MESSAGE = "[types removal] " + "Specifying types in term vector requests is deprecated."; + public static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Specifying types in term vector requests is deprecated."; @Override public List routes() { diff --git a/server/src/main/java/org/elasticsearch/rest/action/search/RestExplainAction.java b/server/src/main/java/org/elasticsearch/rest/action/search/RestExplainAction.java index d08a3703fa431..6830b7809de26 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/search/RestExplainAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/search/RestExplainAction.java @@ -29,7 +29,7 @@ * Rest action for computing a score explanation for specific documents. */ public class RestExplainAction extends BaseRestHandler { - public static final String TYPES_DEPRECATION_MESSAGE = "[types removal] " + "Specifying a type in explain requests is deprecated."; + public static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Specifying a type in explain requests is deprecated."; @Override public List routes() { @@ -68,7 +68,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC if (request.param("fields") != null) { throw new IllegalArgumentException( - "The parameter [fields] is no longer supported, " + "please use [stored_fields] to retrieve stored fields" + "The parameter [fields] is no longer supported, please use [stored_fields] to retrieve stored fields" ); } String sField = request.param("stored_fields"); diff --git a/server/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java b/server/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java index 14e6b07d74a1c..da4021fb11b80 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java @@ -57,7 +57,7 @@ public class RestSearchAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestSearchAction.class); - public static final String TYPES_DEPRECATION_MESSAGE = "[types removal]" + " Specifying types in search requests is deprecated."; + public static final String TYPES_DEPRECATION_MESSAGE = "[types removal] Specifying types in search requests is deprecated."; /** * Indicates whether hits.total should be rendered as an integer or an object @@ -362,7 +362,7 @@ static void preparePointInTime(SearchRequest request, RestRequest restRequest, N ActionRequestValidationException validationException = null; if (request.indices().length > 0) { validationException = addValidationError( - "[indices] cannot be used with point in time. Do " + "not specify any index with point in time.", + "[indices] cannot be used with point in time. Do not specify any index with point in time.", validationException ); } @@ -440,7 +440,7 @@ private static void checkRestTotalHits(RestRequest restRequest, SearchRequest se private static void checkSearchType(RestRequest restRequest, SearchRequest searchRequest) { if (restRequest.hasParam("search_type") && searchRequest.hasKnnSearch()) { throw new IllegalArgumentException( - "cannot set [search_type] when using [knn] search, since the search type " + "is determined automatically" + "cannot set [search_type] when using [knn] search, since the search type is determined automatically" ); } } diff --git a/server/src/test/java/org/elasticsearch/index/query/BoolQueryBuilderTests.java b/server/src/test/java/org/elasticsearch/index/query/BoolQueryBuilderTests.java index 7827d4c93816d..3c29391518e98 100644 --- a/server/src/test/java/org/elasticsearch/index/query/BoolQueryBuilderTests.java +++ b/server/src/test/java/org/elasticsearch/index/query/BoolQueryBuilderTests.java @@ -148,7 +148,7 @@ protected Map getAlternateVersions() { expectedQuery.filter(filter); } contentString = contentString.substring(0, contentString.length() - 1); - contentString += " } \n" + "}"; + contentString += " } \n}"; alternateVersions.put(contentString, expectedQuery); return alternateVersions; } diff --git a/server/src/test/java/org/elasticsearch/index/query/TermQueryBuilderTests.java b/server/src/test/java/org/elasticsearch/index/query/TermQueryBuilderTests.java index ea1f9c6160cb0..5e445529159ce 100644 --- a/server/src/test/java/org/elasticsearch/index/query/TermQueryBuilderTests.java +++ b/server/src/test/java/org/elasticsearch/index/query/TermQueryBuilderTests.java @@ -142,7 +142,7 @@ public void testGeo() throws Exception { SearchExecutionContext context = createSearchExecutionContext(); IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> query.toQuery(context)); assertEquals( - "Geometry fields do not support exact searching, " + "use dedicated geometry queries instead: [mapped_geo_point]", + "Geometry fields do not support exact searching, use dedicated geometry queries instead: [mapped_geo_point]", e.getMessage() ); } diff --git a/server/src/test/java/org/elasticsearch/index/query/TermsQueryBuilderTests.java b/server/src/test/java/org/elasticsearch/index/query/TermsQueryBuilderTests.java index 9cc03612ccbe4..45a0a2ce91e94 100644 --- a/server/src/test/java/org/elasticsearch/index/query/TermsQueryBuilderTests.java +++ b/server/src/test/java/org/elasticsearch/index/query/TermsQueryBuilderTests.java @@ -277,7 +277,7 @@ public void testGeo() throws Exception { SearchExecutionContext context = createSearchExecutionContext(); IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> query.toQuery(context)); assertEquals( - "Geometry fields do not support exact searching, use dedicated geometry queries instead: " + "[mapped_geo_point]", + "Geometry fields do not support exact searching, use dedicated geometry queries instead: [mapped_geo_point]", e.getMessage() ); } diff --git a/server/src/test/java/org/elasticsearch/index/query/functionscore/FunctionScoreTests.java b/server/src/test/java/org/elasticsearch/index/query/functionscore/FunctionScoreTests.java index 9c84658fc6a0a..edc2a03b301d4 100644 --- a/server/src/test/java/org/elasticsearch/index/query/functionscore/FunctionScoreTests.java +++ b/server/src/test/java/org/elasticsearch/index/query/functionscore/FunctionScoreTests.java @@ -439,7 +439,7 @@ public void testExplainFiltersFunctionScoreQuery() throws IOException { checkFiltersFunctionScoreExplanation(functionExplanation, "Function for field test:", 3); assertThat( functionExplanation.getDetails()[0].getDetails()[3].getDetails()[1].getDetails()[0].toString(), - equalTo("0.1 = exp(- " + "MAX[Math.max(Math.abs(1.0(=doc value) - 0.0(=origin))) - 0.0(=offset), 0)] * 2.3025850929940455)\n") + equalTo("0.1 = exp(- MAX[Math.max(Math.abs(1.0(=doc value) - 0.0(=origin))) - 0.0(=offset), 0)] * 2.3025850929940455)\n") ); assertThat(functionExplanation.getDetails()[0].getDetails()[3].getDetails()[1].getDetails()[0].getDetails().length, equalTo(0));