From cd15dd01e238c6ff13514da07158fec3089a31dd Mon Sep 17 00:00:00 2001 From: dankito Date: Sat, 17 Apr 2021 19:47:57 +0200 Subject: [PATCH] Fixed catching that if a TAN is required but not entered accountsTransactions is null (even though it shouldn't) --- .../net/dankito/banking/fints/rest/mapper/DtoMapper.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/rest/fints4kRest/src/main/kotlin/net/dankito/banking/fints/rest/mapper/DtoMapper.kt b/rest/fints4kRest/src/main/kotlin/net/dankito/banking/fints/rest/mapper/DtoMapper.kt index a9a7184f..84acea4f 100644 --- a/rest/fints4kRest/src/main/kotlin/net/dankito/banking/fints/rest/mapper/DtoMapper.kt +++ b/rest/fints4kRest/src/main/kotlin/net/dankito/banking/fints/rest/mapper/DtoMapper.kt @@ -6,6 +6,7 @@ import net.dankito.banking.fints.response.client.FinTsClientResponse import net.dankito.banking.fints.response.client.GetTransactionsResponse import net.dankito.banking.fints.rest.model.dto.response.* import java.math.BigDecimal +import javax.ws.rs.InternalServerErrorException open class DtoMapper { @@ -37,7 +38,12 @@ open class DtoMapper { } - open fun mapTransactions(accountsTransactions: List): GetAccountsTransactionsResponseDto { + open fun mapTransactions(accountsTransactions: List?): GetAccountsTransactionsResponseDto { + // TODO: if a TAN is required then accountsTransactions contains null value(s) (but why?) -> application crashes + if (accountsTransactions == null) { + throw InternalServerErrorException("Could not fetch account transactions. Either TAN hasn't been entered or developers made a mistake.") + } + return GetAccountsTransactionsResponseDto(accountsTransactions.map { map(it) }) }