Commit 35c6dc4e authored by petar.tahchiev's avatar petar.tahchiev Committed by Stephane Nicoll

Fix NullPointer when requesting a session that does not exist

See gh-11202
parent 6cae9257
......@@ -60,6 +60,9 @@ public class SessionsEndpoint {
@ReadOperation
public SessionDescriptor getSession(@Selector String sessionId) {
Session session = this.sessionRepository.findById(sessionId);
if (session == null) {
return null;
}
return new SessionDescriptor(session);
}
......
......@@ -80,6 +80,12 @@ public class SessionsEndpointWebIntegrationTests {
.isEqualTo(new JSONArray().appendElement(session.getId()));
}
@Test
public void sessionForIdNotFound() {
client.get().uri((builder) -> builder.path("/actuator/sessions/some-session-id-that-does-not-exist")
.build()).exchange().expectStatus().isNotFound();
}
@Configuration
protected static class TestConfiguration {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment