Handle missing contained subscription
@@ -354,6 +354,7 @@ public class SubscriptionCanonicalizer {
}
@SuppressWarnings("EnumSwitchStatementWhichMissesCases")
+ @Nullable
public String getCriteria(IBaseResource theSubscription) {
String retVal = null;
@@ -371,7 +372,10 @@ public class SubscriptionCanonicalizer {
org.hl7.fhir.r5.model.Subscription subscription = (org.hl7.fhir.r5.model.Subscription) theSubscription;
String topicElement = subscription.getTopicElement().getValue();
org.hl7.fhir.r5.model.SubscriptionTopic topic = (org.hl7.fhir.r5.model.SubscriptionTopic) subscription.getContained().stream().filter(t -> ("#" + t.getId()).equals(topicElement) || (t.getId()).equals(topicElement)).findFirst().orElse(null);
- Validate.notNull(topic);
+ if (topic == null) {
+ ourLog.warn("Missing contained subscription topic in R5 subscription");
+ return null;
+ }
retVal = topic.getResourceTriggerFirstRep().getQueryCriteria().getCurrent();
break;
}
