Skip to content

Commit 59c7390

Browse files
committed
issue #3735 - remove invoke(String,String,Resource) special processing
For some reason, our exception handling for `invoke(String,String,Resource)` differs from the exception handling in all the other invoke methods. I assume that was done so that the $invoke operation properly returns a 200 OK in cases where the data is invalid. But this is not the right level for that logic and it can prevent us from seeing important server issues in the logs. I double-checked and the ValidateOperation is already returning a valid OperationOutcome response for successful validation of invalid resources, so I think we just need to remove the special handling at the Operation JAX-RS resource. Additionally, we found "interesting" liberty behavior that was preventing us from seeing the exception stack trace even when FINE logging is enabled; that log message is now level INFO so that the stack trace gets printed (but it will still only be printed when the FINE level is enabled). Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
1 parent 5d801a9 commit 59c7390

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

fhir-server/src/main/java/com/ibm/fhir/server/resources/FHIRResource.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,8 @@ protected Response exceptionResponse(FHIROperationException e, Status status) {
336336
if (status.getFamily() == Status.Family.SERVER_ERROR) {
337337
log.log(Level.SEVERE, e.getMessage(), e);
338338
} else if (log.isLoggable(Level.FINE)) {
339-
log.log(Level.FINE, e.getMessage(), e);
339+
// purposefully logged at level INFO because otherwise liberty suppresses the stacktrace
340+
log.log(Level.INFO, e.getMessage(), e);
340341
} else if (log.isLoggable(Level.INFO)) {
341342
log.log(Level.INFO, e.getMessage());
342343
}

fhir-server/src/main/java/com/ibm/fhir/server/resources/Operation.java

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -264,21 +264,8 @@ public Response invoke(@PathParam("resourceTypeName") String resourceTypeName,
264264
status = Response.Status.fromStatusCode(response.getStatus());
265265
return response;
266266
} catch (FHIROperationException e) {
267-
// response 200 OK if no failure issue found.
268-
boolean isFailure = false;
269-
for (Issue issue : e.getIssues()) {
270-
if (FHIRUtil.isFailure(issue.getSeverity())) {
271-
isFailure = true;
272-
break;
273-
}
274-
}
275-
if (isFailure) {
276-
status = issueListToStatus(e.getIssues());
277-
return exceptionResponse(e, status);
278-
} else {
279-
status = Status.OK;
280-
return exceptionResponse(e, Response.Status.OK);
281-
}
267+
status = issueListToStatus(e.getIssues());
268+
return exceptionResponse(e, status);
282269
} catch (Exception e) {
283270
status = Status.INTERNAL_SERVER_ERROR;
284271
return exceptionResponse(e, status);

0 commit comments

Comments
 (0)