From c79a705124da28154f726d0016dea17c27d09e49 Mon Sep 17 00:00:00 2001 From: James Agnew Date: Thu, 14 Nov 2024 07:38:46 -0500 Subject: [PATCH] Test cleanup --- .../src/main/java/ca/uhn/fhir/jpa/dao/HistoryBuilder.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/HistoryBuilder.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/HistoryBuilder.java index a44d3bbf0a7..025f7e198b1 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/HistoryBuilder.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/HistoryBuilder.java @@ -172,8 +172,9 @@ public class HistoryBuilder { // For that reason, strip the prefix before setting the transientForcedId below. // If not stripped this messes up the id of the resource as the resourceType would be repeated // twice like Patient/Patient/1234 in the resource constructed - if (resourceId.startsWith(myResourceType + "/")) { - resourceId = resourceId.substring(myResourceType.length() + 1); + int slashIdx = resourceId.indexOf('/'); + if (slashIdx != -1) { + resourceId = resourceId.substring(slashIdx + 1); } } else { resourceId = nextResourceId.toString();