Made parsedDataSet, mimeType and imageBytes nullable, as in case of decoding error they are not set

This commit is contained in:
dankito 2024-09-26 14:19:27 +02:00
parent be3a2df6d9
commit 9aad2a5101
4 changed files with 8 additions and 8 deletions

View File

@ -3,12 +3,12 @@ package net.codinux.banking.fints.tan
open class FlickerCode(
val challengeHHD_UC: String,
val parsedDataSet: String,
val parsedDataSet: String? = null,
val decodingError: Exception? = null
) {
val decodingSuccessful: Boolean
get() = decodingError == null
get() = parsedDataSet != null
override fun toString(): String {

View File

@ -45,7 +45,7 @@ open class FlickerCodeDecoder {
} catch (e: Exception) {
log.error(e) { "Could not decode challenge $challengeHHD_UC" }
return FlickerCode(challengeHHD_UC, "", e)
return FlickerCode(challengeHHD_UC, null, e)
}
}

View File

@ -2,13 +2,13 @@ package net.codinux.banking.fints.tan
open class TanImage(
val mimeType: String,
val imageBytes: ByteArray,
val mimeType: String? = null,
val imageBytes: ByteArray? = null,
val decodingError: Exception? = null
) {
val decodingSuccessful: Boolean
get() = decodingError == null
get() = mimeType != null && imageBytes != null
override fun toString(): String {
@ -16,7 +16,7 @@ open class TanImage(
return "Decoding error: $decodingError"
}
return "$mimeType ${imageBytes.size} bytes"
return "$mimeType ${imageBytes?.size} bytes"
}
}

View File

@ -29,7 +29,7 @@ open class TanImageDecoder {
} catch (e: Exception) {
log.error(e) { "Could not decode challenge HHD_UC to TanImage: $challengeHHD_UC" }
return TanImage("", ByteArray(0), e)
return TanImage(null, null, e)
}
}