Stream: committers
Topic: NPE on a full FHIR build in validating resource
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...
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...
Grahame Grieve (Sep 20 2021 at 18:40):
@Mark Iantorno this is an issue with the i18n code
Mark Iantorno (Sep 20 2021 at 18:40):
Okay will look now
Mark Iantorno (Sep 20 2021 at 18:41):
This points to a message existing in one language that doesn't exist in another
Mark Iantorno (Sep 20 2021 at 18:41):
no?
Grahame Grieve (Sep 20 2021 at 18:41):
message id doesn't exist at all?
Mark Iantorno (Sep 20 2021 at 18:42):
it shouldn't build then
Grahame Grieve (Sep 20 2021 at 18:42):
or the bundle was never loaded?
Mark Iantorno (Sep 20 2021 at 18:42):
That might be more likely
Mark Iantorno (Sep 20 2021 at 18:42):
I'll run the build locally
Mark Iantorno (Sep 20 2021 at 18:47):
I got the same fail
Mark Iantorno (Sep 20 2021 at 18:47):
very quickly
Mark Iantorno (Sep 20 2021 at 18:47):
looking into it now
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. :)
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
Mark Iantorno (Sep 20 2021 at 19:24):
Specifically
Mark Iantorno (Sep 20 2021 at 19:24):
when the path = "MedicationKnowledge.sponsor"
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);
Mark Iantorno (Sep 20 2021 at 19:26):
and e is null
Mark Iantorno (Sep 20 2021 at 19:26):
then it attempts to iterate through e.getTypes()
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);
}
}
}```
Mark Iantorno (Sep 20 2021 at 19:27):
and throws a NPE there
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
Mark Iantorno (Sep 20 2021 at 19:29):
@Grahame Grieve @Jean Duteau any idea why that might be happenning?
Mark Iantorno (Sep 20 2021 at 19:29):
the NPE on MedicationKnowledge.sponsor
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.
Mark Iantorno (Sep 20 2021 at 19:30):
Alright, that's good to hear
Mark Iantorno (Sep 20 2021 at 19:31):
Let me know if there are any other issues
Jean Duteau (Sep 20 2021 at 19:31):
do you need me to create a git issue so that we handle e being null?
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
Mark Iantorno (Sep 20 2021 at 19:32):
I'm not sure how to deal with that
Mark Iantorno (Sep 20 2021 at 19:32):
For sure create an issue with all the details
Mark Iantorno (Sep 20 2021 at 19:32):
please put the details into the ticket, not a link to this conversation
Grahame Grieve (Sep 20 2021 at 20:11):
we should raise an informative error if e == null
Grahame Grieve (Sep 20 2021 at 20:12):
'can't find element for path [x]'
Grahame Grieve (Sep 20 2021 at 20:12):
don't need to worry about localizing that one
Grahame Grieve (Sep 20 2021 at 20:12):
weird that the error was in resource bundle
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
Mark Iantorno (Sep 20 2021 at 21:06):
this would be in the org.hl7.fhir.core repo
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.
Grahame Grieve (Sep 20 2021 at 21:24):
yes loaded long before
Rik Smithies (Sep 20 2021 at 21:41):
is saying what the current action is to little more detail possible?
Grahame Grieve (Sep 20 2021 at 21:42):
well, that's a tricky... the logs are already pretty big
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
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.
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
Mark Iantorno (Sep 21 2021 at 20:01):
Are you asking for assistance in investigating that?
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