Added null checks for the request details param
This commit is contained in:
parent
6aab327612
commit
bac2e58b90
|
@ -101,6 +101,11 @@ public class StandardizingInterceptor {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void standardize(RequestDetails theRequest, IBaseResource theResource) {
|
private void standardize(RequestDetails theRequest, IBaseResource theResource) {
|
||||||
|
if (theRequest == null) {
|
||||||
|
ourLog.debug("RequestDetails is null - unable to standardize {}", theResource);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!theRequest.getHeaders(STANDARDIZATION_DISABLED_HEADER).isEmpty()) {
|
if (!theRequest.getHeaders(STANDARDIZATION_DISABLED_HEADER).isEmpty()) {
|
||||||
ourLog.debug("Standardization for {} is disabled via header {}", theResource, STANDARDIZATION_DISABLED_HEADER);
|
ourLog.debug("Standardization for {} is disabled via header {}", theResource, STANDARDIZATION_DISABLED_HEADER);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -107,6 +107,12 @@ public class AddressValidatingInterceptor {
|
||||||
|
|
||||||
protected void handleRequest(RequestDetails theRequest, IBaseResource theResource) {
|
protected void handleRequest(RequestDetails theRequest, IBaseResource theResource) {
|
||||||
if (getAddressValidator() == null) {
|
if (getAddressValidator() == null) {
|
||||||
|
ourLog.debug("Address validator is not provided - validation disabled");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (theRequest == null) {
|
||||||
|
ourLog.debug("RequestDetails is null - unable to validate address for {}", theResource);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,6 @@ import ca.uhn.fhir.interceptor.api.Interceptor;
|
||||||
import ca.uhn.fhir.interceptor.api.Pointcut;
|
import ca.uhn.fhir.interceptor.api.Pointcut;
|
||||||
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
||||||
import ca.uhn.fhir.rest.server.interceptor.ConfigLoader;
|
import ca.uhn.fhir.rest.server.interceptor.ConfigLoader;
|
||||||
import ca.uhn.fhir.rest.server.interceptor.ServerOperationInterceptorAdapter;
|
|
||||||
import ca.uhn.fhir.rest.server.interceptor.validation.address.IAddressValidator;
|
import ca.uhn.fhir.rest.server.interceptor.validation.address.IAddressValidator;
|
||||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||||
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
||||||
|
@ -73,6 +72,11 @@ public class FieldValidatingInterceptor {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void handleRequest(RequestDetails theRequest, IBaseResource theResource) {
|
protected void handleRequest(RequestDetails theRequest, IBaseResource theResource) {
|
||||||
|
if (theRequest == null) {
|
||||||
|
ourLog.debug("RequestDetails is null - unable to validate {}", theResource);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!theRequest.getHeaders(VALIDATION_DISABLED_HEADER).isEmpty()) {
|
if (!theRequest.getHeaders(VALIDATION_DISABLED_HEADER).isEmpty()) {
|
||||||
ourLog.debug("Address validation is disabled for this request via header");
|
ourLog.debug("Address validation is disabled for this request via header");
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue