Improved code formatting
This commit is contained in:
parent
836948010f
commit
77845d66f7
|
@ -3,4 +3,4 @@ type: fix
|
||||||
issue: 2958
|
issue: 2958
|
||||||
jira: SMILE-643
|
jira: SMILE-643
|
||||||
title: "Fixed issue where the processing of queries like Procedure?patient= before a cache search would cause the parameter key to be removed.
|
title: "Fixed issue where the processing of queries like Procedure?patient= before a cache search would cause the parameter key to be removed.
|
||||||
Additionally, ensured that requests like Procedure?patient cause HTTP 400 Bad Request instead of HTTP 500 Internal Error."
|
Additionally, ensured that requests like Procedure?patient= cause HTTP 400 Bad Request instead of HTTP 500 Internal Error."
|
||||||
|
|
|
@ -1014,9 +1014,6 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc {
|
||||||
logged = true;
|
logged = true;
|
||||||
ourLog.warn("Failed during search due to invalid request: {}", t.toString());
|
ourLog.warn("Failed during search due to invalid request: {}", t.toString());
|
||||||
}
|
}
|
||||||
}else if (t instanceof java.lang.IllegalArgumentException && t.getMessage().contentEquals("The validated expression is false")) {
|
|
||||||
logged = true;
|
|
||||||
ourLog.warn("Failed during search due to invalid request: {}", t.toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!logged) {
|
if (!logged) {
|
||||||
|
@ -1031,8 +1028,6 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc {
|
||||||
int failureCode = InternalErrorException.STATUS_CODE;
|
int failureCode = InternalErrorException.STATUS_CODE;
|
||||||
if (t instanceof BaseServerResponseException) {
|
if (t instanceof BaseServerResponseException) {
|
||||||
failureCode = ((BaseServerResponseException) t).getStatusCode();
|
failureCode = ((BaseServerResponseException) t).getStatusCode();
|
||||||
}else if(t instanceof java.lang.IllegalArgumentException && t.getMessage().contentEquals("The validated expression is false")) {
|
|
||||||
failureCode = Constants.STATUS_HTTP_400_BAD_REQUEST;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (System.getProperty(UNIT_TEST_CAPTURE_STACK) != null) {
|
if (System.getProperty(UNIT_TEST_CAPTURE_STACK) != null) {
|
||||||
|
@ -1212,6 +1207,9 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc {
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
ourLog.error("IO failure during database access", e);
|
ourLog.error("IO failure during database access", e);
|
||||||
throw new InternalErrorException(e);
|
throw new InternalErrorException(e);
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
ourLog.error("Illegal Argument during database access", e);
|
||||||
|
throw new InvalidRequestException("Parameter value missing in request", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ import org.hl7.fhir.r4.model.IdType;
|
||||||
import org.hl7.fhir.r4.model.Patient;
|
import org.hl7.fhir.r4.model.Patient;
|
||||||
import org.junit.jupiter.api.AfterEach;
|
import org.junit.jupiter.api.AfterEach;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.DisplayName;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -31,6 +32,7 @@ import static org.hamcrest.Matchers.lessThan;
|
||||||
import static org.hamcrest.core.IsNot.not;
|
import static org.hamcrest.core.IsNot.not;
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
import static org.junit.jupiter.api.Assertions.fail;
|
import static org.junit.jupiter.api.Assertions.fail;
|
||||||
|
|
||||||
|
@ -233,24 +235,27 @@ public class ResourceProviderR4CacheTest extends BaseResourceProviderR4Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testProcedurePatient(){
|
public void testParamWithNoValueIsConsideredForCacheResults(){
|
||||||
Bundle resp2 = myClient
|
// Given: We populate the cache by searching
|
||||||
|
myClient
|
||||||
.search()
|
.search()
|
||||||
.byUrl("Procedure")
|
.byUrl("Procedure")
|
||||||
.returnBundle(Bundle.class)
|
.returnBundle(Bundle.class)
|
||||||
.execute();
|
.execute();
|
||||||
|
|
||||||
|
// When: We search Procedure?patient=
|
||||||
BaseServerResponseException exception = assertThrows(BaseServerResponseException.class, () -> {myClient
|
BaseServerResponseException exception = assertThrows(BaseServerResponseException.class, () -> {myClient
|
||||||
.search()
|
.search()
|
||||||
.byUrl("Procedure?patient=")
|
.byUrl("Procedure?patient=")
|
||||||
.returnBundle(Bundle.class)
|
.returnBundle(Bundle.class)
|
||||||
.execute();});
|
.execute();});
|
||||||
|
|
||||||
assertEquals(Constants.STATUS_HTTP_400_BAD_REQUEST, exception.getStatusCode());
|
// Then: We do not get a cache hit
|
||||||
|
assertNotEquals(Constants.STATUS_HTTP_200_OK, exception.getStatusCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPatient(){
|
public void testReturn400ForParameterWithNoValue(){
|
||||||
BaseServerResponseException exception = assertThrows(BaseServerResponseException.class, () -> {myClient
|
BaseServerResponseException exception = assertThrows(BaseServerResponseException.class, () -> {myClient
|
||||||
.search()
|
.search()
|
||||||
.byUrl("Procedure?patient=")
|
.byUrl("Procedure?patient=")
|
||||||
|
|
|
@ -396,13 +396,6 @@ public class SearchParameterMap implements Serializable {
|
||||||
for (List<? extends IQueryParameterType> nextValuesAndIn : nextValuesAndsIn) {
|
for (List<? extends IQueryParameterType> nextValuesAndIn : nextValuesAndsIn) {
|
||||||
|
|
||||||
List<IQueryParameterType> nextValuesOrsOut = new ArrayList<>();
|
List<IQueryParameterType> nextValuesOrsOut = new ArrayList<>();
|
||||||
/*
|
|
||||||
for (IQueryParameterType nextValueOrIn : nextValuesAndIn) {
|
|
||||||
if (nextValueOrIn.getMissing() != null || isNotBlank(nextValueOrIn.getValueAsQueryToken(theCtx))) {
|
|
||||||
nextValuesOrsOut.add(nextValueOrIn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
nextValuesOrsOut.addAll(nextValuesAndIn);
|
nextValuesOrsOut.addAll(nextValuesAndIn);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue