libeufin

Integration and sandbox testing for FinTech APIs and data formats
Log | Files | Refs | Submodules | README | LICENSE

commit 7844285924ea349e480750fa2b6cd3aebdb88060
parent 64b18e5b53cd415c297747a3cef33e4e62989803
Author: Florian Dold <florian@dold.me>
Date:   Mon,  2 Aug 2021 22:53:54 +0200

upgrade dependencies, remove xerces dependency

Diffstat:
D.idea/libeufin.iml | 14--------------
M.idea/misc.xml | 2+-
Mbuild.gradle | 2+-
Mdebian/changelog | 7+++++++
Mgradle/wrapper/gradle-wrapper.jar | 0
Mgradle/wrapper/gradle-wrapper.properties | 5++---
Mgradlew | 31++++++++++++++-----------------
Mgradlew.bat | 25+++++++------------------
Mnexus/build.gradle | 37++++++++++++++++++-------------------
Msandbox/build.gradle | 35+++++++++++++++++------------------
Msandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt | 2+-
Msandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt | 21+--------------------
Mutil/build.gradle | 33++++++++++++++++-----------------
Mutil/src/main/kotlin/CryptoUtil.kt | 4++--
Mutil/src/main/kotlin/XMLUtil.kt | 99++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------
15 files changed, 173 insertions(+), 144 deletions(-)

diff --git a/.idea/libeufin.iml b/.idea/libeufin.iml @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<module external.linked.project.id="libeufin:main" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4"> - <component name="NewModuleRootManager" inherit-compiler-output="true"> - <exclude-output /> - <content url="file://$MODULE_DIR$"> - <excludeFolder url="file://$MODULE_DIR$/.gradle" /> - <excludeFolder url="file://$MODULE_DIR$/build" /> - <excludeFolder url="file://$MODULE_DIR$/frontend" /> - </content> - <orderEntry type="inheritedJdk" /> - <orderEntry type="sourceFolder" forTests="false" /> - </component> -</module> -\ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml @@ -9,5 +9,5 @@ <component name="FrameworkDetectionExcludesConfiguration"> <file type="web" url="file://$PROJECT_DIR$" /> </component> - <component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="11" project-jdk-type="JavaSDK" /> + <component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK" /> </project> \ No newline at end of file diff --git a/build.gradle b/build.gradle @@ -1,7 +1,7 @@ import org.apache.tools.ant.filters.ReplaceTokens plugins { - id 'org.jetbrains.kotlin.jvm' version '1.4.30-RC' + id 'org.jetbrains.kotlin.jvm' version '1.5.21' id 'idea' } diff --git a/debian/changelog b/debian/changelog @@ -1,3 +1,10 @@ +libeufin (0.0.1-3) unstable; urgency=medium + + * Sandbox bugfixes. + * Packaging: Install tmpfiles properly. + + -- Florian Dold <florian@dold.me> Mon, 02 Aug 2021 19:53:44 +0200 + libeufin (0.0.1-2) unstable; urgency=medium * Support debhelper-compat level 12. diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar Binary files differ. diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Sun Jun 14 17:36:48 IST 2020 -distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.1-bin.zip zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew @@ -82,6 +82,7 @@ esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then @@ -129,6 +130,7 @@ fi if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath @@ -154,19 +156,19 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $i + 1` done case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; esac fi @@ -175,14 +177,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +APP_ARGS=`save "$@"` # Collect all arguments for the java command, following the shell quoting and substitution rules eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat @@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @@ -37,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -51,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -61,28 +64,14 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell diff --git a/nexus/build.gradle b/nexus/build.gradle @@ -51,32 +51,31 @@ compileTestKotlin { } } -def ktor_version = "1.5.0" -def exposed_version = "0.25.1" +def ktor_version = '1.6.1' +def exposed_version = '0.32.1' dependencies { // Core language libraries - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8" - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2' + implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.21' + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1-native-mt' // LibEuFin util library implementation project(":util") // Logging - implementation "ch.qos.logback:logback-classic:1.2.3" + implementation 'ch.qos.logback:logback-classic:1.2.5' // XML parsing/binding and encryption - implementation group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.1' - implementation "javax.xml.bind:jaxb-api:2.3.0" - implementation group: 'xerces', name: 'xercesImpl', version: '2.6.2-jaxb-1.0.6' - implementation "org.glassfish.jaxb:jaxb-runtime:2.3.1" - implementation 'org.apache.santuario:xmlsec:2.1.4' + implementation group: 'javax.xml.bind', name: 'jaxb-api', version: '2.4.0-b180830.0359' + implementation 'javax.xml.bind:jaxb-api:2.4.0-b180830.0359' + implementation 'org.glassfish.jaxb:jaxb-runtime:3.0.1' + implementation 'org.apache.santuario:xmlsec:2.2.2' // Compression - implementation group: 'org.apache.commons', name: 'commons-compress', version: '1.20' + implementation group: 'org.apache.commons', name: 'commons-compress', version: '1.21' // Command line parsing - implementation("com.github.ajalt:clikt:2.7.0") + implementation('com.github.ajalt:clikt:2.8.0') // Exposed, an SQL library implementation "org.jetbrains.exposed:exposed-core:$exposed_version" @@ -84,8 +83,8 @@ dependencies { implementation "org.jetbrains.exposed:exposed-jdbc:$exposed_version" // Database connection driver - implementation group: 'org.xerial', name: 'sqlite-jdbc', version: '3.28.0' - implementation "org.postgresql:postgresql:42.2.18" + implementation group: 'org.xerial', name: 'sqlite-jdbc', version: '3.36.0.1' + implementation 'org.postgresql:postgresql:42.2.23.jre7' // Ktor, an HTTP client and server library implementation "io.ktor:ktor-server-core:$ktor_version" @@ -95,15 +94,15 @@ dependencies { implementation "io.ktor:ktor-jackson:$ktor_version" // PDF generation - implementation 'com.itextpdf:itext7-core:7.1.11' + implementation 'com.itextpdf:itext7-core:7.1.16' // Cron syntax - implementation "com.cronutils:cron-utils:9.0.2" + implementation 'com.cronutils:cron-utils:9.1.5' // Unit testing - testImplementation 'junit:junit:4.12' - testImplementation 'org.jetbrains.kotlin:kotlin-test:1.4.30-RC' - testImplementation 'org.jetbrains.kotlin:kotlin-test-junit:1.4.30-RC' + testImplementation 'junit:junit:4.13.2' + testImplementation 'org.jetbrains.kotlin:kotlin-test:1.5.21' + testImplementation 'org.jetbrains.kotlin:kotlin-test-junit:1.5.21' } application { diff --git a/sandbox/build.gradle b/sandbox/build.gradle @@ -40,24 +40,23 @@ sourceSets { main.java.srcDirs = ['src/main/java', 'src/main/kotlin'] } -def ktor_version = "1.5.0" -def exposed_version = "0.25.1" +def ktor_version = '1.6.1' +def exposed_version = '0.32.1' dependencies { implementation "com.hubspot.jinjava:jinjava:2.5.9" - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8" - implementation "ch.qos.logback:logback-classic:1.2.3" - implementation group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.1' - implementation "javax.xml.bind:jaxb-api:2.3.0" - implementation group: 'xerces', name: 'xercesImpl', version: '2.6.2-jaxb-1.0.6' - implementation "javax.activation:activation:1.1" - implementation "org.glassfish.jaxb:jaxb-runtime:2.3.1" - implementation 'org.apache.santuario:xmlsec:2.1.4' - implementation group: 'org.bouncycastle', name: 'bcprov-jdk16', version: '1.45' - implementation group: 'org.xerial', name: 'sqlite-jdbc', version: '3.28.0' - implementation "org.postgresql:postgresql:42.2.18" - implementation group: 'org.apache.commons', name: 'commons-compress', version: '1.20' - implementation("com.github.ajalt:clikt:2.7.0") + implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.21' + implementation 'ch.qos.logback:logback-classic:1.2.5' + implementation group: 'javax.xml.bind', name: 'jaxb-api', version: '2.4.0-b180830.0359' + implementation 'javax.xml.bind:jaxb-api:2.4.0-b180830.0359' + implementation 'javax.activation:activation:1.1.1' + implementation 'org.glassfish.jaxb:jaxb-runtime:3.0.1' + implementation 'org.apache.santuario:xmlsec:2.2.2' + implementation group: 'org.bouncycastle', name: 'bcprov-jdk16', version: '1.46' + implementation group: 'org.xerial', name: 'sqlite-jdbc', version: '3.36.0.1' + implementation 'org.postgresql:postgresql:42.2.23.jre7' + implementation group: 'org.apache.commons', name: 'commons-compress', version: '1.21' + implementation('com.github.ajalt:clikt:2.8.0') implementation "org.jetbrains.exposed:exposed-core:$exposed_version" implementation "org.jetbrains.exposed:exposed-dao:$exposed_version" implementation "org.jetbrains.exposed:exposed-jdbc:$exposed_version" @@ -68,9 +67,9 @@ dependencies { implementation "io.ktor:ktor-jackson:$ktor_version" implementation "io.ktor:ktor-auth:$ktor_version" - testImplementation 'org.jetbrains.kotlin:kotlin-test-junit:1.4.30-RC' - testImplementation 'org.jetbrains.kotlin:kotlin-test:1.4.30-RC' - testImplementation group: "junit", name: "junit", version: "4.12" + testImplementation 'org.jetbrains.kotlin:kotlin-test-junit:1.5.21' + testImplementation 'org.jetbrains.kotlin:kotlin-test:1.5.21' + testImplementation group: "junit", name: "junit", version: '4.13.2' implementation project(":util") } diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt b/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt @@ -108,7 +108,7 @@ object SandboxUsersTable : LongIdTable() { val username = text("username") val passwordHash = text("password") val superuser = bool("superuser") // admin - val bankAccount = reference("bankAccout", BankAccountsTable) + val bankAccount = reference("bankAccount", BankAccountsTable) } class SandboxUserEntity(id: EntityID<Long>) : LongEntity(id) { diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt @@ -21,7 +21,6 @@ package tech.libeufin.sandbox import com.hubspot.jinjava.Jinjava -import com.hubspot.jinjava.JinjavaConfig import com.fasterxml.jackson.core.JsonParseException import io.ktor.application.ApplicationCallPipeline import io.ktor.application.call @@ -98,7 +97,7 @@ import kotlin.random.Random import kotlin.reflect.jvm.internal.impl.load.kotlin.JvmType import kotlin.system.exitProcess -val SANDBOX_DB_ENV_VAR_NAME = "LIBEUFIN_SANDBOX_DB_CONNECTION" +const val SANDBOX_DB_ENV_VAR_NAME = "LIBEUFIN_SANDBOX_DB_CONNECTION" private val logger: Logger = LoggerFactory.getLogger("tech.libeufin.sandbox") data class SandboxError(val statusCode: HttpStatusCode, val reason: String) : Exception() @@ -183,13 +182,6 @@ fun findEbicsSubscriber(partnerID: String, userID: String, systemID: String?): E }.firstOrNull() } -data class Subscriber( - val partnerID: String, - val userID: String, - val systemID: String?, - val keys: SubscriberKeys -) - data class SubscriberKeys( val authenticationPublicKey: RSAPublicKey, val encryptionPublicKey: RSAPublicKey, @@ -726,17 +718,6 @@ fun serverMain(dbName: String, port: Int) { } } } - val configs = transaction { - SandboxConfigEntity.all().firstOrNull() - } - if (configs == null) { - logger.error(""" - Sandbox cannot run without at least one configuration. - See "libeufin-sandbox config --help" - """.trimIndent() - ) - exitProcess(1) - } logger.info("LibEuFin Sandbox running on port $port") try { server.start(wait = true) diff --git a/util/build.gradle b/util/build.gradle @@ -2,7 +2,6 @@ plugins { id 'java' id 'application' id 'org.jetbrains.kotlin.jvm' - } sourceCompatibility = "11" @@ -27,30 +26,30 @@ sourceSets { main.java.srcDirs = ['src/main/java', 'src/main/kotlin'] } -def exposed_version = "0.25.1" +def exposed_version = '0.32.1' dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8" - implementation "io.ktor:ktor-server-netty:1.2.4" - implementation "ch.qos.logback:logback-classic:1.2.3" - implementation group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.1' - implementation "javax.xml.bind:jaxb-api:2.3.0" - implementation group: 'xerces', name: 'xercesImpl', version: '2.6.2-jaxb-1.0.6' - implementation "javax.activation:activation:1.1" - implementation "org.glassfish.jaxb:jaxb-runtime:2.3.1" - implementation 'org.apache.santuario:xmlsec:2.1.4' - implementation group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: '1.64' - implementation group: 'org.apache.commons', name: 'commons-compress', version: '1.20' + implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.21' + implementation 'io.ktor:ktor-server-netty:1.6.1' + implementation 'ch.qos.logback:logback-classic:1.2.5' + implementation group: 'javax.xml.bind', name: 'jaxb-api', version: '2.4.0-b180830.0359' + implementation 'javax.xml.bind:jaxb-api:2.4.0-b180830.0359' + + implementation 'javax.activation:activation:1.1.1' + implementation 'org.glassfish.jaxb:jaxb-runtime:3.0.1' + implementation 'org.apache.santuario:xmlsec:2.2.2' + implementation group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: '1.69' + implementation group: 'org.apache.commons', name: 'commons-compress', version: '1.21' // https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-reflect - implementation group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: '1.4.0' + implementation group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: '1.5.21' implementation "org.jetbrains.exposed:exposed-core:$exposed_version" implementation "org.jetbrains.exposed:exposed-dao:$exposed_version" - testImplementation group: 'junit', name: 'junit', version: '4.12' - testImplementation 'org.jetbrains.kotlin:kotlin-test-junit:1.4.30-RC' - testImplementation 'org.jetbrains.kotlin:kotlin-test:1.4.30-RC' + testImplementation group: 'junit', name: 'junit', version: '4.13.2' + testImplementation 'org.jetbrains.kotlin:kotlin-test-junit:1.5.21' + testImplementation 'org.jetbrains.kotlin:kotlin-test:1.5.21' } diff --git a/util/src/main/kotlin/CryptoUtil.kt b/util/src/main/kotlin/CryptoUtil.kt @@ -130,9 +130,9 @@ object CryptoUtil { */ fun getEbicsPublicKeyHash(publicKey: RSAPublicKey): ByteArray { val keyBytes = ByteArrayOutputStream() - keyBytes.writeBytes(publicKey.publicExponent.toUnsignedHexString().toLowerCase().trimStart('0').toByteArray()) + keyBytes.writeBytes(publicKey.publicExponent.toUnsignedHexString().lowercase().trimStart('0').toByteArray()) keyBytes.write(' '.toInt()) - keyBytes.writeBytes(publicKey.modulus.toUnsignedHexString().toLowerCase().trimStart('0').toByteArray()) + keyBytes.writeBytes(publicKey.modulus.toUnsignedHexString().lowercase().trimStart('0').toByteArray()) println("buffer before hashing: '${keyBytes.toString(Charsets.UTF_8)}'") val digest = MessageDigest.getInstance("SHA-256") return digest.digest(keyBytes.toByteArray()) diff --git a/util/src/main/kotlin/XMLUtil.kt b/util/src/main/kotlin/XMLUtil.kt @@ -19,9 +19,8 @@ package tech.libeufin.util -import com.sun.org.apache.xerces.internal.dom.DOMInputImpl -import com.sun.xml.bind.marshaller.NamespacePrefixMapper -import io.ktor.http.HttpStatusCode +import io.ktor.http.* +import org.glassfish.jaxb.runtime.marshaller.NamespacePrefixMapper import org.slf4j.Logger import org.slf4j.LoggerFactory import org.w3c.dom.Document @@ -73,6 +72,82 @@ class DefaultNamespaces : NamespacePrefixMapper() { } +class DOMInputImpl : LSInput { + var fPublicId: String? = null + var fSystemId: String? = null + var fBaseSystemId: String? = null + var fByteStream: InputStream? = null + var fCharStream: Reader? = null + var fData: String? = null + var fEncoding: String? = null + var fCertifiedText = false + + override fun getByteStream(): InputStream? { + return fByteStream + } + + override fun setByteStream(byteStream: InputStream) { + fByteStream = byteStream + } + + override fun getCharacterStream(): Reader? { + return fCharStream + } + + override fun setCharacterStream(characterStream: Reader) { + fCharStream = characterStream + } + + override fun getStringData(): String? { + return fData + } + + override fun setStringData(stringData: String) { + fData = stringData + } + + override fun getEncoding(): String? { + return fEncoding + } + + override fun setEncoding(encoding: String) { + fEncoding = encoding + } + + override fun getPublicId(): String? { + return fPublicId + } + + override fun setPublicId(publicId: String) { + fPublicId = publicId + } + + override fun getSystemId(): String? { + return fSystemId + } + + override fun setSystemId(systemId: String) { + fSystemId = systemId + } + + override fun getBaseURI(): String? { + return fBaseSystemId + } + + override fun setBaseURI(baseURI: String) { + fBaseSystemId = baseURI + } + + override fun getCertifiedText(): Boolean { + return fCertifiedText + } + + override fun setCertifiedText(certifiedText: Boolean) { + fCertifiedText = certifiedText + } +} + + /** * Helpers for dealing with XML in EBICS. */ @@ -106,15 +181,6 @@ class XMLUtil private constructor() { } } - /** - * Validator for EBICS messages. - */ - private val validator = try { - } catch (e: SAXException) { - e.printStackTrace() - throw e - } - companion object { private var cachedEbicsValidator: Validator? = null private fun getEbicsValidator(): Validator { @@ -151,7 +217,13 @@ class XMLUtil private constructor() { return null } val res = classLoader.getResourceAsStream("xsd/$systemId") ?: return null - return DOMInputImpl(publicId, systemId, baseUri, res, "UTF-8") + return DOMInputImpl().apply { + fPublicId = publicId + fSystemId = systemId + fBaseSystemId = baseUri + fByteStream = res + fEncoding = "UTF-8" + } } } val schemaInputs: Array<Source> = listOf( @@ -181,6 +253,7 @@ class XMLUtil private constructor() { try { getEbicsValidator().validate(xmlDoc) } catch (e: Exception) { + e.printStackTrace() logger.warn("Validation failed: ${e}") return false }