From ec85162e0079137bdb4a9b95637b85f275bfbe16 Mon Sep 17 00:00:00 2001 From: dankito Date: Sat, 17 Apr 2021 01:53:04 +0200 Subject: [PATCH] Couldn't reproduce it but on server parsing balance time sometimes failed --- .../banking/fints/response/ResponseParser.kt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/response/ResponseParser.kt b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/response/ResponseParser.kt index d3df744b..644db49b 100644 --- a/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/response/ResponseParser.kt +++ b/fints4k/src/commonMain/kotlin/net/dankito/banking/fints/response/ResponseParser.kt @@ -680,12 +680,14 @@ open class ResponseParser( date = parseDate(dataElements[++dateIndex]) } - return Balance( - parseAmount(dataElements[1], isCredit), - currency, - date, - if (dataElements.size > dateIndex + 1) parseTime(dataElements[dateIndex + 1]) else null - ) + var time: Date? = null + if (dataElements.size > dateIndex + 1) { + try { + time = parseTime(dataElements[dateIndex + 1]) + } catch (e: Exception) { log.error("Could not parse balance time '${dataElementGroup[dateIndex + 1]}' of data element group: $dataElementGroup") } + } + + return Balance(parseAmount(dataElements[1], isCredit), currency, date, time) } protected open fun parseIsCredit(isCredit: String): Boolean {