Merge pull request #1829 from hapifhir/2024-11-gg-validator-npe
fix NPE in validator around Extension context
This commit is contained in:
commit
a5e0605a16
|
@ -1,6 +1,6 @@
|
||||||
## Validator Changes
|
## Validator Changes
|
||||||
|
|
||||||
* no changes
|
* fix NPE in validator around Extension context
|
||||||
|
|
||||||
## Other code changes
|
## Other code changes
|
||||||
|
|
||||||
|
|
|
@ -2478,8 +2478,11 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
||||||
}
|
}
|
||||||
if (ctxt.getType() == ExtensionContextType.ELEMENT) {
|
if (ctxt.getType() == ExtensionContextType.ELEMENT) {
|
||||||
String en = ctxt.getExpression();
|
String en = ctxt.getExpression();
|
||||||
contexts.append("e:" + en);
|
|
||||||
String pu = null;
|
String pu = null;
|
||||||
|
if (en == null) {
|
||||||
|
// nothing? It's an error in the extension definition, but that's properly reported elsewhere
|
||||||
|
} else {
|
||||||
|
contexts.append("e:" + en);
|
||||||
if (en.contains("#")) {
|
if (en.contains("#")) {
|
||||||
pu = en.substring(0, en.indexOf("#"));
|
pu = en.substring(0, en.indexOf("#"));
|
||||||
en = en.substring(en.indexOf("#")+1);
|
en = en.substring(en.indexOf("#")+1);
|
||||||
|
@ -2495,6 +2498,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
||||||
} else if (hasElementName(plist, en) && pu == null) {
|
} else if (hasElementName(plist, en) && pu == null) {
|
||||||
ok = true;
|
ok = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
if (checkConformsToProfile(appContext, errors, resource, container, stack, extUrl, ctxt.getExpression(), pu)) {
|
if (checkConformsToProfile(appContext, errors, resource, container, stack, extUrl, ctxt.getExpression(), pu)) {
|
||||||
|
|
Loading…
Reference in New Issue