JAMES-2575 join two stream operations into one statement

Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/1e39ae08
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/1e39ae08
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/1e39ae08

Branch: refs/heads/master
Commit: 1e39ae088b9aa16329c7be020cbc60fd3ac6e001
Parents: b3604a9
Author: Michael Schnitzler <[email protected]>
Authored: Mon Oct 29 16:41:47 2018 +0100
Committer: Benoit Tellier <[email protected]>
Committed: Wed Oct 31 08:48:29 2018 +0700

----------------------------------------------------------------------
 .../org/apache/james/webadmin/routes/HealthCheckRoutes.java  | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/1e39ae08/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/routes/HealthCheckRoutes.java
----------------------------------------------------------------------
diff --git 
a/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/routes/HealthCheckRoutes.java
 
b/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/routes/HealthCheckRoutes.java
index 2c28015..c28e2b1 100644
--- 
a/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/routes/HealthCheckRoutes.java
+++ 
b/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/routes/HealthCheckRoutes.java
@@ -110,11 +110,11 @@ public class HealthCheckRoutes implements PublicRoutes {
     })
     public Object performHealthCheckForComponent(Request request, Response 
response) {
         String componentName = request.params(PARAM_COMPONENT_NAME);
-        Optional<HealthCheck> optHealthCheck = healthChecks.stream()
+        HealthCheck healthCheck = healthChecks.stream()
             .filter(c -> c.componentName().getName().equals(componentName))
-            .findFirst();
-                
-        HealthCheck healthCheck = optHealthCheck.orElseThrow(() -> 
throw404(componentName));
+            .findFirst()
+            .orElseThrow(() -> throw404(componentName));
+        
         Result result = healthCheck.check();
         logFailedCheck(result);
         response.status(getCorrespondingStatusCode(result));


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to