diff --git a/fints4javaLib/src/main/kotlin/net/dankito/fints/response/ResponseParser.kt b/fints4javaLib/src/main/kotlin/net/dankito/fints/response/ResponseParser.kt index a1fb2f1b..be748b1a 100644 --- a/fints4javaLib/src/main/kotlin/net/dankito/fints/response/ResponseParser.kt +++ b/fints4javaLib/src/main/kotlin/net/dankito/fints/response/ResponseParser.kt @@ -167,7 +167,7 @@ open class ResponseParser @JvmOverloads constructor( val supportedLanguages = parseLanguages(dataElementGroups[5]) val supportedHbciVersions = parseHbciVersions(dataElementGroups[6]) - val maxMessageSize = if (dataElementGroups.size > 7) parseInt(dataElementGroups[7]) else null + val maxMessageSize = if (dataElementGroups.size > 7) parseIntToNullIfEmpty(dataElementGroups[7]) else null val minTimeout = if (dataElementGroups.size > 8) parseInt(dataElementGroups[8]) else null val maxTimeout = if (dataElementGroups.size > 9) parseInt(dataElementGroups[9]) else null @@ -680,6 +680,14 @@ open class ResponseParser @JvmOverloads constructor( return parseString(string).toInt() } + protected open fun parseIntToNullIfEmpty(string: String): Int? { + if (string.isNotEmpty()) { + return parseNullableInt(string) + } + + return null + } + protected open fun parseNullableInt(mayInt: String): Int? { try { return parseInt(mayInt) diff --git a/fints4javaLib/src/test/kotlin/net/dankito/fints/response/ResponseParserTest.kt b/fints4javaLib/src/test/kotlin/net/dankito/fints/response/ResponseParserTest.kt index e5b5576f..a6054d62 100644 --- a/fints4javaLib/src/test/kotlin/net/dankito/fints/response/ResponseParserTest.kt +++ b/fints4javaLib/src/test/kotlin/net/dankito/fints/response/ResponseParserTest.kt @@ -312,6 +312,34 @@ class ResponseParserTest : FinTsTestBase() { ?: run { Assert.fail("No segment of type BankParameters found in ${result.receivedSegments}") } } + // Baader Bank + + @Test + fun parseBankParameters_MaxMessageSizeIsAnEmptyString() { + + // when + val result = underTest.parse("HIBPA:3:3:3+0+280:70033100+Baader Bank AG+1+1+300++0+300'") + + // then + assertSuccessfullyParsedSegment(result, InstituteSegmentId.BankParameters, 5, 3, 3) + + result.getFirstSegmentById(InstituteSegmentId.BankParameters)?.let { segment -> + assertThat(segment.bpdVersion).isEqualTo(34) + assertThat(segment.bankCountryCode).isEqualTo(280) + assertThat(segment.bankCode).isEqualTo("10070000") + assertThat(segment.bankName).isEqualTo("Deutsche Bank") + + assertThat(segment.countMaxJobsPerMessage).isEqualTo(0) + assertThat(segment.supportedLanguages).containsExactly(Dialogsprache.German) + assertThat(segment.supportedHbciVersions).containsExactly(HbciVersion.FinTs_3_0_0) + + assertThat(segment.maxMessageSize).isEqualTo(0) + assertThat(segment.minTimeout).isNull() + assertThat(segment.maxTimeout).isNull() + } + ?: run { Assert.fail("No segment of type BankParameters found in ${result.receivedSegments}") } + } + @Test fun parseSecurityMethods() {