This issue is a side-effect to the fix in
Unfortunately the fix to that ticket required us to check for midnight timestamps (T00:00:00Z) in the "until" param, and automatically convert them to the end of the day (T23:59:59Z). This allowed for queries like this to work properly:
- Return everything last modified up to and including "2015-04-07": http://demo.dspace.org/oai/request?verb=ListRecords&metadataPrefix=oai_dc&until=2015-04-07
- Return everything with a last modified date of "2015-04-07" (with any timestamp): http://demo.dspace.org/oai/request?verb=ListRecords&metadataPrefix=oai_dc&from=2015-04-07&until=2015-04-07
Unfortunately, the side effect of this fix was that explicitly specifying a midnight timestamp (T00:00:00Z) in the "until" param ONLY no longer works properly.
For example, this query will WRONGLY return all items which were last modified on "2015-04-07": http://demo.dspace.org/oai/request?verb=ListRecords&metadataPrefix=oai_dc&until=2015-04-07T00:00:00Z
It seems XOAI itself is flawed in that it immediately converts any passed in dates (via until or from params) into "java.util.Date". Unfortunately, once they are "java.util.Date" objects, there is no way to tell the difference between a date with no timestamp (e.g. 2015-04-07) and one with a midnight timestamp (e.g. 2015-04-07T00:00:00Z), as those two Date objects are considered equivalent in Java. See for example: http://stackoverflow.com/a/9334481/3750035
For more on the flawed manner in which XOAI parses date inputs, see these areas of the XOAI codebase:
- Here's where XOAI grabs the from/until dates from the request: https://github.com/DSpace/xoai/blob/3.x/src/main/java/com/lyncode/xoai/dataprovider/core/OAIParameters.java#L59
- It then parses them immediately into a `Date` object: https://github.com/DSpace/xoai/blob/3.x/src/main/java/com/lyncode/xoai/dataprovider/core/OAIParameters.java#L131
Unfortunately, the only way to resolve this issue in XOAI 3.x would be to refactor the codebase to no longer use "java.util.Date" to store these dates/times.
Alternatively, we may wish to investigate whether upgrading to use XOAI 4.x may be a better option (as the issue may be solved or more easily solved in that codebase). See also DS-2595