Fixed that Mt940Parser's logAppender got overridden
This commit is contained in:
parent
7ad0656c9b
commit
4c70412058
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue