From 60b73052b8fb2191c53871cc8faefa4e521c5eb7 Mon Sep 17 00:00:00 2001 From: Jon Marius Venstad Date: Mon, 14 Dec 2020 11:57:52 +0100 Subject: Cleaner --- .../config/server/http/v2/ApplicationHandler.java | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'configserver') diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandler.java b/configserver/src/main/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandler.java index 0cc9a804d8c..9966f9c0770 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandler.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandler.java @@ -37,7 +37,6 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; import java.util.Set; -import java.util.StringJoiner; import java.util.stream.Stream; import static java.util.Map.Entry.comparingByKey; @@ -214,8 +213,7 @@ public class ApplicationHandler extends HttpHandler { } if (isReindexRequest(request)) { - String message = triggerReindexing(request, applicationId); - return new JSONResponse(Response.Status.OK) { { object.setString("message", message); } }; + return triggerReindexing(request, applicationId); } if (isReindexingRequest(request)) { @@ -226,7 +224,7 @@ public class ApplicationHandler extends HttpHandler { throw new NotFoundException("Illegal POST request '" + request.getUri() + "'"); } - private String triggerReindexing(HttpRequest request, ApplicationId applicationId) { + private HttpResponse triggerReindexing(HttpRequest request, ApplicationId applicationId) { Set clusters = StringUtilities.split(request.getProperty("clusterId")); Set types = StringUtilities.split(request.getProperty("documentType")); Instant now = applicationRepository.clock().instant(); @@ -242,12 +240,14 @@ public class ApplicationHandler extends HttpHandler { reindexing = reindexing.withReady(cluster, type, now); return reindexing; }); - return "Reindexing " + - (clusters.isEmpty() ? "" - : (types.isEmpty() ? "" - : "document types " + String.join(", ", types) + " in ") + - "clusters " + String.join(", ", clusters) + " of ") + - "application " + applicationId; + + String message = "Reindexing " + + (clusters.isEmpty() ? "" + : (types.isEmpty() ? "" + : "document types " + String.join(", ", types) + " in ") + + "clusters " + String.join(", ", clusters) + " of ") + + "application " + applicationId; + return new JSONResponse(Response.Status.OK) { { object.setString("message", message); } }; } private HttpResponse getReindexingStatus(ApplicationId applicationId) { -- cgit v1.2.3