|
32 | 32 | import java.io.InputStream; |
33 | 33 | import java.io.IOException; |
34 | 34 | import java.io.Serializable; |
35 | | -import java.text.ParseException; |
36 | | -import java.text.SimpleDateFormat; |
| 35 | +import java.time.LocalDateTime; |
| 36 | +import java.time.ZoneOffset; |
| 37 | +import java.time.format.DateTimeFormatter; |
| 38 | +import java.time.format.DateTimeParseException; |
37 | 39 | import java.util.concurrent.ConcurrentHashMap; |
38 | 40 | import java.util.concurrent.ConcurrentMap; |
39 | 41 | import java.util.regex.Pattern; |
@@ -1156,7 +1158,7 @@ private static Optional<CurrencyProperty> getValidEntry(String ctry, |
1156 | 1158 | && !isPastCutoverDate(prop.date)) { |
1157 | 1159 | prop = null; |
1158 | 1160 | } |
1159 | | - } catch (ParseException ex) { |
| 1161 | + } catch (DateTimeParseException ex) { |
1160 | 1162 | prop = null; |
1161 | 1163 | } |
1162 | 1164 | } |
@@ -1196,15 +1198,12 @@ private static boolean containsInconsistentInstances( |
1196 | 1198 | || prop.fraction != fractionDigit); |
1197 | 1199 | } |
1198 | 1200 |
|
1199 | | - private static boolean isPastCutoverDate(String s) |
1200 | | - throws ParseException { |
1201 | | - SimpleDateFormat format = new SimpleDateFormat( |
1202 | | - "yyyy-MM-dd'T'HH:mm:ss", Locale.ROOT); |
1203 | | - format.setTimeZone(TimeZone.getTimeZone("UTC")); |
1204 | | - format.setLenient(false); |
1205 | | - long time = format.parse(s.trim()).getTime(); |
1206 | | - return System.currentTimeMillis() > time; |
1207 | | - |
| 1201 | + // cutOver adheres to ISO8601 Local Date Time format (excluding nano secs) |
| 1202 | + private static boolean isPastCutoverDate(String cutOver) { |
| 1203 | + return System.currentTimeMillis() > |
| 1204 | + LocalDateTime.parse(cutOver, DateTimeFormatter.ISO_LOCAL_DATE_TIME) |
| 1205 | + .toInstant(ZoneOffset.UTC) |
| 1206 | + .toEpochMilli(); |
1208 | 1207 | } |
1209 | 1208 |
|
1210 | 1209 | private static void info(String message, Throwable t) { |
|
0 commit comments