Skip to content

Refactor - DatabaseConnection::getUser should return an Optional<User>

Description

Calling DatabaseConnection::getUser with a user that does not exist causes an SQLExceotion. The method should be modified to return an Optional<User>.

This bug can be confirmed by executing a PUT request with the following data to /api/v1/user/password

{"username":"NON_EXISTENT_USER", "password":"ANY_PASSWORD"}

Priority - Medium

The method works, however catching all SQLExceptions to check if a user exists is not ideal.

Definition of done

When the method returns an Optional

Edited by Luc Everse