@Test(expected = RuntimeException.class) public void dateParseErrorTest() throws Exception { try { dateParse("10/01/2010", LocalDateTime.class, parseList); } catch (Exception e) { assertTrue(e instanceof RuntimeException); assertEquals("Can't format the date with the pattern", e.getMessage()); throw e; } }
public static TemporalAccessor dateParse(String value, Class<? extends TemporalAccessor> date, String...formats) { try { if (formats != null && formats.length > 0) { for (String form : formats) { try { try { return getParse(date, getFormat(form), value); } catch (DateTimeParseException e) { return getParse(date, value); } } catch (Exception e) { continue; } } } else { return getParse(date, value); } } catch (Exception e) { throw new RuntimeException(e); } catch (Throwable throwable) { throwable.printStackTrace(); } throw new RuntimeException("Can't format the date with the pattern"); }
DateParseUtil { public static TemporalAccessor dateParse(String value, Class<? extends TemporalAccessor> date, String...formats) { try { if (formats != null && formats.length > 0) { for (String form : formats) { try { try { return getParse(date, getFormat(form), value); } catch (DateTimeParseException e) { return getParse(date, value); } } catch (Exception e) { continue; } } } else { return getParse(date, value); } } catch (Exception e) { throw new RuntimeException(e); } catch (Throwable throwable) { throwable.printStackTrace(); } throw new RuntimeException("Can't format the date with the pattern"); } }
DateParseUtil { public static TemporalAccessor dateParse(String value, Class<? extends TemporalAccessor> date, String...formats) { try { if (formats != null && formats.length > 0) { for (String form : formats) { try { try { return getParse(date, getFormat(form), value); } catch (DateTimeParseException e) { return getParse(date, value); } } catch (Exception e) { continue; } } } else { return getParse(date, value); } } catch (Exception e) { throw new RuntimeException(e); } catch (Throwable throwable) { throwable.printStackTrace(); } throw new RuntimeException("Can't format the date with the pattern"); }  }
DateParseUtil { public static TemporalAccessor dateParse(String value, Class<? extends TemporalAccessor> date, String...formats) { try { if (formats != null && formats.length > 0) { for (String form : formats) { try { try { return getParse(date, getFormat(form), value); } catch (DateTimeParseException e) { return getParse(date, value); } } catch (Exception e) { continue; } } } else { return getParse(date, value); } } catch (Exception e) { throw new RuntimeException(e); } catch (Throwable throwable) { throwable.printStackTrace(); } throw new RuntimeException("Can't format the date with the pattern"); }  static TemporalAccessor dateParse(String value, Class<? extends TemporalAccessor> date, String...formats); }
DateParseUtil { public static TemporalAccessor dateParse(String value, Class<? extends TemporalAccessor> date, String...formats) { try { if (formats != null && formats.length > 0) { for (String form : formats) { try { try { return getParse(date, getFormat(form), value); } catch (DateTimeParseException e) { return getParse(date, value); } } catch (Exception e) { continue; } } } else { return getParse(date, value); } } catch (Exception e) { throw new RuntimeException(e); } catch (Throwable throwable) { throwable.printStackTrace(); } throw new RuntimeException("Can't format the date with the pattern"); }  static TemporalAccessor dateParse(String value, Class<? extends TemporalAccessor> date, String...formats);  }