Skip to content

Commit dd3da54

Browse files
committed
[java] Deleting useless code and formatting
1 parent 205a1e4 commit dd3da54

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

java/server/src/org/openqa/selenium/grid/router/HandleSession.java

+11-15
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
import static org.openqa.selenium.remote.tracing.Tags.HTTP_REQUEST;
5252
import static org.openqa.selenium.remote.tracing.Tags.HTTP_REQUEST_EVENT;
5353
import static org.openqa.selenium.remote.tracing.Tags.HTTP_RESPONSE;
54-
import static org.openqa.selenium.remote.tracing.Tags.HTTP_RESPONSE_EVENT;
5554

5655
class HandleSession implements HttpHandler {
5756

@@ -84,15 +83,15 @@ public HttpResponse execute(HttpRequest req) {
8483
HTTP_REQUEST_EVENT.accept(attributeMap, req);
8584

8685
SessionId id = getSessionId(req.getUri()).map(SessionId::new)
87-
.orElseThrow(() -> {
88-
NoSuchSessionException exception = new NoSuchSessionException("Cannot find session: " + req);
89-
EXCEPTION.accept(attributeMap, exception);
90-
attributeMap.put(AttributeKey.EXCEPTION_MESSAGE.getKey(),
91-
EventAttribute.setValue(
92-
"Unable to execute request for an existing session: " + exception.getMessage()));
93-
span.addEvent(AttributeKey.EXCEPTION_EVENT.getKey(), attributeMap);
94-
return exception;
95-
});
86+
.orElseThrow(() -> {
87+
NoSuchSessionException exception = new NoSuchSessionException("Cannot find session: " + req);
88+
EXCEPTION.accept(attributeMap, exception);
89+
attributeMap.put(AttributeKey.EXCEPTION_MESSAGE.getKey(),
90+
EventAttribute.setValue(
91+
"Unable to execute request for an existing session: " + exception.getMessage()));
92+
span.addEvent(AttributeKey.EXCEPTION_EVENT.getKey(), attributeMap);
93+
return exception;
94+
});
9695

9796
SESSION_ID.accept(span, id);
9897
SESSION_ID_EVENT.accept(attributeMap, id);
@@ -126,11 +125,8 @@ private Callable<HttpHandler> loadSessionId(Tracer tracer, Span span, SessionId
126125
return span.wrap(
127126
() -> {
128127
Session session = sessions.get(id);
129-
if (session instanceof HttpHandler) {
130-
return (HttpHandler) session;
131-
}
132-
HttpClient client = httpClientFactory.createClient(Urls.fromUri(session.getUri()));
133-
return new ReverseProxyHandler(tracer, client);
128+
HttpClient client = httpClientFactory.createClient(Urls.fromUri(session.getUri()));
129+
return new ReverseProxyHandler(tracer, client);
134130
}
135131
);
136132
}

0 commit comments

Comments
 (0)