fix problems generating snapshots in publisher when some profiles are not valid

This commit is contained in:
Grahame Grieve 2020-09-09 11:48:11 +10:00
parent 295b1659af
commit b9bef4c3c8
1 changed files with 9 additions and 3 deletions

View File

@ -514,7 +514,6 @@ public class ProfileUtilities extends TranslatingUtilities {
}
checkNotGenerating(base, "Base for generating a snapshot for the profile "+derived.getUrl());
checkNotGenerating(derived, "Focus for generating a snapshot");
derived.setUserData("profileutils.snapshot.generating", true);
if (!base.hasType()) {
throw new DefinitionException(context.formatMessage(I18nConstants.BASE_PROFILE__HAS_NO_TYPE, base.getUrl()));
@ -532,6 +531,7 @@ public class ProfileUtilities extends TranslatingUtilities {
if (snapshotStack.contains(derived.getUrl())) {
throw new DefinitionException(context.formatMessage(I18nConstants.CIRCULAR_SNAPSHOT_REFERENCES_DETECTED_CANNOT_GENERATE_SNAPSHOT_STACK__, snapshotStack.toString()));
}
derived.setUserData("profileutils.snapshot.generating", true);
snapshotStack.add(derived.getUrl());
if (!Utilities.noString(webUrl) && !webUrl.endsWith("/"))
@ -695,6 +695,7 @@ public class ProfileUtilities extends TranslatingUtilities {
} catch (Exception e) {
// if we had an exception generating the snapshot, make sure we don't leave any half generated snapshot behind
derived.setSnapshot(null);
derived.clearUserData("profileutils.snapshot.generating");
throw e;
}
derived.clearUserData("profileutils.snapshot.generating");
@ -786,7 +787,7 @@ public class ProfileUtilities extends TranslatingUtilities {
throw new FHIRException(context.formatMessage(I18nConstants.NO_PATH_VALUE_ON_ELEMENT_IN_DIFFERENTIAL_IN_, url));
}
if (!((first && type.equals(p)) || p.startsWith(type+"."))) {
throw new FHIRException(context.formatMessage(I18nConstants.ILLEGAL_PATH__IN_DIFFERENTIAL_IN__MUST_START_WITH_, p, url, type, (first ? " (o be '"+type+"')" : "")));
throw new FHIRException(context.formatMessage(I18nConstants.ILLEGAL_PATH__IN_DIFFERENTIAL_IN__MUST_START_WITH_, p, url, type, (first ? " (or be '"+type+"')" : "")));
}
if (p.contains(".")) {
// Element names (the parts of a path delineated by the '.' character) SHALL NOT contain whitespace (i.e. Unicode characters marked as whitespace)
@ -6096,7 +6097,12 @@ public class ProfileUtilities extends TranslatingUtilities {
if (!c.hasExpression()) {
return null;
}
ExpressionNode expr = fpe.parse(c.getExpression());
ExpressionNode expr = null;
try {
expr = fpe.parse(c.getExpression());
} catch (Exception e) {
return null;
}
if (expr.getKind() != Kind.Group || expr.getOpNext() == null || !(expr.getOperation() == Operation.Equals || expr.getOperation() == Operation.LessOrEqual)) {
return null;
}