Fixed that Mt940Parser's logAppender got overridden

This commit is contained in:
dankito 2021-11-12 23:58:11 +01:00
parent 7ad0656c9b
commit 4c70412058
1 changed files with 0 additions and 15 deletions

View File

@ -23,8 +23,6 @@ open class Mt940AccountTransactionsParser(
override fun parseTransactions(transactionsString: String, bank: BankData, account: AccountData): List<AccountTransaction> { override fun parseTransactions(transactionsString: String, bank: BankData, account: AccountData): List<AccountTransaction> {
setLogAppender(bank)
val accountStatements = mt940Parser.parseMt940String(transactionsString) val accountStatements = mt940Parser.parseMt940String(transactionsString)
return accountStatements.flatMap { mapToAccountTransactions(it, bank, account) } return accountStatements.flatMap { mapToAccountTransactions(it, bank, account) }
@ -116,19 +114,6 @@ open class Mt940AccountTransactionsParser(
} }
protected open fun setLogAppender(bankDataOfCall: BankData) {
// TODO: this does not perfectly work as in parallel calls to Mt940AccountTransactionsParser for different account logAppender gets overwritten by the later call
mt940Parser.logAppender = logAppender?.let { logAppender ->
object : IMessageLogAppender {
override fun logError(loggingClass: KClass<*>, message: String, e: Exception?) {
logAppender.logError(loggingClass, message, e)
}
}
}
}
protected open fun logError(message: String, e: Exception?, bank: BankData) { protected open fun logError(message: String, e: Exception?, bank: BankData) {
logAppender?.let { logAppender -> logAppender?.let { logAppender ->
logAppender.logError(Mt940AccountTransactionsParser::class, message, e) logAppender.logError(Mt940AccountTransactionsParser::class, message, e)