Fix problem evaluating "type" discriminators ending with .resolve() + fix NPE in FHIRPath parser
This commit is contained in:
parent
608149e494
commit
d63e05b3cb
|
@ -80,9 +80,9 @@ public class FHIRLexer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isConstant() {
|
public boolean isConstant() {
|
||||||
return current != null && (current.charAt(0) == '\'' || current.charAt(0) == '"') || current.charAt(0) == '@' || current.charAt(0) == '%' ||
|
return !Utilities.noString(current) && ((current.charAt(0) == '\'' || current.charAt(0) == '"') || current.charAt(0) == '@' || current.charAt(0) == '%' ||
|
||||||
current.charAt(0) == '-' || current.charAt(0) == '+' || (current.charAt(0) >= '0' && current.charAt(0) <= '9') ||
|
current.charAt(0) == '-' || current.charAt(0) == '+' || (current.charAt(0) >= '0' && current.charAt(0) <= '9') ||
|
||||||
current.equals("true") || current.equals("false") || current.equals("{}");
|
current.equals("true") || current.equals("false") || current.equals("{}"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFixedName() {
|
public boolean isFixedName() {
|
||||||
|
|
|
@ -3102,7 +3102,13 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
||||||
} else if (!criteriaElement.hasType() || criteriaElement.getType().size() == 1) {
|
} else if (!criteriaElement.hasType() || criteriaElement.getType().size() == 1) {
|
||||||
if (discriminator.contains("["))
|
if (discriminator.contains("["))
|
||||||
discriminator = discriminator.substring(0, discriminator.indexOf('['));
|
discriminator = discriminator.substring(0, discriminator.indexOf('['));
|
||||||
type = criteriaElement.getType().get(0).getWorkingCode();
|
if (criteriaElement.hasType()) {
|
||||||
|
type = criteriaElement.getType().get(0).getWorkingCode();
|
||||||
|
} else if (!criteriaElement.getPath().contains(".")) {
|
||||||
|
type = criteriaElement.getPath();
|
||||||
|
} else {
|
||||||
|
throw new DefinitionException(context.formatMessage(I18nConstants.DISCRIMINATOR__IS_BASED_ON_TYPE_BUT_SLICE__IN__HAS_NO_TYPES, discriminator, ed.getId(), profile.getUrl()));
|
||||||
|
}
|
||||||
} else if (criteriaElement.getType().size() > 1) {
|
} else if (criteriaElement.getType().size() > 1) {
|
||||||
throw new DefinitionException(context.formatMessage(I18nConstants.DISCRIMINATOR__IS_BASED_ON_TYPE_BUT_SLICE__IN__HAS_MULTIPLE_TYPES_, discriminator, ed.getId(), profile.getUrl(), criteriaElement.typeSummary()));
|
throw new DefinitionException(context.formatMessage(I18nConstants.DISCRIMINATOR__IS_BASED_ON_TYPE_BUT_SLICE__IN__HAS_MULTIPLE_TYPES_, discriminator, ed.getId(), profile.getUrl(), criteriaElement.typeSummary()));
|
||||||
} else
|
} else
|
||||||
|
|
Loading…
Reference in New Issue