Please use DateTimeFormatter ISO_DATE_TIME = DateTimeFormatter.ISO_DATE_TIME;
instead of DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm:ss") or any pattern
This fixed my problem Below
java.time.format.DateTimeParseException: Text '2019-12-18T19:00:00.000Z' could not be parsed at index 10