@Test public void blank_string() { assertNull(JDKLocalDateDeserializer.parse("")); }
public static LocalDate parse(String s) { if (StringUtils.isNotBlank(s)) { try { return LocalDate.parse(s, DateTimeFormatter.ofPattern("yyyy-MM-dd")); } catch (DateTimeParseException ignored) { try { return LocalDateTime.ofInstant(Instant.parse(s), ZoneOffset.UTC).toLocalDate(); } catch (DateTimeParseException ignored2) { return LocalDateTime.parse(s, DateTimeFormatter.ISO_LOCAL_DATE_TIME).toLocalDate(); } } } else { return null; } }
JDKLocalDateDeserializer extends JsonDeserializer<LocalDate> { public static LocalDate parse(String s) { if (StringUtils.isNotBlank(s)) { try { return LocalDate.parse(s, DateTimeFormatter.ofPattern("yyyy-MM-dd")); } catch (DateTimeParseException ignored) { try { return LocalDateTime.ofInstant(Instant.parse(s), ZoneOffset.UTC).toLocalDate(); } catch (DateTimeParseException ignored2) { return LocalDateTime.parse(s, DateTimeFormatter.ISO_LOCAL_DATE_TIME).toLocalDate(); } } } else { return null; } } }
JDKLocalDateDeserializer extends JsonDeserializer<LocalDate> { public static LocalDate parse(String s) { if (StringUtils.isNotBlank(s)) { try { return LocalDate.parse(s, DateTimeFormatter.ofPattern("yyyy-MM-dd")); } catch (DateTimeParseException ignored) { try { return LocalDateTime.ofInstant(Instant.parse(s), ZoneOffset.UTC).toLocalDate(); } catch (DateTimeParseException ignored2) { return LocalDateTime.parse(s, DateTimeFormatter.ISO_LOCAL_DATE_TIME).toLocalDate(); } } } else { return null; } }  }
JDKLocalDateDeserializer extends JsonDeserializer<LocalDate> { public static LocalDate parse(String s) { if (StringUtils.isNotBlank(s)) { try { return LocalDate.parse(s, DateTimeFormatter.ofPattern("yyyy-MM-dd")); } catch (DateTimeParseException ignored) { try { return LocalDateTime.ofInstant(Instant.parse(s), ZoneOffset.UTC).toLocalDate(); } catch (DateTimeParseException ignored2) { return LocalDateTime.parse(s, DateTimeFormatter.ISO_LOCAL_DATE_TIME).toLocalDate(); } } } else { return null; } }  @Override LocalDate deserialize(JsonParser jp, DeserializationContext ctxt); static LocalDate parse(String s); }
JDKLocalDateDeserializer extends JsonDeserializer<LocalDate> { public static LocalDate parse(String s) { if (StringUtils.isNotBlank(s)) { try { return LocalDate.parse(s, DateTimeFormatter.ofPattern("yyyy-MM-dd")); } catch (DateTimeParseException ignored) { try { return LocalDateTime.ofInstant(Instant.parse(s), ZoneOffset.UTC).toLocalDate(); } catch (DateTimeParseException ignored2) { return LocalDateTime.parse(s, DateTimeFormatter.ISO_LOCAL_DATE_TIME).toLocalDate(); } } } else { return null; } }  @Override LocalDate deserialize(JsonParser jp, DeserializationContext ctxt); static LocalDate parse(String s);  }