From aebec5bb87c6cfae016d1797edd978eb21363323 Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Thu, 25 Oct 2018 15:47:24 -0500 Subject: [PATCH 1/4] Enforce 140 char line lengths for packages action.bulk/delete/explain/get/index part of #34884 --- .../resources/checkstyle_suppressions.xml | 13 -------- .../action/bulk/BackoffPolicy.java | 3 +- .../action/bulk/BulkProcessor.java | 8 +++-- .../action/bulk/BulkRequest.java | 13 +++++--- .../action/bulk/BulkResponse.java | 3 +- .../action/bulk/TransportBulkAction.java | 33 ++++++++++++------- .../action/delete/DeleteRequest.java | 6 ++-- .../explain/TransportExplainAction.java | 9 +++-- .../elasticsearch/action/get/GetRequest.java | 4 +-- .../action/get/MultiGetRequest.java | 14 +++++--- .../action/get/TransportGetAction.java | 3 +- .../get/TransportShardMultiGetAction.java | 4 +-- .../action/index/IndexRequest.java | 12 ++++--- 13 files changed, 73 insertions(+), 52 deletions(-) diff --git a/buildSrc/src/main/resources/checkstyle_suppressions.xml b/buildSrc/src/main/resources/checkstyle_suppressions.xml index df90fe70497f5..40dcfab3adfa1 100644 --- a/buildSrc/src/main/resources/checkstyle_suppressions.xml +++ b/buildSrc/src/main/resources/checkstyle_suppressions.xml @@ -130,19 +130,6 @@ - - - - - - - - - - - - - diff --git a/server/src/main/java/org/elasticsearch/action/bulk/BackoffPolicy.java b/server/src/main/java/org/elasticsearch/action/bulk/BackoffPolicy.java index 81084e22377e5..00462df4d895c 100644 --- a/server/src/main/java/org/elasticsearch/action/bulk/BackoffPolicy.java +++ b/server/src/main/java/org/elasticsearch/action/bulk/BackoffPolicy.java @@ -34,7 +34,8 @@ * semantics: * *
    - *
  • #hasNext() determines whether the progression has more elements. Return true for infinite progressions
  • + *
  • #hasNext() determines whether the progression has more elements. Return true for infinite progressions + *
  • *
  • #next() determines the next element in the progression, i.e. the next wait time period
  • *
