Skip to content

Failing dateTime searches with Java 11 #305

@lmsurpre

Description

@lmsurpre

Describe the bug
I did some refactoring to our AbstractWholeSystemSearchTest and, after that, it repeatedly fails when run with Java 11 (but works with Java 8).
After some investigation, I think the issue is in JDBCQueryBuilder.processDateParm. We have a TODO here like "TODO: clean up handling of date parameters in the query predicates" and it seems to be converting the passed DateTime into an Instant and then converting that Instant into a Date.
My current theory is that we're losing some precision during this process and that this is somehow causing the query to fail in Java 11.

To Reproduce
Perform a search on a search parameter of type date and pass a full Instant. For example:

    List<Resource> resources = runQueryTest(Resource.class, "_lastUpdated", savedResource.getMeta().getLastUpdated().getValue().toString());
    assertNotNull(resources);
    assertEquals(resources.size(), 1, "Number of resources returned");

Expected behavior
Since its using the lastUpdated time from the savedResource, it should return the saved resource when you search on that.

Additional context
@prb112 noticed that our fhir-persistence-jdbc AbstractWholeSystemSearchTest was failing when he used Java 11. He included some related changes in #301 (comment) which we thought might address the issue. However, I was able to reproduce the issue (without his fix) and I think there is a deeper issue with respect to our dateTime handling in JDBCQueryBuilder.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions