From c94352f2b39e0bff56d7812c3eabad11ffc9dd7e Mon Sep 17 00:00:00 2001 From: markiantorno Date: Thu, 31 Jul 2025 13:04:20 -0400 Subject: [PATCH 01/17] fixing checkstyle issues, configuring pom to run checkstyle:check --- .gitignore | 2 +- .../instance/model/api/IBaseReference.java | 4 +++- .../canonical/VersionCanonicalizer.java | 2 +- .../jpa/cache/ResourceTypeCacheSvcImpl.java | 3 ++- .../packages/AdditionalResourcesParser.java | 7 ++++--- .../BaseResourceHistoryPredicateBuilder.java | 2 +- .../fulltext/FullTextExtractionRequest.java | 13 ++++++------ .../fulltext/FullTextExtractionResponse.java | 4 ++-- .../SubscriptionDeliveryValidator.java | 2 +- .../NaiveRepositoryTransactionProcessor.java | 12 ++++++----- .../impl/memory/InMemoryFhirRepository.java | 3 ++- .../impl/memory/NaiveSearching.java | 9 ++++---- .../impl/memory/ResourceStorage.java | 4 +++- .../jobs/export/BulkDataExportProvider.java | 4 ++-- .../merge/MergeUpdateTaskReducerStep.java | 4 ++-- .../ProvenanceAgentJson.java | 4 ++-- .../broker/api/ChannelProducerSettings.java | 10 +++++---- .../java/ca/uhn/fhir/jpa/patch/FhirPatch.java | 2 +- .../ReplaceReferencesRequest.java | 2 +- .../UndoReplaceReferencesRequest.java | 2 +- pom.xml | 21 +++++++++++++++++++ 21 files changed, 74 insertions(+), 42 deletions(-) diff --git a/.gitignore b/.gitignore index 1e9ce672b0c1..6089052ebedd 100644 --- a/.gitignore +++ b/.gitignore @@ -170,6 +170,6 @@ Snap.* /database*/ /activemq-data/ /.run/ -/CLAUDE.md +**/CLAUDE.md **/.claude/settings.local.json diff --git a/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IBaseReference.java b/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IBaseReference.java index 1da438235288..7e8581307f06 100644 --- a/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IBaseReference.java +++ b/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IBaseReference.java @@ -19,6 +19,8 @@ */ package org.hl7.fhir.instance.model.api; +import ca.uhn.fhir.i18n.Msg; + public interface IBaseReference extends ICompositeType { IBaseResource getResource(); @@ -38,7 +40,7 @@ default boolean hasIdentifier() { } default IBaseReference setIdentifier(ICompositeType theIdentifier) { - throw new UnsupportedOperationException("This reference does not support identifiers"); + throw new UnsupportedOperationException(Msg.code(2759) + "This reference does not support identifiers"); } default ICompositeType getIdentifier() { diff --git a/hapi-fhir-converter/src/main/java/ca/uhn/hapi/converters/canonical/VersionCanonicalizer.java b/hapi-fhir-converter/src/main/java/ca/uhn/hapi/converters/canonical/VersionCanonicalizer.java index 847f743e8436..3911e44b8abf 100644 --- a/hapi-fhir-converter/src/main/java/ca/uhn/hapi/converters/canonical/VersionCanonicalizer.java +++ b/hapi-fhir-converter/src/main/java/ca/uhn/hapi/converters/canonical/VersionCanonicalizer.java @@ -566,7 +566,7 @@ private String encodeAsString(IBaseResource theResource) { } else if (myDstu2Hl7OrgContext.getVersion().getVersion().equals(version)) { return myDstu2Hl7OrgContext.newJsonParser().encodeResourceToString(theResource); } else { - throw new IllegalArgumentException("Cannot encode resource with version: %s".formatted(version)); + throw new IllegalArgumentException(Msg.code(2580) + "Cannot encode resource with version: %s".formatted(version)); } } } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/cache/ResourceTypeCacheSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/cache/ResourceTypeCacheSvcImpl.java index b885fb902b8b..b3c4df86046a 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/cache/ResourceTypeCacheSvcImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/cache/ResourceTypeCacheSvcImpl.java @@ -19,6 +19,7 @@ */ package ca.uhn.fhir.jpa.cache; +import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.jpa.config.util.ResourceTypeUtil; import ca.uhn.fhir.jpa.dao.data.IResourceTypeDao; import ca.uhn.fhir.jpa.dao.tx.IHapiTransactionService; @@ -119,7 +120,7 @@ protected ResourceTypeEntity createResourceType(String theResourceType) { myResourceTypeDao.flush(); } catch (DataIntegrityViolationException e) { if (e.getMessage().contains("Value too long for column")) { - throw new InternalErrorException("Resource type name is too long: " + theResourceType, e); + throw new InternalErrorException(Msg.code(2764) + "Resource type name is too long: " + theResourceType, e); } // This can happen if the resource type already exists in the database ourLog.info("Resource type already exists: {}", theResourceType); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/packages/AdditionalResourcesParser.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/packages/AdditionalResourcesParser.java index bb26cec28b59..a843c7d419e7 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/packages/AdditionalResourcesParser.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/packages/AdditionalResourcesParser.java @@ -20,6 +20,7 @@ package ca.uhn.fhir.jpa.packages; import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.parser.IParser; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.util.BundleBuilder; @@ -45,7 +46,7 @@ public static IBaseBundle bundleAdditionalResources( try { npmPackage = NpmPackage.fromPackage(new ByteArrayInputStream(packageInstallationSpec.getPackageContents())); } catch (IOException e) { - throw new InternalErrorException(e); + throw new InternalErrorException(Msg.code(2765) + e); } List resources = getAdditionalResources(additionalResources, npmPackage, fhirContext); @@ -73,7 +74,7 @@ public static List getAdditionalResources( .flatMap(Collection::stream) .collect(Collectors.toList()); } catch (IOException e) { - throw new InternalErrorException(e.getMessage(), e); + throw new InternalErrorException(Msg.code(2766) + e.getMessage(), e); } resources.addAll(fileNames.stream() @@ -81,7 +82,7 @@ public static List getAdditionalResources( try { return new String(folder.fetchFile(fileName)); } catch (IOException e) { - throw new InternalErrorException(e.getMessage(), e); + throw new InternalErrorException(Msg.code(2767) + e.getMessage(), e); } }) .map(parser::parseResource) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/BaseResourceHistoryPredicateBuilder.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/BaseResourceHistoryPredicateBuilder.java index d61c791c4193..f61c875b9828 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/BaseResourceHistoryPredicateBuilder.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/BaseResourceHistoryPredicateBuilder.java @@ -113,7 +113,7 @@ private Condition createPredicateSourceContains(JpaStorageSettings theStorageSet return BinaryCondition.like(upperFunction, generatePlaceholder(containsLikeExpression)); } else { throw new MethodNotAllowedException( - Msg.code(getContainsModifierDisabledCode()) + ":contains modifier is disabled on this server"); + Msg.code(2768) + ":contains modifier is disabled on this server"); } } diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/fulltext/FullTextExtractionRequest.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/fulltext/FullTextExtractionRequest.java index 50101d8c7739..19965b49ba5d 100644 --- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/fulltext/FullTextExtractionRequest.java +++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/fulltext/FullTextExtractionRequest.java @@ -24,7 +24,6 @@ import org.hl7.fhir.instance.model.api.IIdType; import java.util.function.Supplier; -import javax.annotation.Nullable; /** * This is a request object containing a request to extract the FullText index data from @@ -35,10 +34,10 @@ */ public class FullTextExtractionRequest { - @Nullable + @Nonnull private final IIdType myResourceId; - @Nullable + @Nonnull private final IBaseResource myResource; @Nonnull @@ -51,8 +50,8 @@ public class FullTextExtractionRequest { * Constructor */ public FullTextExtractionRequest( - @Nullable IIdType theResourceId, - @Nullable IBaseResource theResource, + @Nonnull IIdType theResourceId, + @Nonnull IBaseResource theResource, @Nonnull String theResourceType, @Nonnull Supplier theDefaultSupplier) { myResourceId = theResourceId; @@ -71,7 +70,7 @@ public boolean isDelete() { /** * @return Returns the ID of the resource being indexed. This may be null if a new resource is being created, and a type isn't assigned yet */ - @Nullable + @Nonnull public IIdType getResourceId() { return myResourceId; } @@ -79,7 +78,7 @@ public IIdType getResourceId() { /** * @return Returns the resource being indexed. May be null if the operation is a resource deletion. */ - @Nullable + @Nonnull public IBaseResource getResource() { return myResource; } diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/fulltext/FullTextExtractionResponse.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/fulltext/FullTextExtractionResponse.java index aaf30d94d4d2..f553020fc36a 100644 --- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/fulltext/FullTextExtractionResponse.java +++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/fulltext/FullTextExtractionResponse.java @@ -19,7 +19,7 @@ */ package ca.uhn.fhir.jpa.searchparam.fulltext; -import javax.annotation.Nullable; +import jakarta.annotation.Nonnull; /** * This is a response object containing the FullText index data which should be stored during @@ -72,7 +72,7 @@ public static FullTextExtractionResponse doNotIndex() { * * @param thePayload The fulltext payload string. May be null if no payload should be specified for the given resource. */ - public static FullTextExtractionResponse indexPayload(@Nullable String thePayload) { + public static FullTextExtractionResponse indexPayload(@Nonnull String thePayload) { return new FullTextExtractionResponse(false, false, thePayload); } diff --git a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/channel/subscription/SubscriptionDeliveryValidator.java b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/channel/subscription/SubscriptionDeliveryValidator.java index 4437316bcfd7..b38f5b530b7c 100644 --- a/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/channel/subscription/SubscriptionDeliveryValidator.java +++ b/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/channel/subscription/SubscriptionDeliveryValidator.java @@ -71,7 +71,7 @@ public void validate(IIdType theSubscriptionId, ResourceDeliveryMessage theResou case OFF: case NULL: default: - throw new SubscriptionInactiveException(Msg.code(2668) + "Attempting to deliver " + throw new SubscriptionInactiveException(Msg.code(2762) + "Attempting to deliver " + theResourceDeliveryMessage.getPayloadId() + " to disabled subscription " + subscription.getIdElementString() + ". Aborting delivery."); } diff --git a/hapi-fhir-repositories/src/main/java/ca/uhn/fhir/repository/impl/NaiveRepositoryTransactionProcessor.java b/hapi-fhir-repositories/src/main/java/ca/uhn/fhir/repository/impl/NaiveRepositoryTransactionProcessor.java index d377ebc0a146..e19d9a8b4017 100644 --- a/hapi-fhir-repositories/src/main/java/ca/uhn/fhir/repository/impl/NaiveRepositoryTransactionProcessor.java +++ b/hapi-fhir-repositories/src/main/java/ca/uhn/fhir/repository/impl/NaiveRepositoryTransactionProcessor.java @@ -1,6 +1,7 @@ package ca.uhn.fhir.repository.impl; import ca.uhn.fhir.context.BaseRuntimeElementDefinition; +import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.repository.IRepository; import ca.uhn.fhir.rest.api.Constants; @@ -82,8 +83,8 @@ public B processTransaction(B theTransactionBundle) { case POST -> processPost(e, now); case PUT -> processPut(e, now); case DELETE -> processDelete(e, now); - default -> throw new NotImplementedOperationException( - "Transaction stub only supports POST, PUT, or DELETE"); + default -> throw new NotImplementedOperationException(Msg.code(2769) + + "Transaction stub only supports POST, PUT, or DELETE"); }; bundleBuilder.addEntry(myResponseEntryBuilder.apply(responseEntry)); } @@ -120,7 +121,7 @@ private static void validateNoLogicalUrl(BundleEntryParts theBundleEntryParts) { String url = theBundleEntryParts.getUrl(); Validate.notNull(url, "request url must not be null: entry %s", theBundleEntryParts.getFullUrl()); if (url.contains("?")) { - throw new UnprocessableEntityException("Conditional urls are not supported"); + throw new UnprocessableEntityException(Msg.code(2770) + "Conditional urls are not supported"); } } @@ -129,7 +130,7 @@ protected BundleResponseEntryParts processPost( BundleEntryParts theBundleEntryParts, IPrimitiveType theInstant) { // we assume POST is always "create", not an operation invocation if (theBundleEntryParts.getConditionalUrl() != null) { - throw new UnprocessableEntityException("Conditional create urls are not supported"); + throw new UnprocessableEntityException(Msg.code(2771) + "Conditional create urls are not supported"); } var responseOutcome = myRepository.create(theBundleEntryParts.getResource()); @@ -197,7 +198,8 @@ protected static String statusCodeToStatusLine(int theResponseStatusCode) { case Constants.STATUS_HTTP_409_CONFLICT -> "409 Conflict"; case Constants.STATUS_HTTP_204_NO_CONTENT -> "204 No Content"; case Constants.STATUS_HTTP_404_NOT_FOUND -> "404 Not Found"; - default -> throw new IllegalArgumentException("Unsupported response status code: " + theResponseStatusCode); + default -> throw new IllegalArgumentException(Msg.code(2776) + "Unsupported response status code: " + + theResponseStatusCode); }; } } diff --git a/hapi-fhir-repositories/src/main/java/ca/uhn/fhir/repository/impl/memory/InMemoryFhirRepository.java b/hapi-fhir-repositories/src/main/java/ca/uhn/fhir/repository/impl/memory/InMemoryFhirRepository.java index 172d1d7c3899..5a8145a6d0f0 100644 --- a/hapi-fhir-repositories/src/main/java/ca/uhn/fhir/repository/impl/memory/InMemoryFhirRepository.java +++ b/hapi-fhir-repositories/src/main/java/ca/uhn/fhir/repository/impl/memory/InMemoryFhirRepository.java @@ -1,6 +1,7 @@ package ca.uhn.fhir.repository.impl.memory; import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.model.api.IQueryParameterType; import ca.uhn.fhir.repository.IRepository; import ca.uhn.fhir.repository.impl.NaiveRepositoryTransactionProcessor; @@ -121,7 +122,7 @@ private String formatResource(IBaseResource theResource) { @Override public synchronized MethodOutcome patch( I theId, P thePatchParameters, Map theHeaders) { - throw new NotImplementedOperationException("The PATCH operation is not currently supported"); + throw new NotImplementedOperationException(Msg.code(2772) + "The PATCH operation is not currently supported"); } @Override diff --git a/hapi-fhir-repositories/src/main/java/ca/uhn/fhir/repository/impl/memory/NaiveSearching.java b/hapi-fhir-repositories/src/main/java/ca/uhn/fhir/repository/impl/memory/NaiveSearching.java index a56a6f7ae8bc..5fc90318d3e9 100644 --- a/hapi-fhir-repositories/src/main/java/ca/uhn/fhir/repository/impl/memory/NaiveSearching.java +++ b/hapi-fhir-repositories/src/main/java/ca/uhn/fhir/repository/impl/memory/NaiveSearching.java @@ -1,6 +1,7 @@ package ca.uhn.fhir.repository.impl.memory; import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.i18n.Msg; import ca.uhn.fhir.model.api.IQueryParameterType; import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.rest.param.ReferenceParam; @@ -127,8 +128,8 @@ IdDt normalizeIdParamToIdPart(IQueryParameterType theIdParam) { } else if (theIdParam instanceof StringParam stringParam) { return new IdDt(stringParam.getValue()); } else { - throw new IllegalArgumentException( - "Unsupported _id parameter type: " + theIdParam.getClass().getName()); + throw new IllegalArgumentException(Msg.code(2773) + + "Unsupported _id parameter type: " + theIdParam.getClass().getName()); } } @@ -138,8 +139,8 @@ Predicate matchPredicate(Multimap getStringPrimitiveFromParametersParameter( } else if (value instanceof IBaseReference patientReference) { return patientReference.getReferenceElement(); } else { - throw new InvalidRequestException("Unsupported type."); + throw new InvalidRequestException(Msg.code(2763) + "Unsupported type."); } } catch (Exception e) { - throw new InvalidRequestException("Invalid patient parameter.", e); + throw new InvalidRequestException(Msg.code(2764) + "Invalid patient parameter.", e); } } diff --git a/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/merge/MergeUpdateTaskReducerStep.java b/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/merge/MergeUpdateTaskReducerStep.java index 787f2fffb97f..2294077814cf 100644 --- a/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/merge/MergeUpdateTaskReducerStep.java +++ b/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/merge/MergeUpdateTaskReducerStep.java @@ -31,10 +31,10 @@ import ca.uhn.fhir.merge.MergeOperationInputParameterNames; import ca.uhn.fhir.merge.MergeProvenanceSvc; import ca.uhn.fhir.rest.api.server.RequestDetails; +import jakarta.annotation.Nonnull; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.r4.model.Parameters; import org.hl7.fhir.r4.model.Patient; -import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; @@ -137,7 +137,7 @@ private boolean isDeleteSource(Parameters originalInputParameters) { return deleteSource; } - private @Nullable Patient getResultResource(Parameters theOriginalInputParameters) { + private @Nonnull Patient getResultResource(Parameters theOriginalInputParameters) { Patient resultResource = null; String resultResourceParamName = myMergeOperationInputParameterNames.getResultResourceParameterName(); if (theOriginalInputParameters.hasParameter(resultResourceParamName)) { diff --git a/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/replacereferences/ProvenanceAgentJson.java b/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/replacereferences/ProvenanceAgentJson.java index a70b07d184b6..e49f2cd5c87d 100644 --- a/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/replacereferences/ProvenanceAgentJson.java +++ b/hapi-fhir-storage-batch2-jobs/src/main/java/ca/uhn/fhir/batch2/jobs/replacereferences/ProvenanceAgentJson.java @@ -25,11 +25,11 @@ import ca.uhn.fhir.parser.IParser; import ca.uhn.fhir.util.TerserUtil; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.annotation.Nonnull; import org.hl7.fhir.instance.model.api.IBaseReference; import java.util.List; import java.util.stream.Collectors; -import javax.annotation.Nullable; /** * ProvenanceAgentJson is a JSON representation of an IProvenanceAgent. @@ -75,7 +75,7 @@ public static ProvenanceAgentJson from(IProvenanceAgent theProvenanceAgent, Fhir } public static List from( - @Nullable List theProvenanceAgents, FhirContext theFhirContext) { + @Nonnull List theProvenanceAgents, FhirContext theFhirContext) { if (theProvenanceAgents == null) { return null; } diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/broker/api/ChannelProducerSettings.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/broker/api/ChannelProducerSettings.java index 88e984a413e5..07f19541d939 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/broker/api/ChannelProducerSettings.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/broker/api/ChannelProducerSettings.java @@ -19,14 +19,15 @@ */ package ca.uhn.fhir.broker.api; -import javax.annotation.Nullable; + +import jakarta.annotation.Nonnull; public class ChannelProducerSettings extends BaseChannelSettings { public static final Integer DEFAULT_CHANNEL_CONSUMERS = 2; private Integer myConcurrentConsumers = DEFAULT_CHANNEL_CONSUMERS; - @Nullable + @Nonnull private String myProducerSuffix; /** @@ -34,6 +35,7 @@ public class ChannelProducerSettings extends BaseChannelSettings { */ public ChannelProducerSettings() { super(); + myProducerSuffix = ""; } public Integer getConcurrentConsumers() { @@ -51,7 +53,7 @@ public ChannelProducerSettings setConcurrentConsumers(int theConcurrentConsumers * In the case where the Message Broker adds a suffix to the channel name to define the producer name, this allows * control of the suffix used. */ - @Nullable + @Nonnull public String getProducerNameSuffix() { return myProducerSuffix; } @@ -60,7 +62,7 @@ public String getProducerNameSuffix() { * In the case where the Message Broker adds a suffix to the channel name to define the producer name, this allows * control of the suffix used. */ - public ChannelProducerSettings setProducerNameSuffix(@Nullable String theProducerNameSuffix) { + public ChannelProducerSettings setProducerNameSuffix(@Nonnull String theProducerNameSuffix) { myProducerSuffix = theProducerNameSuffix; return this; } diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/patch/FhirPatch.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/patch/FhirPatch.java index ad47b675e0bc..b23dcca2d549 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/patch/FhirPatch.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/jpa/patch/FhirPatch.java @@ -571,7 +571,7 @@ private List applySubsettingFilter( private void throwNoElementsError(String theFullReplacePath) { String msg = myContext.getLocalizer().getMessage(FhirPatch.class, "noMatchingElementForPath", theFullReplacePath); - throw new InvalidRequestException(Msg.code(2617) + msg); + throw new InvalidRequestException(Msg.code(2761) + msg); } private void handleMoveOperation(IBaseResource theResource, IBase theParameters) { diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/replacereferences/ReplaceReferencesRequest.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/replacereferences/ReplaceReferencesRequest.java index 7945f218a4c6..20166dfa6256 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/replacereferences/ReplaceReferencesRequest.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/replacereferences/ReplaceReferencesRequest.java @@ -26,7 +26,7 @@ import org.hl7.fhir.instance.model.api.IIdType; import java.util.List; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import static ca.uhn.fhir.rest.server.provider.ProviderConstants.OPERATION_REPLACE_REFERENCES_PARAM_SOURCE_REFERENCE_ID; import static ca.uhn.fhir.rest.server.provider.ProviderConstants.OPERATION_REPLACE_REFERENCES_PARAM_TARGET_REFERENCE_ID; diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/replacereferences/UndoReplaceReferencesRequest.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/replacereferences/UndoReplaceReferencesRequest.java index b7ebcbe0412f..5cb2a933561a 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/replacereferences/UndoReplaceReferencesRequest.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/replacereferences/UndoReplaceReferencesRequest.java @@ -22,7 +22,7 @@ import ca.uhn.fhir.interceptor.model.RequestPartitionId; import org.hl7.fhir.instance.model.api.IIdType; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; /** * This class models the parameters for processing a $hapi.fhir.undo-replace-references operation. diff --git a/pom.xml b/pom.xml index 93e7dc5e68bb..f3b42639d2a3 100644 --- a/pom.xml +++ b/pom.xml @@ -2698,6 +2698,27 @@ maven-checkstyle-plugin true ${maven-checkstyle-version} + + + com.puppycrawl.tools + checkstyle + ${checkstyle_version} + + + ca.uhn.hapi.fhir + hapi-fhir-checkstyle + ${project.version} + + + + **/osgi/**/*, **/.mvn/**/*, **/.mvn_/**/* + true + checkstyle/hapi-base-checkstyle.xml + checkstyle/hapi-base-checkstyle-suppression.xml + UTF-8 + true + true + org.apache.maven.plugins From 228674c28b85f8d0129a397b421b18a3dab8822e Mon Sep 17 00:00:00 2001 From: markiantorno Date: Thu, 31 Jul 2025 13:32:53 -0400 Subject: [PATCH 02/17] changing checks to run CHECKSTYLE over all modules --- .../java/ca/uhn/fhir/cli/ValidateCommand.java | 3 +- .../canonical/VersionCanonicalizer.java | 2 +- .../jpa/logging/SqlLoggerFilteringUtil.java | 2 +- .../impl/memory/NaiveSearching.java | 2 +- .../jobs/export/BulkDataExportProvider.java | 2 +- pom.xml | 34 +++++++++++++++++++ 6 files changed, 40 insertions(+), 5 deletions(-) diff --git a/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/ValidateCommand.java b/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/ValidateCommand.java index 5d185ec78a77..6afe3e46a720 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/ValidateCommand.java +++ b/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/ValidateCommand.java @@ -103,7 +103,8 @@ private byte[] loadFileAsByteArray(String theFileName) throws ParseException { input = IOUtils.toByteArray(new FileInputStream(new File(theFileName))); } catch (IOException e) { throw new ParseException( - Msg.code(1615) + "Failed to load file '" + theFileName + "' - Error: " + e.toString()); +// Msg.code(1615) + "Failed to load file '" + theFileName + "' - Error: " + e.toString()); + Msg.code(2478) + "Failed to load file '" + theFileName + "' - Error: " + e.toString()); } return input; } diff --git a/hapi-fhir-converter/src/main/java/ca/uhn/hapi/converters/canonical/VersionCanonicalizer.java b/hapi-fhir-converter/src/main/java/ca/uhn/hapi/converters/canonical/VersionCanonicalizer.java index 3911e44b8abf..3f57bff147df 100644 --- a/hapi-fhir-converter/src/main/java/ca/uhn/hapi/converters/canonical/VersionCanonicalizer.java +++ b/hapi-fhir-converter/src/main/java/ca/uhn/hapi/converters/canonical/VersionCanonicalizer.java @@ -566,7 +566,7 @@ private String encodeAsString(IBaseResource theResource) { } else if (myDstu2Hl7OrgContext.getVersion().getVersion().equals(version)) { return myDstu2Hl7OrgContext.newJsonParser().encodeResourceToString(theResource); } else { - throw new IllegalArgumentException(Msg.code(2580) + "Cannot encode resource with version: %s".formatted(version)); + throw new IllegalArgumentException(Msg.code(2777) + "Cannot encode resource with version: %s".formatted(version)); } } } diff --git a/hapi-fhir-jpa/src/main/java/ca/uhn/fhir/jpa/logging/SqlLoggerFilteringUtil.java b/hapi-fhir-jpa/src/main/java/ca/uhn/fhir/jpa/logging/SqlLoggerFilteringUtil.java index 7dd1fcd0d181..14646cb59572 100644 --- a/hapi-fhir-jpa/src/main/java/ca/uhn/fhir/jpa/logging/SqlLoggerFilteringUtil.java +++ b/hapi-fhir-jpa/src/main/java/ca/uhn/fhir/jpa/logging/SqlLoggerFilteringUtil.java @@ -126,7 +126,7 @@ public void run() { } catch (Exception theE) { ourLog.error("Hibernate SQL log filters not refreshed. Exception: {} \n{}", theE, theE.getStackTrace()); - throw new RuntimeException(Msg.code(2478) + theE); + throw new RuntimeException(Msg.code(2778) + theE); } finally { myRefreshDoneLatch.countDown(); } diff --git a/hapi-fhir-repositories/src/main/java/ca/uhn/fhir/repository/impl/memory/NaiveSearching.java b/hapi-fhir-repositories/src/main/java/ca/uhn/fhir/repository/impl/memory/NaiveSearching.java index 5fc90318d3e9..2e5bedb3cada 100644 --- a/hapi-fhir-repositories/src/main/java/ca/uhn/fhir/repository/impl/memory/NaiveSearching.java +++ b/hapi-fhir-repositories/src/main/java/ca/uhn/fhir/repository/impl/memory/NaiveSearching.java @@ -139,7 +139,7 @@ Predicate matchPredicate(Multimap getStringPrimitiveFromParametersParameter( throw new InvalidRequestException(Msg.code(2763) + "Unsupported type."); } } catch (Exception e) { - throw new InvalidRequestException(Msg.code(2764) + "Invalid patient parameter.", e); + throw new InvalidRequestException(Msg.code(2779) + "Invalid patient parameter.", e); } } diff --git a/pom.xml b/pom.xml index f3b42639d2a3..572a3bcf18a0 100644 --- a/pom.xml +++ b/pom.xml @@ -3031,6 +3031,40 @@ + + CHECKSTYLE-ALL + + + + org.apache.maven.plugins + maven-checkstyle-plugin + false + + + ./ + + **/src/main/java/**/*.java + **/osgi/**/*, **/.mvn/**/*, **/.mvn_/**/*, **/target/**/*, **/test/**/* + false + checkstyle/hapi-base-checkstyle.xml + checkstyle/hapi-base-checkstyle-suppression.xml + UTF-8 + true + true + + + + checkstyle-all-modules + validate + + check + + + + + + + ERRORPRONE From 191835d936b47d1c7530d4c1024f4fe14af8f72c Mon Sep 17 00:00:00 2001 From: markiantorno Date: Thu, 31 Jul 2025 13:38:27 -0400 Subject: [PATCH 03/17] checkstyle now runs on every PR across every module, and fails fast --- .github/workflows/pull-request.yml | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 95b4a29a659c..5c7e73932055 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -28,8 +28,31 @@ jobs: outputs: ignored_modules: ${{ steps.load_config.outputs.ignored_modules }} + checkstyle: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up JDK + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '17' + cache: 'maven' + + - name: Run cross-module checkstyle validation + run: | + echo "Running cross-module checkstyle validation to detect duplicate error codes and other violations..." + echo "This step ensures that HAPI FHIR error codes (Msg.code) are unique across all modules." + echo "If this step fails, it means there are checkstyle violations that must be fixed before the build can proceed." + echo "" + mvn clean validate -P CHECKSTYLE-ALL --batch-mode --no-transfer-progress + run-parallel-build: - needs: load-config-and-run + needs: + - load-config-and-run + - checkstyle uses: ./.github/workflows/parallel-pipeline-build.yml with: ignored_modules: ${{ needs.load-config-and-run.outputs.ignored_modules }} From 1ceafe2b9a4b2dca1d9dc8c2f2fbf0594bd50fc0 Mon Sep 17 00:00:00 2001 From: markiantorno Date: Thu, 31 Jul 2025 13:54:49 -0400 Subject: [PATCH 04/17] checkstyle profile now unified instead of having a checkstyle and checkstyle-all --- .github/workflows/pull-request.yml | 2 +- hapi-fhir-checkstyle/pom.xml | 34 ------------------------------ pom.xml | 2 +- 3 files changed, 2 insertions(+), 36 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 5c7e73932055..cc7cdf8bfa29 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -47,7 +47,7 @@ jobs: echo "This step ensures that HAPI FHIR error codes (Msg.code) are unique across all modules." echo "If this step fails, it means there are checkstyle violations that must be fixed before the build can proceed." echo "" - mvn clean validate -P CHECKSTYLE-ALL --batch-mode --no-transfer-progress + mvn clean validate -P CHECKSTYLE --batch-mode --no-transfer-progress run-parallel-build: needs: diff --git a/hapi-fhir-checkstyle/pom.xml b/hapi-fhir-checkstyle/pom.xml index 0d1b62b5bcd8..eab994bc5d42 100644 --- a/hapi-fhir-checkstyle/pom.xml +++ b/hapi-fhir-checkstyle/pom.xml @@ -99,39 +99,5 @@ - - CHECKSTYLE - - - - org.apache.maven.plugins - maven-checkstyle-plugin - - **/osgi/**/*, **/.mvn/**/*, **/.mvn_/**/* - true - - checkstyle/hapi-base-checkstyle.xml - - checkstyle/hapi-base-checkstyle-suppression.xml - UTF-8 - true - - - - checkstyle-across-all-modules - install - - check - - - - hapi-single-module-checkstyle - none - - - - - - diff --git a/pom.xml b/pom.xml index 572a3bcf18a0..221eee9916f3 100644 --- a/pom.xml +++ b/pom.xml @@ -3032,7 +3032,7 @@ - CHECKSTYLE-ALL + CHECKSTYLE From bf5ae1cc82cca9a2d45e5a4f4b0ac08ed941deb0 Mon Sep 17 00:00:00 2001 From: markiantorno Date: Thu, 31 Jul 2025 14:02:52 -0400 Subject: [PATCH 05/17] need to build checkstyle first --- .github/workflows/pull-request.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index cc7cdf8bfa29..fca65a3be83d 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -41,13 +41,18 @@ jobs: java-version: '17' cache: 'maven' + - name: Build checkstyle module + run: | + echo "Building hapi-fhir-checkstyle module first as it's required for cross-module validation..." + mvn clean install -pl hapi-fhir-checkstyle --batch-mode --no-transfer-progress + - name: Run cross-module checkstyle validation run: | echo "Running cross-module checkstyle validation to detect duplicate error codes and other violations..." echo "This step ensures that HAPI FHIR error codes (Msg.code) are unique across all modules." echo "If this step fails, it means there are checkstyle violations that must be fixed before the build can proceed." echo "" - mvn clean validate -P CHECKSTYLE --batch-mode --no-transfer-progress + mvn validate -P CHECKSTYLE --batch-mode --no-transfer-progress run-parallel-build: needs: From 45164b0253dc8eb3afc28673b63157aa9cbf8d55 Mon Sep 17 00:00:00 2001 From: markiantorno Date: Thu, 31 Jul 2025 14:24:16 -0400 Subject: [PATCH 06/17] need to move checkstyle to after the cache build job --- .github/workflows/parallel-pipeline-build.yml | 28 +++++++++++++++++ .github/workflows/pull-request.yml | 30 +------------------ 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/.github/workflows/parallel-pipeline-build.yml b/.github/workflows/parallel-pipeline-build.yml index 40d4bf1c6869..419fa235462e 100644 --- a/.github/workflows/parallel-pipeline-build.yml +++ b/.github/workflows/parallel-pipeline-build.yml @@ -26,9 +26,37 @@ jobs: java-version: '17' cache-path: $HOME/.m2/repository + checkstyle: + runs-on: ubuntu-latest + needs: build-cache + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up JDK + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '17' + cache: 'maven' + + - name: Build checkstyle module + run: | + echo "Building hapi-fhir-checkstyle module first as it's required for cross-module validation..." + mvn clean install -pl hapi-fhir-checkstyle --batch-mode --no-transfer-progress + + - name: Run cross-module checkstyle validation + run: | + echo "Running cross-module checkstyle validation to detect duplicate error codes and other violations..." + echo "This step ensures that HAPI FHIR error codes (Msg.code) are unique across all modules." + echo "If this step fails, it means there are checkstyle violations that must be fixed before the build can proceed." + echo "" + mvn validate -P CHECKSTYLE --batch-mode --no-transfer-progress + generate-module-list: name: Generate List of Modules to Build runs-on: ubuntu-latest + needs: checkstyle outputs: modules_list: ${{ steps.format-modules.outputs.modules_list }} steps: diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index fca65a3be83d..95b4a29a659c 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -28,36 +28,8 @@ jobs: outputs: ignored_modules: ${{ steps.load_config.outputs.ignored_modules }} - checkstyle: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Set up JDK - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: '17' - cache: 'maven' - - - name: Build checkstyle module - run: | - echo "Building hapi-fhir-checkstyle module first as it's required for cross-module validation..." - mvn clean install -pl hapi-fhir-checkstyle --batch-mode --no-transfer-progress - - - name: Run cross-module checkstyle validation - run: | - echo "Running cross-module checkstyle validation to detect duplicate error codes and other violations..." - echo "This step ensures that HAPI FHIR error codes (Msg.code) are unique across all modules." - echo "If this step fails, it means there are checkstyle violations that must be fixed before the build can proceed." - echo "" - mvn validate -P CHECKSTYLE --batch-mode --no-transfer-progress - run-parallel-build: - needs: - - load-config-and-run - - checkstyle + needs: load-config-and-run uses: ./.github/workflows/parallel-pipeline-build.yml with: ignored_modules: ${{ needs.load-config-and-run.outputs.ignored_modules }} From 672244bd69199f4ee74dca8d350cd6d143d09894 Mon Sep 17 00:00:00 2001 From: markiantorno Date: Thu, 31 Jul 2025 14:44:13 -0400 Subject: [PATCH 07/17] applying spotless changes --- .github/workflows/parallel-pipeline-build.yml | 5 +++++ .../src/main/java/ca/uhn/fhir/cli/ValidateCommand.java | 2 +- .../hapi/converters/canonical/VersionCanonicalizer.java | 3 ++- .../ca/uhn/fhir/jpa/cache/ResourceTypeCacheSvcImpl.java | 3 ++- .../predicate/BaseResourceHistoryPredicateBuilder.java | 3 +-- .../impl/NaiveRepositoryTransactionProcessor.java | 8 ++++---- .../uhn/fhir/repository/impl/memory/NaiveSearching.java | 8 ++++---- .../jobs/replacereferences/ProvenanceAgentJson.java | 2 +- .../ca/uhn/fhir/broker/api/ChannelProducerSettings.java | 1 - .../fhir/replacereferences/ReplaceReferencesRequest.java | 2 +- .../replacereferences/UndoReplaceReferencesRequest.java | 3 +-- 11 files changed, 22 insertions(+), 18 deletions(-) diff --git a/.github/workflows/parallel-pipeline-build.yml b/.github/workflows/parallel-pipeline-build.yml index 419fa235462e..9ef87a05de25 100644 --- a/.github/workflows/parallel-pipeline-build.yml +++ b/.github/workflows/parallel-pipeline-build.yml @@ -40,6 +40,11 @@ jobs: java-version: '17' cache: 'maven' + - name: Apply code formatting + run: | + echo "Applying Spotless code formatting to ensure consistent formatting..." + mvn spotless:apply --batch-mode --no-transfer-progress + - name: Build checkstyle module run: | echo "Building hapi-fhir-checkstyle module first as it's required for cross-module validation..." diff --git a/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/ValidateCommand.java b/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/ValidateCommand.java index 6afe3e46a720..58446c4144d7 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/ValidateCommand.java +++ b/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/ValidateCommand.java @@ -103,7 +103,7 @@ private byte[] loadFileAsByteArray(String theFileName) throws ParseException { input = IOUtils.toByteArray(new FileInputStream(new File(theFileName))); } catch (IOException e) { throw new ParseException( -// Msg.code(1615) + "Failed to load file '" + theFileName + "' - Error: " + e.toString()); + // Msg.code(1615) + "Failed to load file '" + theFileName + "' - Error: " + e.toString()); Msg.code(2478) + "Failed to load file '" + theFileName + "' - Error: " + e.toString()); } return input; diff --git a/hapi-fhir-converter/src/main/java/ca/uhn/hapi/converters/canonical/VersionCanonicalizer.java b/hapi-fhir-converter/src/main/java/ca/uhn/hapi/converters/canonical/VersionCanonicalizer.java index 3f57bff147df..1a2062c9c0ad 100644 --- a/hapi-fhir-converter/src/main/java/ca/uhn/hapi/converters/canonical/VersionCanonicalizer.java +++ b/hapi-fhir-converter/src/main/java/ca/uhn/hapi/converters/canonical/VersionCanonicalizer.java @@ -566,7 +566,8 @@ private String encodeAsString(IBaseResource theResource) { } else if (myDstu2Hl7OrgContext.getVersion().getVersion().equals(version)) { return myDstu2Hl7OrgContext.newJsonParser().encodeResourceToString(theResource); } else { - throw new IllegalArgumentException(Msg.code(2777) + "Cannot encode resource with version: %s".formatted(version)); + throw new IllegalArgumentException( + Msg.code(2777) + "Cannot encode resource with version: %s".formatted(version)); } } } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/cache/ResourceTypeCacheSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/cache/ResourceTypeCacheSvcImpl.java index b3c4df86046a..59118f06d08a 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/cache/ResourceTypeCacheSvcImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/cache/ResourceTypeCacheSvcImpl.java @@ -120,7 +120,8 @@ protected ResourceTypeEntity createResourceType(String theResourceType) { myResourceTypeDao.flush(); } catch (DataIntegrityViolationException e) { if (e.getMessage().contains("Value too long for column")) { - throw new InternalErrorException(Msg.code(2764) + "Resource type name is too long: " + theResourceType, e); + throw new InternalErrorException( + Msg.code(2764) + "Resource type name is too long: " + theResourceType, e); } // This can happen if the resource type already exists in the database ourLog.info("Resource type already exists: {}", theResourceType); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/BaseResourceHistoryPredicateBuilder.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/BaseResourceHistoryPredicateBuilder.java index f61c875b9828..ddb3fd490da5 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/BaseResourceHistoryPredicateBuilder.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/BaseResourceHistoryPredicateBuilder.java @@ -112,8 +112,7 @@ private Condition createPredicateSourceContains(JpaStorageSettings theStorageSet String containsLikeExpression = createLeftAndRightMatchLikeExpression(normalizedString); return BinaryCondition.like(upperFunction, generatePlaceholder(containsLikeExpression)); } else { - throw new MethodNotAllowedException( - Msg.code(2768) + ":contains modifier is disabled on this server"); + throw new MethodNotAllowedException(Msg.code(2768) + ":contains modifier is disabled on this server"); } } diff --git a/hapi-fhir-repositories/src/main/java/ca/uhn/fhir/repository/impl/NaiveRepositoryTransactionProcessor.java b/hapi-fhir-repositories/src/main/java/ca/uhn/fhir/repository/impl/NaiveRepositoryTransactionProcessor.java index e19d9a8b4017..c7803308a65e 100644 --- a/hapi-fhir-repositories/src/main/java/ca/uhn/fhir/repository/impl/NaiveRepositoryTransactionProcessor.java +++ b/hapi-fhir-repositories/src/main/java/ca/uhn/fhir/repository/impl/NaiveRepositoryTransactionProcessor.java @@ -83,8 +83,8 @@ public B processTransaction(B theTransactionBundle) { case POST -> processPost(e, now); case PUT -> processPut(e, now); case DELETE -> processDelete(e, now); - default -> throw new NotImplementedOperationException(Msg.code(2769) + - "Transaction stub only supports POST, PUT, or DELETE"); + default -> throw new NotImplementedOperationException( + Msg.code(2769) + "Transaction stub only supports POST, PUT, or DELETE"); }; bundleBuilder.addEntry(myResponseEntryBuilder.apply(responseEntry)); } @@ -198,8 +198,8 @@ protected static String statusCodeToStatusLine(int theResponseStatusCode) { case Constants.STATUS_HTTP_409_CONFLICT -> "409 Conflict"; case Constants.STATUS_HTTP_204_NO_CONTENT -> "204 No Content"; case Constants.STATUS_HTTP_404_NOT_FOUND -> "404 Not Found"; - default -> throw new IllegalArgumentException(Msg.code(2776) + "Unsupported response status code: " - + theResponseStatusCode); + default -> throw new IllegalArgumentException( + Msg.code(2776) + "Unsupported response status code: " + theResponseStatusCode); }; } } diff --git a/hapi-fhir-repositories/src/main/java/ca/uhn/fhir/repository/impl/memory/NaiveSearching.java b/hapi-fhir-repositories/src/main/java/ca/uhn/fhir/repository/impl/memory/NaiveSearching.java index 2e5bedb3cada..cde90c1f2b59 100644 --- a/hapi-fhir-repositories/src/main/java/ca/uhn/fhir/repository/impl/memory/NaiveSearching.java +++ b/hapi-fhir-repositories/src/main/java/ca/uhn/fhir/repository/impl/memory/NaiveSearching.java @@ -128,8 +128,8 @@ IdDt normalizeIdParamToIdPart(IQueryParameterType theIdParam) { } else if (theIdParam instanceof StringParam stringParam) { return new IdDt(stringParam.getValue()); } else { - throw new IllegalArgumentException(Msg.code(2773) + - "Unsupported _id parameter type: " + theIdParam.getClass().getName()); + throw new IllegalArgumentException(Msg.code(2773) + "Unsupported _id parameter type: " + + theIdParam.getClass().getName()); } } @@ -139,8 +139,8 @@ Predicate matchPredicate(Multimap from( - @Nonnull List theProvenanceAgents, FhirContext theFhirContext) { + @Nonnull List theProvenanceAgents, FhirContext theFhirContext) { if (theProvenanceAgents == null) { return null; } diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/broker/api/ChannelProducerSettings.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/broker/api/ChannelProducerSettings.java index 07f19541d939..312e3410714e 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/broker/api/ChannelProducerSettings.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/broker/api/ChannelProducerSettings.java @@ -19,7 +19,6 @@ */ package ca.uhn.fhir.broker.api; - import jakarta.annotation.Nonnull; public class ChannelProducerSettings extends BaseChannelSettings { diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/replacereferences/ReplaceReferencesRequest.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/replacereferences/ReplaceReferencesRequest.java index 20166dfa6256..66081f562368 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/replacereferences/ReplaceReferencesRequest.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/replacereferences/ReplaceReferencesRequest.java @@ -23,10 +23,10 @@ import ca.uhn.fhir.interceptor.model.RequestPartitionId; import ca.uhn.fhir.model.api.IProvenanceAgent; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; +import jakarta.annotation.Nonnull; import org.hl7.fhir.instance.model.api.IIdType; import java.util.List; -import jakarta.annotation.Nonnull; import static ca.uhn.fhir.rest.server.provider.ProviderConstants.OPERATION_REPLACE_REFERENCES_PARAM_SOURCE_REFERENCE_ID; import static ca.uhn.fhir.rest.server.provider.ProviderConstants.OPERATION_REPLACE_REFERENCES_PARAM_TARGET_REFERENCE_ID; diff --git a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/replacereferences/UndoReplaceReferencesRequest.java b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/replacereferences/UndoReplaceReferencesRequest.java index 5cb2a933561a..5d6bb90f22e5 100644 --- a/hapi-fhir-storage/src/main/java/ca/uhn/fhir/replacereferences/UndoReplaceReferencesRequest.java +++ b/hapi-fhir-storage/src/main/java/ca/uhn/fhir/replacereferences/UndoReplaceReferencesRequest.java @@ -20,9 +20,8 @@ package ca.uhn.fhir.replacereferences; import ca.uhn.fhir.interceptor.model.RequestPartitionId; -import org.hl7.fhir.instance.model.api.IIdType; - import jakarta.annotation.Nonnull; +import org.hl7.fhir.instance.model.api.IIdType; /** * This class models the parameters for processing a $hapi.fhir.undo-replace-references operation. From 24110e059c73f8a9fc19b45d76e7e0052a04d80e Mon Sep 17 00:00:00 2001 From: markiantorno Date: Thu, 31 Jul 2025 15:46:45 -0400 Subject: [PATCH 08/17] checkstyle will not block pipeline from running --- .github/workflows/parallel-pipeline-build.yml | 7 ++-- pom.xml | 33 +++++++------------ 2 files changed, 14 insertions(+), 26 deletions(-) diff --git a/.github/workflows/parallel-pipeline-build.yml b/.github/workflows/parallel-pipeline-build.yml index 9ef87a05de25..8effe345e3dd 100644 --- a/.github/workflows/parallel-pipeline-build.yml +++ b/.github/workflows/parallel-pipeline-build.yml @@ -29,6 +29,7 @@ jobs: checkstyle: runs-on: ubuntu-latest needs: build-cache + continue-on-error: true steps: - name: Checkout repository uses: actions/checkout@v4 @@ -40,11 +41,6 @@ jobs: java-version: '17' cache: 'maven' - - name: Apply code formatting - run: | - echo "Applying Spotless code formatting to ensure consistent formatting..." - mvn spotless:apply --batch-mode --no-transfer-progress - - name: Build checkstyle module run: | echo "Building hapi-fhir-checkstyle module first as it's required for cross-module validation..." @@ -62,6 +58,7 @@ jobs: name: Generate List of Modules to Build runs-on: ubuntu-latest needs: checkstyle + if: always() outputs: modules_list: ${{ steps.format-modules.outputs.modules_list }} steps: diff --git a/pom.xml b/pom.xml index 221eee9916f3..5ccb9685cf2e 100644 --- a/pom.xml +++ b/pom.xml @@ -2698,27 +2698,6 @@ maven-checkstyle-plugin true ${maven-checkstyle-version} - - - com.puppycrawl.tools - checkstyle - ${checkstyle_version} - - - ca.uhn.hapi.fhir - hapi-fhir-checkstyle - ${project.version} - - - - **/osgi/**/*, **/.mvn/**/*, **/.mvn_/**/* - true - checkstyle/hapi-base-checkstyle.xml - checkstyle/hapi-base-checkstyle-suppression.xml - UTF-8 - true - true - org.apache.maven.plugins @@ -3039,6 +3018,18 @@ org.apache.maven.plugins maven-checkstyle-plugin false + + + com.puppycrawl.tools + checkstyle + ${checkstyle_version} + + + ca.uhn.hapi.fhir + hapi-fhir-checkstyle + ${project.version} + + ./ From a6470b48ab1e4ec8cdb8e1f99535dec5663b3428 Mon Sep 17 00:00:00 2001 From: markiantorno Date: Thu, 31 Jul 2025 16:11:39 -0400 Subject: [PATCH 09/17] checkstyle now a reusable action --- .../actions/checkstyle-validation/action.yml | 50 +++++++++++++++++++ .github/workflows/parallel-pipeline-build.yml | 21 ++------ 2 files changed, 54 insertions(+), 17 deletions(-) create mode 100644 .github/actions/checkstyle-validation/action.yml diff --git a/.github/actions/checkstyle-validation/action.yml b/.github/actions/checkstyle-validation/action.yml new file mode 100644 index 000000000000..4f387e7e6c0e --- /dev/null +++ b/.github/actions/checkstyle-validation/action.yml @@ -0,0 +1,50 @@ +name: 'Cross-Module Checkstyle Validation' +description: 'Runs cross-module checkstyle validation to detect duplicate error codes and other violations' + +inputs: + java-version: + description: 'The Java version to use' + required: false + default: '17' + maven-cache-key: + description: 'The cache key for Maven dependencies' + required: true + hapi-cache-key: + description: 'The cache key for HAPI dependencies' + required: true + +runs: + using: "composite" + steps: + - name: Set up JDK + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: ${{ inputs.java-version }} + cache: 'maven' + + - name: Restore Maven Cache + uses: ./.github/actions/caching-handler + with: + key: ${{ inputs.maven-cache-key }} + + - name: Restore HAPI Cache + uses: ./.github/actions/caching-handler + with: + path: "$HOME/.m2/repository/ca/uhn/" + key: ${{ inputs.hapi-cache-key }} + + - name: Apply code formatting + shell: bash + run: | + echo "Applying Spotless code formatting to ensure consistent formatting..." + mvn spotless:apply --batch-mode --no-transfer-progress + + - name: Run cross-module checkstyle validation + shell: bash + run: | + echo "Running cross-module checkstyle validation to detect duplicate error codes and other violations..." + echo "This step ensures that HAPI FHIR error codes (Msg.code) are unique across all modules." + echo "If this step fails, it means there are checkstyle violations that must be fixed before the build can proceed." + echo "" + mvn validate -P CHECKSTYLE --batch-mode --no-transfer-progress \ No newline at end of file diff --git a/.github/workflows/parallel-pipeline-build.yml b/.github/workflows/parallel-pipeline-build.yml index 8effe345e3dd..5de65176e895 100644 --- a/.github/workflows/parallel-pipeline-build.yml +++ b/.github/workflows/parallel-pipeline-build.yml @@ -34,25 +34,12 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Set up JDK - uses: actions/setup-java@v4 + - name: Run Checkstyle Validation + uses: ./.github/actions/checkstyle-validation with: - distribution: 'temurin' java-version: '17' - cache: 'maven' - - - name: Build checkstyle module - run: | - echo "Building hapi-fhir-checkstyle module first as it's required for cross-module validation..." - mvn clean install -pl hapi-fhir-checkstyle --batch-mode --no-transfer-progress - - - name: Run cross-module checkstyle validation - run: | - echo "Running cross-module checkstyle validation to detect duplicate error codes and other violations..." - echo "This step ensures that HAPI FHIR error codes (Msg.code) are unique across all modules." - echo "If this step fails, it means there are checkstyle violations that must be fixed before the build can proceed." - echo "" - mvn validate -P CHECKSTYLE --batch-mode --no-transfer-progress + maven-cache-key: ${{ github.ref_name }}-maven-${{ hashFiles('**/pom.xml') }} + hapi-cache-key: ${{ github.ref_name }}-hapi-${{ github.run_id }} generate-module-list: name: Generate List of Modules to Build From eff0292fa05d15c895c9505e320f30694e6e9201 Mon Sep 17 00:00:00 2001 From: markiantorno Date: Thu, 31 Jul 2025 16:24:40 -0400 Subject: [PATCH 10/17] adding debug --- .../actions/checkstyle-validation/action.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/actions/checkstyle-validation/action.yml b/.github/actions/checkstyle-validation/action.yml index 4f387e7e6c0e..7b667a448c06 100644 --- a/.github/actions/checkstyle-validation/action.yml +++ b/.github/actions/checkstyle-validation/action.yml @@ -34,6 +34,24 @@ runs: path: "$HOME/.m2/repository/ca/uhn/" key: ${{ inputs.hapi-cache-key }} + - name: Debug cache contents + shell: bash + run: | + echo "Checking Maven repository contents..." + ls -la $HOME/.m2/repository/ca/uhn/hapi/fhir/ || echo "HAPI FHIR directory not found" + ls -la $HOME/.m2/repository/ca/uhn/hapi/fhir/hapi-fhir-checkstyle/ || echo "hapi-fhir-checkstyle directory not found" + find $HOME/.m2/repository -name "*checkstyle*" -type f || echo "No checkstyle artifacts found" + + - name: Build checkstyle module if not cached + shell: bash + run: | + if [ ! -f "$HOME/.m2/repository/ca/uhn/hapi/fhir/hapi-fhir-checkstyle/8.5.0-SNAPSHOT/hapi-fhir-checkstyle-8.5.0-SNAPSHOT.jar" ]; then + echo "hapi-fhir-checkstyle not found in cache, building it..." + mvn clean install -pl hapi-fhir-checkstyle --batch-mode --no-transfer-progress + else + echo "hapi-fhir-checkstyle found in cache, skipping build" + fi + - name: Apply code formatting shell: bash run: | From 3c002ab622e503f1e5aad361205de9a44d2f9354 Mon Sep 17 00:00:00 2001 From: markiantorno Date: Thu, 31 Jul 2025 16:36:56 -0400 Subject: [PATCH 11/17] The pipeline should now work correctly because Maven will find the cached hapi-fhir-checkstyle dependency in the local repository --- .github/actions/checkstyle-validation/action.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/actions/checkstyle-validation/action.yml b/.github/actions/checkstyle-validation/action.yml index 7b667a448c06..cd8f06256292 100644 --- a/.github/actions/checkstyle-validation/action.yml +++ b/.github/actions/checkstyle-validation/action.yml @@ -44,25 +44,34 @@ runs: - name: Build checkstyle module if not cached shell: bash + env: + MAVEN_CACHE_FOLDER: $HOME/.m2/repository run: | if [ ! -f "$HOME/.m2/repository/ca/uhn/hapi/fhir/hapi-fhir-checkstyle/8.5.0-SNAPSHOT/hapi-fhir-checkstyle-8.5.0-SNAPSHOT.jar" ]; then echo "hapi-fhir-checkstyle not found in cache, building it..." - mvn clean install -pl hapi-fhir-checkstyle --batch-mode --no-transfer-progress + mvn clean install -pl hapi-fhir-checkstyle --batch-mode --no-transfer-progress \ + -Dmaven.repo.local=$MAVEN_CACHE_FOLDER else echo "hapi-fhir-checkstyle found in cache, skipping build" fi - name: Apply code formatting shell: bash + env: + MAVEN_CACHE_FOLDER: $HOME/.m2/repository run: | echo "Applying Spotless code formatting to ensure consistent formatting..." - mvn spotless:apply --batch-mode --no-transfer-progress + mvn spotless:apply --batch-mode --no-transfer-progress \ + -Dmaven.repo.local=$MAVEN_CACHE_FOLDER - name: Run cross-module checkstyle validation shell: bash + env: + MAVEN_CACHE_FOLDER: $HOME/.m2/repository run: | echo "Running cross-module checkstyle validation to detect duplicate error codes and other violations..." echo "This step ensures that HAPI FHIR error codes (Msg.code) are unique across all modules." echo "If this step fails, it means there are checkstyle violations that must be fixed before the build can proceed." echo "" - mvn validate -P CHECKSTYLE --batch-mode --no-transfer-progress \ No newline at end of file + mvn validate -P CHECKSTYLE --batch-mode --no-transfer-progress \ + -Dmaven.repo.local=$MAVEN_CACHE_FOLDER \ No newline at end of file From a884757707e6f8b64caf58f92212d5347daad87b Mon Sep 17 00:00:00 2001 From: markiantorno Date: Fri, 1 Aug 2025 09:05:01 -0400 Subject: [PATCH 12/17] moving to local branch to test caching --- .../actions/checkstyle-validation/action.yml | 24 +------------------ 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/.github/actions/checkstyle-validation/action.yml b/.github/actions/checkstyle-validation/action.yml index cd8f06256292..32abcf27416e 100644 --- a/.github/actions/checkstyle-validation/action.yml +++ b/.github/actions/checkstyle-validation/action.yml @@ -42,28 +42,6 @@ runs: ls -la $HOME/.m2/repository/ca/uhn/hapi/fhir/hapi-fhir-checkstyle/ || echo "hapi-fhir-checkstyle directory not found" find $HOME/.m2/repository -name "*checkstyle*" -type f || echo "No checkstyle artifacts found" - - name: Build checkstyle module if not cached - shell: bash - env: - MAVEN_CACHE_FOLDER: $HOME/.m2/repository - run: | - if [ ! -f "$HOME/.m2/repository/ca/uhn/hapi/fhir/hapi-fhir-checkstyle/8.5.0-SNAPSHOT/hapi-fhir-checkstyle-8.5.0-SNAPSHOT.jar" ]; then - echo "hapi-fhir-checkstyle not found in cache, building it..." - mvn clean install -pl hapi-fhir-checkstyle --batch-mode --no-transfer-progress \ - -Dmaven.repo.local=$MAVEN_CACHE_FOLDER - else - echo "hapi-fhir-checkstyle found in cache, skipping build" - fi - - - name: Apply code formatting - shell: bash - env: - MAVEN_CACHE_FOLDER: $HOME/.m2/repository - run: | - echo "Applying Spotless code formatting to ensure consistent formatting..." - mvn spotless:apply --batch-mode --no-transfer-progress \ - -Dmaven.repo.local=$MAVEN_CACHE_FOLDER - - name: Run cross-module checkstyle validation shell: bash env: @@ -74,4 +52,4 @@ runs: echo "If this step fails, it means there are checkstyle violations that must be fixed before the build can proceed." echo "" mvn validate -P CHECKSTYLE --batch-mode --no-transfer-progress \ - -Dmaven.repo.local=$MAVEN_CACHE_FOLDER \ No newline at end of file + -Dmaven.repo.local=$MAVEN_CACHE_FOLDER From 8b2332c7e3145645b38447de8ecc9cfa34b9eeca Mon Sep 17 00:00:00 2001 From: markiantorno Date: Fri, 1 Aug 2025 14:21:31 -0400 Subject: [PATCH 13/17] wip --- .github/actions/checkstyle-validation/action.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/actions/checkstyle-validation/action.yml b/.github/actions/checkstyle-validation/action.yml index 32abcf27416e..a04526e46da5 100644 --- a/.github/actions/checkstyle-validation/action.yml +++ b/.github/actions/checkstyle-validation/action.yml @@ -23,6 +23,15 @@ runs: java-version: ${{ inputs.java-version }} cache: 'maven' + - name: Create and List Maven Cache Directory + shell: bash + run: | + mkdir -p $HOME/.m2/repository + pwd + ls -al $HOME/.m2/repository + env: + MAVEN_CACHE_FOLDER: $HOME/.m2/repository + - name: Restore Maven Cache uses: ./.github/actions/caching-handler with: From 5dd53a8a49ee860fe1d49e531757022e96746448 Mon Sep 17 00:00:00 2001 From: markiantorno Date: Thu, 7 Aug 2025 16:33:41 -0400 Subject: [PATCH 14/17] wip --- .../actions/checkstyle-validation/action.yml | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/actions/checkstyle-validation/action.yml b/.github/actions/checkstyle-validation/action.yml index a04526e46da5..0f717dd4d21d 100644 --- a/.github/actions/checkstyle-validation/action.yml +++ b/.github/actions/checkstyle-validation/action.yml @@ -16,13 +16,6 @@ inputs: runs: using: "composite" steps: - - name: Set up JDK - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: ${{ inputs.java-version }} - cache: 'maven' - - name: Create and List Maven Cache Directory shell: bash run: | @@ -32,17 +25,24 @@ runs: env: MAVEN_CACHE_FOLDER: $HOME/.m2/repository - - name: Restore Maven Cache - uses: ./.github/actions/caching-handler - with: - key: ${{ inputs.maven-cache-key }} - - name: Restore HAPI Cache uses: ./.github/actions/caching-handler with: path: "$HOME/.m2/repository/ca/uhn/" key: ${{ inputs.hapi-cache-key }} + - name: Set up JDK + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: ${{ inputs.java-version }} + cache: 'maven' + + - name: Restore Maven Cache + uses: ./.github/actions/caching-handler + with: + key: ${{ inputs.maven-cache-key }} + - name: Debug cache contents shell: bash run: | From d2913ddc58a09a744093db34b031fe854100ca67 Mon Sep 17 00:00:00 2001 From: markiantorno Date: Fri, 8 Aug 2025 14:32:42 -0400 Subject: [PATCH 15/17] wip --- .github/actions/build-cache/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/build-cache/action.yml b/.github/actions/build-cache/action.yml index afa7cad97c95..b2cbf9bfdc1c 100644 --- a/.github/actions/build-cache/action.yml +++ b/.github/actions/build-cache/action.yml @@ -51,7 +51,7 @@ runs: MAVEN_CACHE_FOLDER: ${{ inputs.cache-path }} MAVEN_OPTS: '-Xmx1024m -Dorg.slf4j.simpleLogger.showDateTime=true -Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss,SSS -Duser.timezone=America/Toronto' run: | - mvn clean install -P CI,CHECKSTYLE \ + mvn clean install -P CI \ -Dmaven.test.skip=true -e -B \ -Dmaven.javadoc.skip=true \ -Dmaven.wagon.http.pool=false \ From 3f3e7d206757cddb05bbe5d3269796dbf0adb4d8 Mon Sep 17 00:00:00 2001 From: markiantorno Date: Fri, 8 Aug 2025 16:42:46 -0400 Subject: [PATCH 16/17] fixing r4 test --- .github/workflows/parallel-pipeline-build.yml | 2 +- .../ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SourceTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/parallel-pipeline-build.yml b/.github/workflows/parallel-pipeline-build.yml index 5de65176e895..2cf71ea0d3b4 100644 --- a/.github/workflows/parallel-pipeline-build.yml +++ b/.github/workflows/parallel-pipeline-build.yml @@ -111,7 +111,7 @@ jobs: final-result: if: ${{ always() }} runs-on: ubuntu-latest - needs: [ assemble-test-reports ] + needs: [ assemble-test-reports, checkstyle ] steps: - run: exit 1 if: >- diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SourceTest.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SourceTest.java index d9853a068f78..25ebaaf5bd51 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SourceTest.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SourceTest.java @@ -184,7 +184,7 @@ public void testSearchSource_withContainsModifierAndContainsSearchesDisabled_thr myPatientDao.search(searchParameter); fail(); } catch (MethodNotAllowedException e) { - assertEquals(Msg.code(2570) + ":contains modifier is disabled on this server", e.getMessage()); + assertEquals(Msg.code(2768) + ":contains modifier is disabled on this server", e.getMessage()); } } From 7d2f62d5782693cca76b3f2b6340f357b7cbfbf2 Mon Sep 17 00:00:00 2001 From: markiantorno Date: Mon, 11 Aug 2025 13:59:04 -0400 Subject: [PATCH 17/17] test fix error code --- .../test/java/ca/uhn/fhir/jpa/patch/FhirPatchApplyR4Test.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/patch/FhirPatchApplyR4Test.java b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/patch/FhirPatchApplyR4Test.java index f546fa06145d..feba6787a34a 100644 --- a/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/patch/FhirPatchApplyR4Test.java +++ b/hapi-fhir-jpaserver-test-r4/src/test/java/ca/uhn/fhir/jpa/patch/FhirPatchApplyR4Test.java @@ -506,7 +506,7 @@ public void testReplaceAnElementInHighCardinalityField_NoMatchingElement_Invalid //When: We apply the patch, expect an InvalidRequestException InvalidRequestException ex = assertThrows(InvalidRequestException.class, () -> svc.apply(patient, patch)); - String expectedMessage = String.format("HAPI-2617: No element matches the specified path: %s", thePath); + String expectedMessage = String.format("HAPI-2716: No element matches the specified path: %s", thePath); assertThat(ex.getMessage()).isEqualTo(expectedMessage); assertThat(patient.getIdentifier()).hasSize(2);