From eef3267bb80edad0df2e8c22e8d81b95178dffaa Mon Sep 17 00:00:00 2001 From: patrick-werner Date: Thu, 17 May 2018 17:38:23 +0200 Subject: [PATCH] Forward the cause of the InvocationTargetException to the REST layer. Discovered through #938 --- .../ca/uhn/fhir/rest/server/method/BaseMethodBinding.java | 4 ++-- ...erverWithResponseHighlightingInterceptorExceptionTest.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/BaseMethodBinding.java b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/BaseMethodBinding.java index 49246714eee..a177756a7bb 100644 --- a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/BaseMethodBinding.java +++ b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/BaseMethodBinding.java @@ -258,9 +258,9 @@ public abstract class BaseMethodBinding { if (e.getCause() instanceof BaseServerResponseException) { throw (BaseServerResponseException) e.getCause(); } - throw new InternalErrorException("Failed to call access method", e); + throw new InternalErrorException("Failed to call access method: " + e.getCause(), e); } catch (Exception e) { - throw new InternalErrorException("Failed to call access method", e); + throw new InternalErrorException("Failed to call access method: " + e.getCause(), e); } } diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ServerWithResponseHighlightingInterceptorExceptionTest.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ServerWithResponseHighlightingInterceptorExceptionTest.java index 5843ae42ff9..72fb556250d 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ServerWithResponseHighlightingInterceptorExceptionTest.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ServerWithResponseHighlightingInterceptorExceptionTest.java @@ -64,7 +64,7 @@ public class ServerWithResponseHighlightingInterceptorExceptionTest { ourLog.info(responseContent); assertEquals(500, status.getStatusLine().getStatusCode()); - assertThat(responseContent, containsString("")); + assertThat(responseContent, containsString("")); }