Fixed that ResponseParser logs didn't get added to LogCollector; had therefore to add ResponseParser to JobContext

This commit is contained in:
dankito 2021-11-12 23:57:32 +01:00
parent eba94e2c1b
commit 7ad0656c9b
3 changed files with 6 additions and 4 deletions

View File

@ -18,8 +18,7 @@ import net.dankito.utils.multiplatform.log.LoggerFactory
open class RequestExecutor( open class RequestExecutor(
protected open val messageBuilder: MessageBuilder = MessageBuilder(), protected open val messageBuilder: MessageBuilder = MessageBuilder(),
protected open val webClient: IWebClient = KtorWebClient(), protected open val webClient: IWebClient = KtorWebClient(),
protected open val base64Service: IBase64Service = PureKotlinBase64Service(), protected open val base64Service: IBase64Service = PureKotlinBase64Service()
protected open val responseParser: ResponseParser = ResponseParser()
) { ) {
companion object { companion object {
@ -111,7 +110,7 @@ open class RequestExecutor(
addMessageLog(context, MessageLogEntryType.Received, decodedResponse) addMessageLog(context, MessageLogEntryType.Received, decodedResponse)
return responseParser.parse(decodedResponse) return context.responseParser.parse(decodedResponse)
} catch (e: Exception) { } catch (e: Exception) {
logError(context, "Could not decode responseBody:\r\n'$responseBody'", e) logError(context, "Could not decode responseBody:\r\n'$responseBody'", e)

View File

@ -6,6 +6,7 @@ import net.dankito.banking.fints.log.MessageContext
import net.dankito.banking.fints.log.MessageLogCollector import net.dankito.banking.fints.log.MessageLogCollector
import net.dankito.banking.fints.messages.datenelemente.implementierte.signatur.VersionDesSicherheitsverfahrens import net.dankito.banking.fints.messages.datenelemente.implementierte.signatur.VersionDesSicherheitsverfahrens
import net.dankito.banking.fints.response.BankResponse import net.dankito.banking.fints.response.BankResponse
import net.dankito.banking.fints.response.ResponseParser
import net.dankito.banking.fints.transactions.IAccountTransactionsParser import net.dankito.banking.fints.transactions.IAccountTransactionsParser
import net.dankito.banking.fints.transactions.Mt940AccountTransactionsParser import net.dankito.banking.fints.transactions.Mt940AccountTransactionsParser
import net.dankito.banking.fints.transactions.mt940.Mt940Parser import net.dankito.banking.fints.transactions.mt940.Mt940Parser
@ -33,6 +34,8 @@ open class JobContext(
open val mt940Parser: IAccountTransactionsParser = Mt940AccountTransactionsParser(Mt940Parser(this), this) open val mt940Parser: IAccountTransactionsParser = Mt940AccountTransactionsParser(Mt940Parser(this), this)
open val responseParser: ResponseParser = ResponseParser(logAppender = this)
open val messageLogWithoutSensitiveData: List<MessageLogEntry> open val messageLogWithoutSensitiveData: List<MessageLogEntry>
get() = messageLogCollector.messageLogWithoutSensitiveData get() = messageLogCollector.messageLogWithoutSensitiveData

View File

@ -684,7 +684,7 @@ open class ResponseParser(
if (dataElements.size > dateIndex + 1) { if (dataElements.size > dateIndex + 1) {
try { try {
time = parseTime(dataElements[dateIndex + 1]) time = parseTime(dataElements[dateIndex + 1])
} catch (e: Exception) { log.error("Could not parse balance time '${dataElementGroup[dateIndex + 1]}' of data element group: $dataElementGroup") } } catch (e: Exception) { logError("Could not parse balance time '${dataElementGroup[dateIndex + 1]}' of data element group: $dataElementGroup", e) }
} }
return Balance(parseAmount(dataElements[1], isCredit), currency, date, time) return Balance(parseAmount(dataElements[1], isCredit), currency, date, time)