FHIR Chat · NPE on a full FHIR build in validating resource · committers

Stream: committers

Topic: NPE on a full FHIR build in validating resource


view this post on Zulip Jean Duteau (Sep 20 2021 at 18:25):

I am getting a NPE in a full FHIR build that doesn't give any information on what could be wrong:

This was a Full Build                                                      4.392  38sec  817MB
FHIR build failure @ Mon, Sep 20, 2021 12:23-0600                          0.668  38sec  817MB
Error: null
java.lang.NullPointerException
        at java.base/java.util.ResourceBundle.containsKey(ResourceBundle.java:2302)
        at org.hl7.fhir.utilities.i18n.I18nBase.messageExistsForLocale(I18nBase.java:50)
        at org.hl7.fhir.utilities.i18n.I18nBase.formatMessage(I18nBase.java:67)
        at org.hl7.fhir.validation.BaseValidator.ruleHtml(BaseValidator.java:421)
        at org.hl7.fhir.definitions.validation.ResourceValidator.rule(ResourceValidator.java:124)
        at org.hl7.fhir.definitions.validation.ResourceValidator.checkSearchParams(ResourceValidator.java:383)
        at org.hl7.fhir.definitions.validation.ResourceValidator.check(ResourceValidator.java:217)
        at org.hl7.fhir.definitions.validation.ResourceValidator.check(ResourceValidator.java:594)
        at org.hl7.fhir.tools.publisher.Publisher.validate(Publisher.java:1787)
        at org.hl7.fhir.tools.publisher.Publisher.execute(Publisher.java:609)
        at org.hl7.fhir.tools.publisher.Publisher.main(Publisher.java:474)

I'm going to review what I changed to see what could have gone wrong, but it will searching in the dark...

view this post on Zulip Jean Duteau (Sep 20 2021 at 18:26):

https://github.com/HL7/fhir/tree/jd-MedKnowledge is the branch if anyone wants to help me search...

view this post on Zulip Grahame Grieve (Sep 20 2021 at 18:40):

@Mark Iantorno this is an issue with the i18n code

view this post on Zulip Mark Iantorno (Sep 20 2021 at 18:40):

Okay will look now

view this post on Zulip Mark Iantorno (Sep 20 2021 at 18:41):

This points to a message existing in one language that doesn't exist in another

view this post on Zulip Mark Iantorno (Sep 20 2021 at 18:41):

no?

view this post on Zulip Grahame Grieve (Sep 20 2021 at 18:41):

message id doesn't exist at all?

view this post on Zulip Mark Iantorno (Sep 20 2021 at 18:42):

it shouldn't build then

view this post on Zulip Grahame Grieve (Sep 20 2021 at 18:42):

or the bundle was never loaded?

view this post on Zulip Mark Iantorno (Sep 20 2021 at 18:42):

That might be more likely

view this post on Zulip Mark Iantorno (Sep 20 2021 at 18:42):

I'll run the build locally

view this post on Zulip Mark Iantorno (Sep 20 2021 at 18:47):

I got the same fail

view this post on Zulip Mark Iantorno (Sep 20 2021 at 18:47):

very quickly

view this post on Zulip Mark Iantorno (Sep 20 2021 at 18:47):

looking into it now

view this post on Zulip Jean Duteau (Sep 20 2021 at 19:10):

thanks for the quick look into this. i'm sure it will eventually point to something wrong I've done but it's hard to tell what specific wrong thing I did this time. :)

view this post on Zulip Mark Iantorno (Sep 20 2021 at 19:22):

When it attempts to evaluate this search parameter definition
image.png
it throws a null pointer exception

view this post on Zulip Mark Iantorno (Sep 20 2021 at 19:24):

Specifically

view this post on Zulip Mark Iantorno (Sep 20 2021 at 19:24):

when the path = "MedicationKnowledge.sponsor"

view this post on Zulip Mark Iantorno (Sep 20 2021 at 19:25):

it tries to execute this:
ElementDefn e = rd.getRoot().getElementForPath(trimIndexes("MedicationKnowledge.sponsor"), definitions, "Resolving Search Parameter Path", true, false);

view this post on Zulip Mark Iantorno (Sep 20 2021 at 19:26):

and e is null

view this post on Zulip Mark Iantorno (Sep 20 2021 at 19:26):

then it attempts to iterate through e.getTypes()

view this post on Zulip Mark Iantorno (Sep 20 2021 at 19:26):

for (TypeRef t : e.getTypes()) {
    if (t.getName().equals("Reference") || t.getName().equals("canonical")) {
        for (String pn : t.getParams()) {
            if (definitions.hasLogicalModel(pn))
                p.getTargets().addAll(definitions.getLogicalModel(pn).getImplementations());
            else
                p.getTargets().add(pn);
        }
    }
}```

view this post on Zulip Mark Iantorno (Sep 20 2021 at 19:27):

and throws a NPE there

view this post on Zulip Mark Iantorno (Sep 20 2021 at 19:29):

Then it tries to filter up a message from the exception, but the message contained in the NPE exception is null, so when it tries to localize it, it barfs

view this post on Zulip Mark Iantorno (Sep 20 2021 at 19:29):

@Grahame Grieve @Jean Duteau any idea why that might be happenning?

view this post on Zulip Mark Iantorno (Sep 20 2021 at 19:29):

the NPE on MedicationKnowledge.sponsor

view this post on Zulip Jean Duteau (Sep 20 2021 at 19:30):

i know why that's happening - removed that field. i can fix the searchparameter to get that not to error.

view this post on Zulip Mark Iantorno (Sep 20 2021 at 19:30):

Alright, that's good to hear

view this post on Zulip Mark Iantorno (Sep 20 2021 at 19:31):

Let me know if there are any other issues

view this post on Zulip Jean Duteau (Sep 20 2021 at 19:31):

do you need me to create a git issue so that we handle e being null?

view this post on Zulip Mark Iantorno (Sep 20 2021 at 19:32):

The problem is that there is no message for that kind of NPE...so it can't really be localized

view this post on Zulip Mark Iantorno (Sep 20 2021 at 19:32):

I'm not sure how to deal with that

view this post on Zulip Mark Iantorno (Sep 20 2021 at 19:32):

For sure create an issue with all the details

view this post on Zulip Mark Iantorno (Sep 20 2021 at 19:32):

please put the details into the ticket, not a link to this conversation

view this post on Zulip Grahame Grieve (Sep 20 2021 at 20:11):

we should raise an informative error if e == null

view this post on Zulip Grahame Grieve (Sep 20 2021 at 20:12):

'can't find element for path [x]'

view this post on Zulip Grahame Grieve (Sep 20 2021 at 20:12):

don't need to worry about localizing that one

view this post on Zulip Grahame Grieve (Sep 20 2021 at 20:12):

weird that the error was in resource bundle

view this post on Zulip Jean Duteau (Sep 20 2021 at 20:46):

hmm, the FHIR Git doesn't have an issues tab, so I can't raise an issue there

view this post on Zulip Mark Iantorno (Sep 20 2021 at 21:06):

this would be in the org.hl7.fhir.core repo

view this post on Zulip Rik Smithies (Sep 20 2021 at 21:07):

Is it possible that the build can dump the name of the last file it worked on? I get lots of NPEs for all sorts of things (but search params are a common one). It would narrow things down enormously. Maybe all the files are loaded ages before this part of the code, but if it even said "processing search params" that would help.

view this post on Zulip Grahame Grieve (Sep 20 2021 at 21:24):

yes loaded long before

view this post on Zulip Rik Smithies (Sep 20 2021 at 21:41):

is saying what the current action is to little more detail possible?

view this post on Zulip Grahame Grieve (Sep 20 2021 at 21:42):

well, that's a tricky... the logs are already pretty big

view this post on Zulip Grahame Grieve (Sep 20 2021 at 21:42):

what would be really useful is that you should never have to chase NPEs, and so if you ever get one, report it here. It's generally easy for us to fix them so you get an informative error message; it's finding them that's hard

view this post on Zulip Melva Peters (Sep 20 2021 at 21:48):

I keep running it and eventually get it to finish, but some times it has taken 3-4 times.

view this post on Zulip Rik Smithies (Sep 21 2021 at 19:48):

https://dev.azure.com/fhir-pipelines/fhir-publisher/_build/results?buildId=4303&view=logs&j=ab68b630-6476-573a-954f-d89e4292687e&t=ab58c233-aa15-51d8-8258-3d2a9910e74a&l=330
not sure if that is useable

view this post on Zulip Mark Iantorno (Sep 21 2021 at 20:01):

Are you asking for assistance in investigating that?

view this post on Zulip Rik Smithies (Sep 21 2021 at 20:21):

No thanks. Grahame asked for examples of NPEs to be posted. This is one I eventually resolved on another branch, but I thought it may help.


Last updated: Apr 12 2022 at 19:14 UTC