Commit 5f82d25b authored by iwakeh's avatar iwakeh
Browse files

Use date classes and date comparison for dates.

Replacing timestamp calculations and string comparison.
parent aca68171
......@@ -3,6 +3,8 @@
package org.torproject.metrics.exonerator;
import static java.time.format.DateTimeFormatter.ISO_LOCAL_DATE;
import org.apache.commons.lang3.StringEscapeUtils;
import org.slf4j.Logger;
......@@ -15,8 +17,8 @@ import;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
......@@ -321,8 +323,8 @@ public class ExoneraTorServlet extends HttpServlet {
* it matches the day before the current system date (in UTC) or is even
* younger. */
static boolean checkTimestampTooRecent(String timestampParameter) {
return timestampParameter.compareTo(
.toLocalDate().minusDays(1).toString()) >= 0;
return LocalDate.parse(timestampParameter, ISO_LOCAL_DATE)
/* Helper method for fetching a query response via URL. */
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment