Fix issue with startsWith in FHIRPath engine

This commit is contained in:
Grahame Grieve 2022-07-20 11:24:13 +10:00
parent ce0c2f2ff4
commit e150b50f54
1 changed files with 6 additions and 0 deletions

View File

@ -5094,6 +5094,9 @@ public class FHIRPathEngine {
int i2 = -1;
if (exp.parameterCount() == 2) {
List<Base> n2 = execute(context, focus, exp.getParameters().get(1), true);
if (n2.isEmpty()|| !n2.get(0).isPrimitive() || !Utilities.isInteger(n2.get(0).primitiveValue())) {
return new ArrayList<Base>();
}
i2 = Integer.parseInt(n2.get(0).primitiveValue());
}
@ -5104,6 +5107,9 @@ public class FHIRPathEngine {
return new ArrayList<Base>();
}
if (exp.parameterCount() == 2) {
if (i1+i2 >= sw.length()) {
return new ArrayList<Base>();
}
s = sw.substring(i1, Math.min(sw.length(), i1+i2));
} else {
s = sw.substring(i1);