Skip to content

FHIR Pacage Cache is case-sensitive #2682

@ghost

Description

Describe the bug

As discussed in org.hl7.fhir.core issues #475, the FHIR validator was until recently treating package IDs as case-sensitive, leading to problems when packages declared dependencies with another capitalization. The proposed solutions is to always treat the IDs as lowercase (ignore casing). However, when a package is added to the JpaPackageCache, a case-sensitive package ID check is performed, leading to the issue described in the linked issues. Specifically, the check is in the method JpaPackageCache#addPackageToCache

To Reproduce
Steps to reproduce the behavior:

  1. Set up a HAPI JPA server using the JPA starter project
  2. Configure the server to load dependencies on start-up (as discussed in this Zulip thread
  3. Configure the server to load the de.gecco#1.0.3 FHIR package on start-up (in application.yaml)
  4. Start the server

The error occurs when loading one of the dependencies - log output will this:

2021-05-26 16:52:02.919 [main] INFO  c.u.f.jpa.packages.JpaPackageCache [JpaPackageCache.java:195] Parsing package .tar.gz (28612 bytes) from http://packages.fhir.org/kbv.basis/1.1.3
2021-05-26 16:52:02.948 [main] ERROR o.a.c.c.C.[Tomcat].[localhost].[/] [DirectJDKLog.java:175] Servlet.init() for servlet [jpaRestfulServer] threw exception
ca.uhn.fhir.rest.server.exceptions.InvalidRequestException: Package ID KBV.Basis doesn't match expected: kbv.basis
    at ca.uhn.fhir.jpa.packages.JpaPackageCache.addPackageToCache(JpaPackageCache.java:199)
    at ca.uhn.fhir.jpa.packages.JpaPackageCache.loadPackage(JpaPackageCache.java:398)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)
    at com.sun.proxy.$Proxy213.loadPackage(Unknown Source)
    at ca.uhn.fhir.jpa.packages.PackageInstallerSvcImpl.fetchAndInstallDependencies(PackageInstallerSvcImpl.java:265)
    at ca.uhn.fhir.jpa.packages.PackageInstallerSvcImpl.fetchAndInstallDependencies(PackageInstallerSvcImpl.java:268)

Expected behavior
The package should load without issues, regardless of casing.

Environment (please complete the following information):

  • HAPI FHIR Versios: Latest build
  • OS: iOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions