FHIR Chat · Publisher: Null-pointer exception during snapshot generation · IG creation

Stream: IG creation

Topic: Publisher: Null-pointer exception during snapshot generation


view this post on Zulip Pétur Valdimarsson (Apr 03 2020 at 09:30):

Hi! Not sure if this is by design or a newly introduced bug, but running later IG-publishers, I'm getting a null-pointer exception if mapping for an element is a blank string. From what I have seen this happens both with an empty string and a whitespace.

Example snippet from differential:

{
        "id": "Observation.valueQuantity.value",
        "path": "Observation.valueQuantity.value",
        "mapping": [
          {
            "identity": "v2",
            "map": "SN.2  / CQ - N/A"
          },
          {
            "identity": "other-mapping",
            "map": ""
          }
        ]
      }

The stacktrace:

java.lang.Exception: Error generating snapshot for ExampleProfile(example-profile): Unable to generate snapshot for http://example.com/StructureDefinition/example-profile in ..
        at org.hl7.fhir.igtools.publisher.Publisher.generateSnapshots(Publisher.java:4019)
        at org.hl7.fhir.igtools.publisher.Publisher.loadConformance(Publisher.java:3448)
        at org.hl7.fhir.igtools.publisher.Publisher.createIg(Publisher.java:796)
        at org.hl7.fhir.igtools.publisher.Publisher.execute(Publisher.java:657)
        at org.hl7.fhir.igtools.publisher.Publisher.main(Publisher.java:7062)
Caused by: org.hl7.fhir.exceptions.FHIRException: Unable to generate snapshot for http://example.com/StructureDefinition/example-profile in ..
        at org.hl7.fhir.igtools.publisher.Publisher.generateSnapshot(Publisher.java:4072)
        at org.hl7.fhir.igtools.publisher.Publisher.generateSnapshots(Publisher.java:4017)
        ... 4 more
Caused by: java.lang.NullPointerException
        at org.hl7.fhir.r5.conformance.ProfileUtilities.generateSnapshot(ProfileUtilities.java:591)
        at org.hl7.fhir.igtools.publisher.Publisher.generateSnapshot(Publisher.java:4070)
        ... 5 more
Exception in thread "main" java.lang.NullPointerException
        at org.hl7.fhir.igtools.publisher.Publisher.main(Publisher.java:7085)

I haven't done too much debugging, but can see that the ElementDefinitionMappingComponent.map is null which causes a null-pointer due to the trim call in mm.setMap(mm.getMap().trim()). I don't know if the fix, if one is to be done, should be to ensure that the ElementDefinitionMappingComponent.map is not null, to compensate for the possibility of it being null before mm.setMap(mm.getMap().trim()) or to throw a more verbose exception. Until then, I've ensured that the map always has some none-whitespace content in my profiles.

view this post on Zulip Grahame Grieve (Apr 03 2020 at 09:34):

well, ok, I'll fix that next release. But "map" : "" is illegal

view this post on Zulip Pétur Valdimarsson (Apr 03 2020 at 09:35):

Yes, it was in my profiles due to a sushi-workaround. I think just a more descriptive exception would be quite sufficient.

view this post on Zulip Grahame Grieve (Apr 03 2020 at 09:35):

not having a problem in the first place would be even better

view this post on Zulip Pétur Valdimarsson (Apr 03 2020 at 09:37):

Indeed true.

view this post on Zulip Chris Moesel (Apr 03 2020 at 12:35):

Yes, it was in my profiles due to a sushi-workaround

@Pétur Valdimarsson -- what is this SUSHI workaround? Something we need to address on our side?

view this post on Zulip Pétur Valdimarsson (Apr 03 2020 at 12:37):

@Chris Moesel This may alrady have been fixed, have not tried since before 0.11 came out:

view this post on Zulip Pétur Valdimarsson (Apr 03 2020 at 12:37):

https://chat.fhir.org/#narrow/stream/215610-shorthand/topic/Mapping.20value.5Bx.5D.2Eproperty


Last updated: Apr 12 2022 at 19:14 UTC