Closed joergreichert closed 2 years ago
Thanks for the bug report!
It would be really helpful, if you describe the context where the exception occured:
Sure, here is the requested information
the Maven dependency:
<dependency>
<groupId>de.gematik.refv</groupId>
<artifactId>referencevalidator-lib</artifactId>
<version>0.1.3</version>
</dependency>
and com.fasterxml.jackson.core:jackson-databind:jar:2.14.0-rc3:compile (as there the exception occurs).
The call in Kotlin JUnit5 test factory:
@org.junit.jupiter.api.TestFactory
fun eEPrescriptionExampleTests(): Collection<DynamicTest?> {
return testCases.mapIndexed { index, testCase ->
DynamicTest.dynamicTest("Testfall ${index + 1}") {
val content = "..."
val gematikReferenceValidator = ValidationModuleFactory().createValidationModule(SupportedValidationModule.ERP)
val result: ValidationResult = gematikReferenceValidator.validateString(content)
assertTrue(result.isValid, "result should be valid")
}
}.flatten().flatten()
}
Java: OpenJDK 64-Bit Server VM (build 17.0.4+8-Ubuntu-122.04, mixed mode, sharing
FHIR-Profile within the validated resource: https://fhir.kbv.de/StructureDefinition/KBV_PR_ERP_Bundle|1.0.2
Loading the packages.yaml file directly works through. Just checked my test set up again and remove the loading of the Abda reference validator and the customly configured ca.uhn.fhir.validation.FhirValidator (just wanted to compare the validation results of the different approaches / validators) resolved the problem. Still wouldn't expected that the validators interfere with each other.
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory
import de.gematik.refv.commons.configuration.ValidationModuleConfiguration
import org.junit.jupiter.api.Test
class YamlTest {
@Test
fun testYaml() {
val mapper = ObjectMapper(YAMLFactory())
val validationModuleConfiguration = mapper.readValue<ValidationModuleConfiguration>(javaClass.getResourceAsStream("/packages.yaml"), ValidationModuleConfiguration::class.java) as ValidationModuleConfiguration
}
}
Indeed, the two two validators interfere. Unfortunately, they cannot be used simulatenously in one process, because they both come with resources named "packages.yaml" and the resource loading algorithm can't distinguish between the two (https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/ClassLoader.html#getResource(java.lang.String)).
You might consider calling both or only the second validator in a new process (either via CLI or using a custom wrapper) and compare results.
The parallel operation with ABDA validator in one process is not a supported use case at the moment, so the issue will be closed.