fix npe validating code system

This commit is contained in:
Grahame Grieve 2024-05-27 23:55:58 +10:00
parent 1087016941
commit ae250c4053
1 changed files with 16 additions and 12 deletions

View File

@ -296,18 +296,22 @@ public class ValueSetValidator extends BaseValidator {
cs = context.findTxResource(CodeSystem.class, system, version); cs = context.findTxResource(CodeSystem.class, system, version);
} }
if (cs != null) { // if it's null, we can't analyse this if (cs != null) { // if it's null, we can't analyse this
switch (cs.getContent()) { if (cs.getContent() == null) {
case EXAMPLE: warning(errors, "2024-03-06", IssueType.INVALID, stack, false, version == null ? I18nConstants.VALUESET_INCLUDE_CS_CONTENT : I18nConstants.VALUESET_INCLUDE_CSVER_CONTENT, system, "null", version);
warning(errors, "2024-03-06", IssueType.INVALID, stack, false, version == null ? I18nConstants.VALUESET_INCLUDE_CS_CONTENT : I18nConstants.VALUESET_INCLUDE_CSVER_CONTENT, system, cs.getContent().toCode(), version); } else {
break; switch (cs.getContent()) {
case FRAGMENT: case EXAMPLE:
hint(errors, "2024-03-06", IssueType.INVALID, stack, false, version == null ? I18nConstants.VALUESET_INCLUDE_CS_CONTENT : I18nConstants.VALUESET_INCLUDE_CSVER_CONTENT, system, cs.getContent().toCode(), version); warning(errors, "2024-03-06", IssueType.INVALID, stack, false, version == null ? I18nConstants.VALUESET_INCLUDE_CS_CONTENT : I18nConstants.VALUESET_INCLUDE_CSVER_CONTENT, system, cs.getContent().toCode(), version);
break; break;
case SUPPLEMENT: case FRAGMENT:
ok = rule(errors, "2024-03-06", IssueType.INVALID, stack, false, version == null ? I18nConstants.VALUESET_INCLUDE_CS_SUPPLEMENT : I18nConstants.VALUESET_INCLUDE_CSVER_SUPPLEMENT, system, cs.getSupplements(), version) && ok; hint(errors, "2024-03-06", IssueType.INVALID, stack, false, version == null ? I18nConstants.VALUESET_INCLUDE_CS_CONTENT : I18nConstants.VALUESET_INCLUDE_CSVER_CONTENT, system, cs.getContent().toCode(), version);
break; break;
default: case SUPPLEMENT:
break; ok = rule(errors, "2024-03-06", IssueType.INVALID, stack, false, version == null ? I18nConstants.VALUESET_INCLUDE_CS_SUPPLEMENT : I18nConstants.VALUESET_INCLUDE_CSVER_SUPPLEMENT, system, cs.getSupplements(), version) && ok;
break;
default:
break;
}
} }
} }