From 4bb495e9d717c64e611ab0f93483c44b8445d33e Mon Sep 17 00:00:00 2001 From: James Agnew Date: Fri, 2 Jul 2021 05:29:49 -0400 Subject: [PATCH] Fix NPE (#2774) --- .../uhn/fhir/jpa/model/entity/PartitionablePartitionId.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/PartitionablePartitionId.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/PartitionablePartitionId.java index b11d69e1c18..fe41712ffee 100644 --- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/PartitionablePartitionId.java +++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/PartitionablePartitionId.java @@ -22,6 +22,7 @@ package ca.uhn.fhir.jpa.model.entity; import ca.uhn.fhir.interceptor.model.RequestPartitionId; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import javax.persistence.Column; import javax.persistence.Embeddable; @@ -84,12 +85,12 @@ public class PartitionablePartitionId implements Cloneable { return RequestPartitionId.fromPartitionId(getPartitionId(), getPartitionDate()); } - @Nullable + @Nonnull public static RequestPartitionId toRequestPartitionId(@Nullable PartitionablePartitionId theRequestPartitionId) { if (theRequestPartitionId != null) { return theRequestPartitionId.toPartitionId(); } else { - return null; + return RequestPartitionId.defaultPartition(); } } }