diff --git a/hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/rest/server/interceptor/AuditingInterceptor.java b/hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/rest/server/interceptor/AuditingInterceptor.java index c6920f48c70..5ca1492a409 100644 --- a/hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/rest/server/interceptor/AuditingInterceptor.java +++ b/hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/rest/server/interceptor/AuditingInterceptor.java @@ -114,6 +114,10 @@ public class AuditingInterceptor extends InterceptorAdapter { log.debug("No auditing configured."); return true; } + if(theResponseObject == null || theResponseObject.isEmpty()){ + log.debug("No bundle to audit"); + return true; + } try{ log.info("Auditing bundle: " + theResponseObject + " from request " + theRequestDetails); SecurityEvent auditEvent = new SecurityEvent(); @@ -163,6 +167,10 @@ public class AuditingInterceptor extends InterceptorAdapter { log.debug("No auditing configured."); return true; } + if(theResponseObject == null){ + log.debug("No object to audit"); + return true; + } try{ log.info("Auditing resource: " + theResponseObject + " from request: " + theRequestDetails); SecurityEvent auditEvent = new SecurityEvent();