* diff --git a/server/src/main/java/org/elasticsearch/action/bulk/BulkProcessor.java b/server/src/main/java/org/elasticsearch/action/bulk/BulkProcessor.java index f8f9d154b14d6..a2cae6b7bec29 100644 --- a/server/src/main/java/org/elasticsearch/action/bulk/BulkProcessor.java +++ b/server/src/main/java/org/elasticsearch/action/bulk/BulkProcessor.java @@ -217,12 +217,13 @@ public void close() { * Closes the processor. If flushing by time is enabled, then it's shutdown. Any remaining bulk actions are flushed. *

* If concurrent requests are not enabled, returns {@code true} immediately. - * If concurrent requests are enabled, waits for up to the specified timeout for all bulk requests to complete then returns {@code true}, + * If concurrent requests are enabled, waits for up to the specified timeout for all bulk requests to complete then returns {@code true} * If the specified waiting time elapses before all bulk requests complete, {@code false} is returned. * * @param timeout The maximum time to wait for the bulk requests to complete * @param unit The time unit of the {@code timeout} argument - * @return {@code true} if all bulk requests completed and {@code false} if the waiting time elapsed before all the bulk requests completed + * @return {@code true} if all bulk requests completed and {@code false} if the waiting time elapsed before all the bulk requests + * completed * @throws InterruptedException If the current thread is interrupted */ public synchronized boolean awaitClose(long timeout, TimeUnit unit) throws InterruptedException { @@ -298,7 +299,8 @@ public BulkProcessor add(BytesReference data, @Nullable String defaultIndex, @Nu * Adds the data from the bytes to be processed by the bulk processor */ public synchronized BulkProcessor add(BytesReference data, @Nullable String defaultIndex, @Nullable String defaultType, - @Nullable String defaultPipeline, @Nullable Object payload, XContentType xContentType) throws Exception { + @Nullable String defaultPipeline, @Nullable Object payload, + XContentType xContentType) throws Exception { bulkRequest.add(data, defaultIndex, defaultType, null, null, defaultPipeline, payload, true, xContentType); executeIfNeeded(); return this; diff --git a/server/src/main/java/org/elasticsearch/action/bulk/BulkRequest.java b/server/src/main/java/org/elasticsearch/action/bulk/BulkRequest.java index 6698aa4b62ab5..c10dcc020823a 100644 --- a/server/src/main/java/org/elasticsearch/action/bulk/BulkRequest.java +++ b/server/src/main/java/org/elasticsearch/action/bulk/BulkRequest.java @@ -369,20 +369,23 @@ public BulkRequest add(BytesReference data, @Nullable String defaultIndex, @Null } else if (SOURCE.match(currentFieldName, parser.getDeprecationHandler())) { fetchSourceContext = FetchSourceContext.fromXContent(parser); } else { - throw new IllegalArgumentException("Action/metadata line [" + line + "] contains an unknown parameter [" + currentFieldName + "]"); + throw new IllegalArgumentException("Action/metadata line [" + line + "] contains an unknown parameter [" + + currentFieldName + "]"); } } else if (token == XContentParser.Token.START_ARRAY) { throw new IllegalArgumentException("Malformed action/metadata line [" + line + "], expected a simple value for field [" + currentFieldName + "] but found [" + token + "]"); - } else if (token == XContentParser.Token.START_OBJECT && SOURCE.match(currentFieldName, parser.getDeprecationHandler())) { + } else if (token == XContentParser.Token.START_OBJECT && SOURCE.match(currentFieldName, + parser.getDeprecationHandler())) { fetchSourceContext = FetchSourceContext.fromXContent(parser); } else if (token != XContentParser.Token.VALUE_NULL) { - throw new IllegalArgumentException("Malformed action/metadata line [" + line + "], expected a simple value for field [" + currentFieldName + "] but found [" + token + "]"); + throw new IllegalArgumentException("Malformed action/metadata line [" + line + + "], expected a simple value for field [" + currentFieldName + "] but found [" + token + "]"); } } } else if (token != XContentParser.Token.END_OBJECT) { - throw new IllegalArgumentException("Malformed action/metadata line [" + line + "], expected " + XContentParser.Token.START_OBJECT - + " or " + XContentParser.Token.END_OBJECT + " but found [" + token + "]"); + throw new IllegalArgumentException("Malformed action/metadata line [" + line + "], expected " + + XContentParser.Token.START_OBJECT + " or " + XContentParser.Token.END_OBJECT + " but found [" + token + "]"); } if ("delete".equals(action)) { diff --git a/server/src/main/java/org/elasticsearch/action/bulk/BulkResponse.java b/server/src/main/java/org/elasticsearch/action/bulk/BulkResponse.java index 30bf2dc14773b..d474dcee3639b 100644 --- a/server/src/main/java/org/elasticsearch/action/bulk/BulkResponse.java +++ b/server/src/main/java/org/elasticsearch/action/bulk/BulkResponse.java @@ -109,7 +109,8 @@ public String buildFailureMessage() { BulkItemResponse response = responses[i]; if (response.isFailed()) { sb.append("\n[").append(i) - .append("]: index [").append(response.getIndex()).append("], type [").append(response.getType()).append("], id [").append(response.getId()) + .append("]: index [").append(response.getIndex()).append("], type [") + .append(response.getType()).append("], id [").append(response.getId()) .append("], message [").append(response.getFailureMessage()).append("]"); } } diff --git a/server/src/main/java/org/elasticsearch/action/bulk/TransportBulkAction.java b/server/src/main/java/org/elasticsearch/action/bulk/TransportBulkAction.java index a3d7d50f3e22a..6b6fc9193c9be 100644 --- a/server/src/main/java/org/elasticsearch/action/bulk/TransportBulkAction.java +++ b/server/src/main/java/org/elasticsearch/action/bulk/TransportBulkAction.java @@ -256,9 +256,11 @@ void createIndex(String index, TimeValue timeout, ActionListener responses, int idx, DocWriteRequest request, String index, Exception e) { + private boolean setResponseFailureIfIndexMatches(AtomicArray responses, int idx, DocWriteRequest request, + String index, Exception e) { if (index.equals(request.index())) { - responses.set(idx, new BulkItemResponse(idx, request.opType(), new BulkItemResponse.Failure(request.index(), request.type(), request.id(), e))); + responses.set(idx, new BulkItemResponse(idx, request.opType(), new BulkItemResponse.Failure(request.index(), request.type(), + request.id(), e))); return true; } return false; @@ -327,19 +329,22 @@ protected void doRun() throws Exception { indexRequest.process(indexCreated, mappingMd, concreteIndex.getName()); break; case UPDATE: - TransportUpdateAction.resolveAndValidateRouting(metaData, concreteIndex.getName(), (UpdateRequest) docWriteRequest); + TransportUpdateAction.resolveAndValidateRouting(metaData, concreteIndex.getName(), + (UpdateRequest) docWriteRequest); break; case DELETE: docWriteRequest.routing(metaData.resolveWriteIndexRouting(docWriteRequest.routing(), docWriteRequest.index())); // check if routing is required, if so, throw error if routing wasn't specified - if (docWriteRequest.routing() == null && metaData.routingRequired(concreteIndex.getName(), docWriteRequest.type())) { + if (docWriteRequest.routing() == null && metaData.routingRequired(concreteIndex.getName(), + docWriteRequest.type())) { throw new RoutingMissingException(concreteIndex.getName(), docWriteRequest.type(), docWriteRequest.id()); } break; default: throw new AssertionError("request type not supported: [" + docWriteRequest.opType() + "]"); } } catch (ElasticsearchParseException | IllegalArgumentException | RoutingMissingException e) { - BulkItemResponse.Failure failure = new BulkItemResponse.Failure(concreteIndex.getName(), docWriteRequest.type(), docWriteRequest.id(), e); + BulkItemResponse.Failure failure = new BulkItemResponse.Failure(concreteIndex.getName(), docWriteRequest.type(), + docWriteRequest.id(), e); BulkItemResponse bulkItemResponse = new BulkItemResponse(i, docWriteRequest.opType(), failure); responses.set(i, bulkItemResponse); // make sure the request gets never processed again @@ -355,13 +360,15 @@ protected void doRun() throws Exception { continue; } String concreteIndex = concreteIndices.getConcreteIndex(request.index()).getName(); - ShardId shardId = clusterService.operationRouting().indexShards(clusterState, concreteIndex, request.id(), request.routing()).shardId(); + ShardId shardId = clusterService.operationRouting().indexShards(clusterState, concreteIndex, request.id(), + request.routing()).shardId(); List shardRequests = requestsByShard.computeIfAbsent(shardId, shard -> new ArrayList<>()); shardRequests.add(new BulkItemRequest(i, request)); } if (requestsByShard.isEmpty()) { - listener.onResponse(new BulkResponse(responses.toArray(new BulkItemResponse[responses.length()]), buildTookInMillis(startTimeNanos))); + listener.onResponse(new BulkResponse(responses.toArray(new BulkItemResponse[responses.length()]), + buildTookInMillis(startTimeNanos))); return; } @@ -407,7 +414,8 @@ public void onFailure(Exception e) { } private void finishHim() { - listener.onResponse(new BulkResponse(responses.toArray(new BulkItemResponse[responses.length()]), buildTookInMillis(startTimeNanos))); + listener.onResponse(new BulkResponse(responses.toArray(new BulkItemResponse[responses.length()]), + buildTookInMillis(startTimeNanos))); } }); } @@ -535,7 +543,8 @@ void processBulkIndexIngestRequest(Task task, BulkRequest original, ActionListen } else { long ingestTookInMillis = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - ingestStartTimeInNanos); BulkRequest bulkRequest = bulkRequestModifier.getBulkRequest(); - ActionListener actionListener = bulkRequestModifier.wrapActionListenerIfNeeded(ingestTookInMillis, listener); + ActionListener actionListener = bulkRequestModifier.wrapActionListenerIfNeeded(ingestTookInMillis, + listener); if (bulkRequest.requests().isEmpty()) { // at this stage, the transport bulk action can't deal with a bulk request with no requests, // so we stop and send an empty response back to the client. @@ -628,7 +637,8 @@ void markCurrentItemAsFailed(Exception e) { // 2) Add a bulk item failure for this request // 3) Continue with the next request in the bulk. failedSlots.set(currentSlot); - BulkItemResponse.Failure failure = new BulkItemResponse.Failure(indexRequest.index(), indexRequest.type(), indexRequest.id(), e); + BulkItemResponse.Failure failure = new BulkItemResponse.Failure(indexRequest.index(), indexRequest.type(), + indexRequest.id(), e); itemResponses.add(new BulkItemResponse(currentSlot, indexRequest.opType(), failure)); } @@ -641,7 +651,8 @@ static final class IngestBulkResponseListener implements ActionListener itemResponses; private final ActionListener actionListener; - IngestBulkResponseListener(long ingestTookInMillis, int[] originalSlots, List itemResponses, ActionListener actionListener) { + IngestBulkResponseListener(long ingestTookInMillis, int[] originalSlots, List itemResponses, + ActionListener actionListener) { this.ingestTookInMillis = ingestTookInMillis; this.itemResponses = itemResponses; this.actionListener = actionListener; diff --git a/server/src/main/java/org/elasticsearch/action/delete/DeleteRequest.java b/server/src/main/java/org/elasticsearch/action/delete/DeleteRequest.java index 879e8e665cd44..cf4b94ff4c61e 100644 --- a/server/src/main/java/org/elasticsearch/action/delete/DeleteRequest.java +++ b/server/src/main/java/org/elasticsearch/action/delete/DeleteRequest.java @@ -46,7 +46,8 @@ * @see org.elasticsearch.client.Client#delete(DeleteRequest) * @see org.elasticsearch.client.Requests#deleteRequest(String) */ -public class DeleteRequest extends ReplicatedWriteRequest implements DocWriteRequest, CompositeIndicesRequest { +public class DeleteRequest extends ReplicatedWriteRequest implements DocWriteRequest, + CompositeIndicesRequest { private String type; private String id; @@ -89,7 +90,8 @@ public ActionRequestValidationException validate() { validationException = addValidationError("id is missing", validationException); } if (!versionType.validateVersionForWrites(version)) { - validationException = addValidationError("illegal version value [" + version + "] for version type [" + versionType.name() + "]", validationException); + validationException = addValidationError("illegal version value [" + version + "] for version type [" + + versionType.name() + "]", validationException); } if (versionType == VersionType.FORCE) { validationException = addValidationError("version type [force] may no longer be used", validationException); diff --git a/server/src/main/java/org/elasticsearch/action/explain/TransportExplainAction.java b/server/src/main/java/org/elasticsearch/action/explain/TransportExplainAction.java index c1695e13864cb..aff9594ff13ac 100644 --- a/server/src/main/java/org/elasticsearch/action/explain/TransportExplainAction.java +++ b/server/src/main/java/org/elasticsearch/action/explain/TransportExplainAction.java @@ -90,7 +90,8 @@ protected void resolveRequest(ClusterState state, InternalRequest request) { } @Override - protected void asyncShardOperation(ExplainRequest request, ShardId shardId, ActionListener listener) throws IOException { + protected void asyncShardOperation(ExplainRequest request, ShardId shardId, + ActionListener listener) throws IOException { IndexService indexService = searchService.getIndicesService().indexServiceSafe(shardId.getIndex()); IndexShard indexShard = indexService.getShard(shardId.id()); indexShard.awaitShardSearchActive(b -> { @@ -129,7 +130,8 @@ protected ExplainResponse shardOperation(ExplainRequest request, ShardId shardId // Advantage is that we're not opening a second searcher to retrieve the _source. Also // because we are working in the same searcher in engineGetResult we can be sure that a // doc isn't deleted between the initial get and this call. - GetResult getResult = context.indexShard().getService().get(result, request.id(), request.type(), request.storedFields(), request.fetchSourceContext()); + GetResult getResult = context.indexShard().getService().get(result, request.id(), request.type(), request.storedFields(), + request.fetchSourceContext()); return new ExplainResponse(shardId.getIndexName(), request.type(), request.id(), true, explanation, getResult); } else { return new ExplainResponse(shardId.getIndexName(), request.type(), request.id(), true, explanation); @@ -149,7 +151,8 @@ protected ExplainResponse newResponse() { @Override protected ShardIterator shards(ClusterState state, InternalRequest request) { return clusterService.operationRouting().getShards( - clusterService.state(), request.concreteIndex(), request.request().id(), request.request().routing(), request.request().preference() + clusterService.state(), request.concreteIndex(), request.request().id(), request.request().routing(), + request.request().preference() ); } diff --git a/server/src/main/java/org/elasticsearch/action/get/GetRequest.java b/server/src/main/java/org/elasticsearch/action/get/GetRequest.java index f4f7f8ba7940a..090935107a778 100644 --- a/server/src/main/java/org/elasticsearch/action/get/GetRequest.java +++ b/server/src/main/java/org/elasticsearch/action/get/GetRequest.java @@ -98,8 +98,8 @@ public ActionRequestValidationException validate() { validationException = ValidateActions.addValidationError("id is missing", validationException); } if (!versionType.validateVersionForReads(version)) { - validationException = ValidateActions.addValidationError("illegal version value [" + version + "] for version type [" + versionType.name() + "]", - validationException); + validationException = ValidateActions.addValidationError("illegal version value [" + version + "] for version type [" + + versionType.name() + "]", validationException); } if (versionType == VersionType.FORCE) { validationException = ValidateActions.addValidationError("version type [force] may no longer be used", validationException); diff --git a/server/src/main/java/org/elasticsearch/action/get/MultiGetRequest.java b/server/src/main/java/org/elasticsearch/action/get/MultiGetRequest.java index 875015f8a9879..df23bad10bce7 100644 --- a/server/src/main/java/org/elasticsearch/action/get/MultiGetRequest.java +++ b/server/src/main/java/org/elasticsearch/action/get/MultiGetRequest.java @@ -360,7 +360,8 @@ public MultiGetRequest add(@Nullable String defaultIndex, @Nullable String defau currentFieldName = parser.currentName(); } else if (token == Token.START_ARRAY) { if ("docs".equals(currentFieldName)) { - parseDocuments(parser, this.items, defaultIndex, defaultType, defaultFields, defaultFetchSource, defaultRouting, allowExplicitIndex); + parseDocuments(parser, this.items, defaultIndex, defaultType, defaultFields, defaultFetchSource, defaultRouting, + allowExplicitIndex); } else if ("ids".equals(currentFieldName)) { parseIds(parser, this.items, defaultIndex, defaultType, defaultFields, defaultFetchSource, defaultRouting); } else { @@ -384,7 +385,9 @@ public MultiGetRequest add(@Nullable String defaultIndex, @Nullable String defau return this; } - private static void parseDocuments(XContentParser parser, List items, @Nullable String defaultIndex, @Nullable String defaultType, @Nullable String[] defaultFields, @Nullable FetchSourceContext defaultFetchSource, @Nullable String defaultRouting, boolean allowExplicitIndex) throws IOException { + private static void parseDocuments(XContentParser parser, List items, @Nullable String defaultIndex, @Nullable String defaultType, + @Nullable String[] defaultFields, @Nullable FetchSourceContext defaultFetchSource, + @Nullable String defaultRouting, boolean allowExplicitIndex) throws IOException { String currentFieldName = null; Token token; while ((token = parser.nextToken()) != Token.END_ARRAY) { @@ -499,13 +502,16 @@ private static void parseDocuments(XContentParser parser, List items, @Nul } } - public static void parseIds(XContentParser parser, List items, @Nullable String defaultIndex, @Nullable String defaultType, @Nullable String[] defaultFields, @Nullable FetchSourceContext defaultFetchSource, @Nullable String defaultRouting) throws IOException { + public static void parseIds(XContentParser parser, List items, @Nullable String defaultIndex, @Nullable String defaultType, + @Nullable String[] defaultFields, @Nullable FetchSourceContext defaultFetchSource, + @Nullable String defaultRouting) throws IOException { Token token; while ((token = parser.nextToken()) != Token.END_ARRAY) { if (!token.isValue()) { throw new IllegalArgumentException("ids array element should only contain ids"); } - items.add(new Item(defaultIndex, defaultType, parser.text()).storedFields(defaultFields).fetchSourceContext(defaultFetchSource).routing(defaultRouting)); + items.add(new Item(defaultIndex, defaultType, parser.text()).storedFields(defaultFields).fetchSourceContext(defaultFetchSource) + .routing(defaultRouting)); } } diff --git a/server/src/main/java/org/elasticsearch/action/get/TransportGetAction.java b/server/src/main/java/org/elasticsearch/action/get/TransportGetAction.java index 69753bdd9795e..fcdece29e1b77 100644 --- a/server/src/main/java/org/elasticsearch/action/get/TransportGetAction.java +++ b/server/src/main/java/org/elasticsearch/action/get/TransportGetAction.java @@ -63,7 +63,8 @@ protected boolean resolveIndex(GetRequest request) { @Override protected ShardIterator shards(ClusterState state, InternalRequest request) { return clusterService.operationRouting() - .getShards(clusterService.state(), request.concreteIndex(), request.request().id(), request.request().routing(), request.request().preference()); + .getShards(clusterService.state(), request.concreteIndex(), request.request().id(), request.request().routing(), + request.request().preference()); } @Override diff --git a/server/src/main/java/org/elasticsearch/action/get/TransportShardMultiGetAction.java b/server/src/main/java/org/elasticsearch/action/get/TransportShardMultiGetAction.java index 7a7c02ad476e7..46d0b374a59c1 100644 --- a/server/src/main/java/org/elasticsearch/action/get/TransportShardMultiGetAction.java +++ b/server/src/main/java/org/elasticsearch/action/get/TransportShardMultiGetAction.java @@ -86,8 +86,8 @@ protected MultiGetShardResponse shardOperation(MultiGetShardRequest request, Sha for (int i = 0; i < request.locations.size(); i++) { MultiGetRequest.Item item = request.items.get(i); try { - GetResult getResult = indexShard.getService().get(item.type(), item.id(), item.storedFields(), request.realtime(), item.version(), - item.versionType(), item.fetchSourceContext()); + GetResult getResult = indexShard.getService().get(item.type(), item.id(), item.storedFields(), request.realtime(), + item.version(), item.versionType(), item.fetchSourceContext()); response.add(request.locations.get(i), new GetResponse(getResult)); } catch (RuntimeException e) { if (TransportActions.isShardNotAvailableException(e)) { diff --git a/server/src/main/java/org/elasticsearch/action/index/IndexRequest.java b/server/src/main/java/org/elasticsearch/action/index/IndexRequest.java index 339880dad44bf..157ec3511100c 100644 --- a/server/src/main/java/org/elasticsearch/action/index/IndexRequest.java +++ b/server/src/main/java/org/elasticsearch/action/index/IndexRequest.java @@ -154,12 +154,14 @@ public ActionRequestValidationException validate() { final long resolvedVersion = resolveVersionDefaults(); if (opType() == OpType.CREATE) { if (versionType != VersionType.INTERNAL) { - validationException = addValidationError("create operations only support internal versioning. use index instead", validationException); + validationException = addValidationError("create operations only support internal versioning. use index instead", + validationException); return validationException; } if (resolvedVersion != Versions.MATCH_DELETED) { - validationException = addValidationError("create operations do not support explicit versions. use index instead", validationException); + validationException = addValidationError("create operations do not support explicit versions. use index instead", + validationException); return validationException; } } @@ -169,7 +171,8 @@ public ActionRequestValidationException validate() { } if (!versionType.validateVersionForWrites(resolvedVersion)) { - validationException = addValidationError("illegal version value [" + resolvedVersion + "] for version type [" + versionType.name() + "]", validationException); + validationException = addValidationError("illegal version value [" + resolvedVersion + "] for version type [" + + versionType.name() + "]", validationException); } if (versionType == VersionType.FORCE) { @@ -347,7 +350,8 @@ public IndexRequest source(XContentType xContentType, Object... source) { throw new IllegalArgumentException("The number of object passed must be even but was [" + source.length + "]"); } if (source.length == 2 && source[0] instanceof BytesReference && source[1] instanceof Boolean) { - throw new IllegalArgumentException("you are using the removed method for source with bytes and unsafe flag, the unsafe flag was removed, please just use source(BytesReference)"); + throw new IllegalArgumentException("you are using the removed method for source with bytes and unsafe flag, the unsafe flag" + + " was removed, please just use source(BytesReference)"); } try { XContentBuilder builder = XContentFactory.contentBuilder(xContentType); From 4e0405e06f0c64979aa0ade4e4afeac1325ebf9c Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Thu, 25 Oct 2018 16:01:00 -0500 Subject: [PATCH 2/4] include the tests --- buildSrc/src/main/resources/checkstyle_suppressions.xml | 3 --- .../org/elasticsearch/action/bulk/BulkRequestTests.java | 6 ++++-- .../test/java/org/elasticsearch/action/bulk/RetryTests.java | 3 ++- .../elasticsearch/action/get/MultiGetShardRequestTests.java | 3 ++- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/buildSrc/src/main/resources/checkstyle_suppressions.xml b/buildSrc/src/main/resources/checkstyle_suppressions.xml index 40dcfab3adfa1..969fe6e448684 100644 --- a/buildSrc/src/main/resources/checkstyle_suppressions.xml +++ b/buildSrc/src/main/resources/checkstyle_suppressions.xml @@ -379,9 +379,6 @@ - - - diff --git a/server/src/test/java/org/elasticsearch/action/bulk/BulkRequestTests.java b/server/src/test/java/org/elasticsearch/action/bulk/BulkRequestTests.java index 1b2c238098e50..65935bea96e59 100644 --- a/server/src/test/java/org/elasticsearch/action/bulk/BulkRequestTests.java +++ b/server/src/test/java/org/elasticsearch/action/bulk/BulkRequestTests.java @@ -165,7 +165,8 @@ public void testSimpleBulk9() throws Exception { BulkRequest bulkRequest = new BulkRequest(); IllegalArgumentException exc = expectThrows(IllegalArgumentException.class, () -> bulkRequest.add(bulkAction.getBytes(StandardCharsets.UTF_8), 0, bulkAction.length(), null, null, XContentType.JSON)); - assertThat(exc.getMessage(), containsString("Malformed action/metadata line [3], expected START_OBJECT or END_OBJECT but found [START_ARRAY]")); + assertThat(exc.getMessage(), + containsString("Malformed action/metadata line [3], expected START_OBJECT or END_OBJECT but found [START_ARRAY]")); } public void testSimpleBulk10() throws Exception { @@ -207,7 +208,8 @@ public void testBulkEmptyObject() throws Exception { BulkRequest bulkRequest = new BulkRequest(); IllegalArgumentException exc = expectThrows(IllegalArgumentException.class, () -> bulkRequest.add(bulkAction.getBytes(StandardCharsets.UTF_8), 0, bulkAction.length(), null, null, XContentType.JSON)); - assertThat(exc.getMessage(), containsString("Malformed action/metadata line [" + emptyLine + "], expected FIELD_NAME but found [END_OBJECT]")); + assertThat(exc.getMessage(), containsString("Malformed action/metadata line [" + + emptyLine + "], expected FIELD_NAME but found [END_OBJECT]")); } // issue 7361 diff --git a/server/src/test/java/org/elasticsearch/action/bulk/RetryTests.java b/server/src/test/java/org/elasticsearch/action/bulk/RetryTests.java index f9cdfa092ae3c..decee8ceab714 100644 --- a/server/src/test/java/org/elasticsearch/action/bulk/RetryTests.java +++ b/server/src/test/java/org/elasticsearch/action/bulk/RetryTests.java @@ -230,7 +230,8 @@ private BulkItemResponse successfulResponse() { } private BulkItemResponse failedResponse() { - return new BulkItemResponse(1, OpType.INDEX, new BulkItemResponse.Failure("test", "test", "1", new EsRejectedExecutionException("pool full"))); + return new BulkItemResponse(1, OpType.INDEX, new BulkItemResponse.Failure("test", "test", "1", + new EsRejectedExecutionException("pool full"))); } } } diff --git a/server/src/test/java/org/elasticsearch/action/get/MultiGetShardRequestTests.java b/server/src/test/java/org/elasticsearch/action/get/MultiGetShardRequestTests.java index a130f10d65908..782edb517cb13 100644 --- a/server/src/test/java/org/elasticsearch/action/get/MultiGetShardRequestTests.java +++ b/server/src/test/java/org/elasticsearch/action/get/MultiGetShardRequestTests.java @@ -45,7 +45,8 @@ public void testSerialization() throws IOException { MultiGetShardRequest multiGetShardRequest = new MultiGetShardRequest(multiGetRequest, "index", 0); int numItems = iterations(10, 30); for (int i = 0; i < numItems; i++) { - MultiGetRequest.Item item = new MultiGetRequest.Item("alias-" + randomAlphaOfLength(randomIntBetween(1, 10)), "type", "id-" + i); + MultiGetRequest.Item item = new MultiGetRequest.Item("alias-" + randomAlphaOfLength(randomIntBetween(1, 10)), + "type", "id-" + i); if (randomBoolean()) { int numFields = randomIntBetween(1, 5); String[] fields = new String[numFields]; From 460697a601eb6f37b048a2ae64647ccfbcce48a1 Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Fri, 26 Oct 2018 09:24:14 -0500 Subject: [PATCH 3/4] format update --- .../java/org/elasticsearch/action/delete/DeleteRequest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/action/delete/DeleteRequest.java b/server/src/main/java/org/elasticsearch/action/delete/DeleteRequest.java index cf4b94ff4c61e..ee9c863c0118c 100644 --- a/server/src/main/java/org/elasticsearch/action/delete/DeleteRequest.java +++ b/server/src/main/java/org/elasticsearch/action/delete/DeleteRequest.java @@ -46,8 +46,8 @@ * @see org.elasticsearch.client.Client#delete(DeleteRequest) * @see org.elasticsearch.client.Requests#deleteRequest(String) */ -public class DeleteRequest extends ReplicatedWriteRequest implements DocWriteRequest, - CompositeIndicesRequest { +public class DeleteRequest extends ReplicatedWriteRequest + implements DocWriteRequest, CompositeIndicesRequest { private String type; private String id; From 58755ce65a6889e35a6694ea4e9e329f5b0b3cc4 Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Fri, 26 Oct 2018 09:33:18 -0500 Subject: [PATCH 4/4] remove extra newline from merge resolution --- buildSrc/src/main/resources/checkstyle_suppressions.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/buildSrc/src/main/resources/checkstyle_suppressions.xml b/buildSrc/src/main/resources/checkstyle_suppressions.xml index eb29295fd9588..de428ae816b26 100644 --- a/buildSrc/src/main/resources/checkstyle_suppressions.xml +++ b/buildSrc/src/main/resources/checkstyle_suppressions.xml @@ -306,7 +306,6 @@ -