Skip to content

Commit

Permalink
Rettet NPE hvis manglende type naturalytelse.
Browse files Browse the repository at this point in the history
  • Loading branch information
rfc3092 committed Jul 11, 2024
1 parent 7cf1a37 commit 06a8b29
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Optional;

import static java.util.Objects.isNull;
import static java.util.Objects.nonNull;
Expand Down Expand Up @@ -114,7 +115,9 @@ public void mapAtoB(RsInntektsmelding.Inntektsmelding rsInntektsmelding,
.stream()
.map(ytelse -> {
var mapped = mapperFacade.map(ytelse, RsNaturalytelseDetaljer.class);
mapped.setNaturalytelseType(ytelse.getNaturalytelseType().getJsonValue()); // Don't use the string representation of the enum; use the JSON value corresponding to the enum.
Optional
.ofNullable(ytelse.getNaturalytelseType())
.ifPresent(type -> mapped.setNaturalytelseType(type.getJsonValue()));
return mapped;
})
.toList()
Expand All @@ -125,7 +128,9 @@ public void mapAtoB(RsInntektsmelding.Inntektsmelding rsInntektsmelding,
.stream()
.map(ytelse -> {
var mapped = mapperFacade.map(ytelse, RsNaturalytelseDetaljer.class);
mapped.setNaturalytelseType(ytelse.getNaturalytelseType().getJsonValue()); // Don't use the string representation of the enum; use the JSON value corresponding to the enum.
Optional
.ofNullable(ytelse.getNaturalytelseType())
.ifPresent(type -> mapped.setNaturalytelseType(type.getJsonValue()));
return mapped;
})
.toList()
Expand Down

0 comments on commit 06a8b29

Please sign in to comment.