From dd5ecb004f50c5b4243d3a62a80827db186b96cc Mon Sep 17 00:00:00 2001 From: Laura Ketola Date: Thu, 5 Dec 2024 15:22:39 +0200 Subject: [PATCH] AKR(Backend): Null-safe nickname check --- .../main/java/fi/oph/akr/service/PublicTranslatorService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/akr/src/main/java/fi/oph/akr/service/PublicTranslatorService.java b/backend/akr/src/main/java/fi/oph/akr/service/PublicTranslatorService.java index 252b94e18..1c9acb51f 100644 --- a/backend/akr/src/main/java/fi/oph/akr/service/PublicTranslatorService.java +++ b/backend/akr/src/main/java/fi/oph/akr/service/PublicTranslatorService.java @@ -115,7 +115,9 @@ private PublicTranslatorDTO toDTO( return PublicTranslatorDTO .builder() .id(translator.getId()) - .firstName(personalData.getNickName().isBlank() ? personalData.getFirstName() : personalData.getNickName()) + .firstName( + StringUtils.hasText(personalData.getNickName()) ? personalData.getNickName() : personalData.getFirstName() + ) .lastName(personalData.getLastName()) .town(townTranslated.getLeft()) .country(country)