Fix bug when in-memory matcher compares long id to string id
This commit is contained in:
parent
13a83567ae
commit
c11d719957
|
@ -645,16 +645,8 @@ public class IdDt extends UriDt implements /*IPrimitiveDatatype<String>, */IIdTy
|
|||
return new IdDt(value + '/' + Constants.PARAM_HISTORY + '/' + theVersion);
|
||||
}
|
||||
|
||||
private static boolean isValidLong(String id) {
|
||||
if (StringUtils.isBlank(id)) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < id.length(); i++) {
|
||||
if (Character.isDigit(id.charAt(i)) == false) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
public static boolean isValidLong(String id) {
|
||||
return StringUtils.isNumeric(id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -19,6 +19,7 @@ package ca.uhn.fhir.rest.param;
|
|||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
import static ca.uhn.fhir.model.primitive.IdDt.isValidLong;
|
||||
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||
|
||||
|
@ -280,4 +281,8 @@ public class ReferenceParam extends BaseParam /*implements IQueryParameterType*/
|
|||
retVal.setValueAsQueryToken(theContext, null, null, getValueAsQueryToken(theContext));
|
||||
return retVal;
|
||||
}
|
||||
|
||||
public boolean isIdPartValidLong() {
|
||||
return isValidLong(getIdPart());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -274,7 +274,11 @@ public final class ResourceIndexedSearchParams {
|
|||
ResourceTable target = theResourceLink.getTargetResource();
|
||||
IdDt idDt = target.getIdDt();
|
||||
if (idDt.isIdPartValidLong()) {
|
||||
if (theReference.isIdPartValidLong()) {
|
||||
return theReference.getIdPartAsLong().equals(idDt.getIdPartAsLong());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
ForcedId forcedId = target.getForcedId();
|
||||
if (forcedId != null) {
|
||||
|
|
|
@ -23,7 +23,6 @@ public class ResourceIndexedSearchParamsTest {
|
|||
target.setResourceType("Organization");
|
||||
target.setId(123L);
|
||||
|
||||
|
||||
ResourceIndexedSearchParams params = new ResourceIndexedSearchParams(source);
|
||||
ResourceLink link = new ResourceLink("organization", source, target, new Date());
|
||||
params.getResourceLinks().add(link);
|
||||
|
|
Loading…
Reference in New Issue