From 4f23fa295ff21991a4012781b2cfcd82d82ae7c1 Mon Sep 17 00:00:00 2001 From: Lee Surprenant Date: Tue, 1 Feb 2022 15:55:40 -0500 Subject: [PATCH] issue #3265 - checkType throws instead of logging for abstract types Signed-off-by: Lee Surprenant --- .../ibm/fhir/server/test/operation/ReindexOperationTest.java | 2 +- .../server/test/operation/RetrieveIndexOperationTest.java | 2 +- .../java/com/ibm/fhir/server/resources/FHIRResource.java | 5 +---- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/fhir-server-test/src/test/java/com/ibm/fhir/server/test/operation/ReindexOperationTest.java b/fhir-server-test/src/test/java/com/ibm/fhir/server/test/operation/ReindexOperationTest.java index acea6a39359..f12d6e45d3e 100644 --- a/fhir-server-test/src/test/java/com/ibm/fhir/server/test/operation/ReindexOperationTest.java +++ b/fhir-server-test/src/test/java/com/ibm/fhir/server/test/operation/ReindexOperationTest.java @@ -142,7 +142,7 @@ public void testReindexWithInvalidType() { .header("X-FHIR-DSID", "default") .post(entity, Response.class); - assertEquals(r.getStatus(), Status.BAD_REQUEST.getStatusCode()); + assertEquals(r.getStatus(), Status.NOT_FOUND.getStatusCode()); } @Test(groups = { "reindex" }) diff --git a/fhir-server-test/src/test/java/com/ibm/fhir/server/test/operation/RetrieveIndexOperationTest.java b/fhir-server-test/src/test/java/com/ibm/fhir/server/test/operation/RetrieveIndexOperationTest.java index 23852149517..45645d48111 100644 --- a/fhir-server-test/src/test/java/com/ibm/fhir/server/test/operation/RetrieveIndexOperationTest.java +++ b/fhir-server-test/src/test/java/com/ibm/fhir/server/test/operation/RetrieveIndexOperationTest.java @@ -156,6 +156,6 @@ public void testRetrieveIndex_invalidType() { .header("X-FHIR-DSID", "default") .post(entity, Response.class); - assertEquals(r.getStatus(), Status.BAD_REQUEST.getStatusCode()); + assertEquals(r.getStatus(), Status.NOT_FOUND.getStatusCode()); } } \ No newline at end of file diff --git a/fhir-server/src/main/java/com/ibm/fhir/server/resources/FHIRResource.java b/fhir-server/src/main/java/com/ibm/fhir/server/resources/FHIRResource.java index 43849fc38cb..8084abf1a27 100644 --- a/fhir-server/src/main/java/com/ibm/fhir/server/resources/FHIRResource.java +++ b/fhir-server/src/main/java/com/ibm/fhir/server/resources/FHIRResource.java @@ -136,11 +136,8 @@ protected void checkInitComplete() throws FHIROperationException { * we'll throw an error to short-circuit the current in-progress REST API invocation. */ protected void checkType(String type) throws FHIROperationException { - if (!ModelSupport.isResourceType(type)) { - throw buildUnsupportedResourceTypeException(type); - } if (!ModelSupport.isConcreteResourceType(type)) { - log.warning("Use of abstract resource types like '" + type + "' in FHIR URLs is deprecated and will be removed in a future release"); + throw buildUnsupportedResourceTypeException(type); } }