Skip to content

Commit

Permalink
Add check
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesagnew committed Nov 28, 2024
1 parent 224f5c6 commit cb9ab2a
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
import jakarta.persistence.criteria.Predicate;
import jakarta.persistence.criteria.Root;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.hl7.fhir.instance.model.api.IAnyResource;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType;
Expand Down Expand Up @@ -166,6 +167,9 @@ public IResourceLookup<JpaPid> resolveResourceIdentity(
List<IIdType> ids = List.of(id);
Map<IIdType, IResourceLookup<JpaPid>> outcome = resolveResourceIdentities(theRequestPartitionId, ids, theMode);

// We only pass 1 input in so only 0..1 will come back
Validate.isTrue(outcome.size() <= 1, "Unexpected output size %s for ID: %s", outcome.size(), ids);

IResourceLookup<JpaPid> retVal;
if (untyped) {
if (outcome.isEmpty()) {
Expand All @@ -177,7 +181,6 @@ public IResourceLookup<JpaPid> resolveResourceIdentity(
retVal = outcome.get(id);
}

// We only pass 1 input in so only 0..1 will come back
if (retVal == null) {
throw new ResourceNotFoundException(Msg.code(2001) + "Resource " + id + " is not known");
}
Expand Down

0 comments on commit cb9ab2a

Please sign in to comment.