We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 774bcd6 commit a79682dCopy full SHA for a79682d
src/main/kotlin/nu/westlin/kartrepo/KartController.kt
@@ -11,14 +11,7 @@ class KartController @Autowired constructor(val kartRepository: KartRepository)
11
12
@RequestMapping("/user")
13
fun greeting(@RequestParam(value = "username", defaultValue = "pwestlin") username: String, response: HttpServletResponse): User {
14
- val user: User? = kartRepository.load(username)
15
-
16
- if (user == null) {
17
- throw NotFoundException("User $username not found")
18
- }
19
20
- return user
21
+ return kartRepository.load(username) ?: throw NotFoundException("User $username not found")
22
}
23
24
@RequestMapping("/users")
0 commit comments