@Test public void testParseDate() { logger.debug("testParseDate: enter"); String line = "2016-02-23 08:07:30"; final Date returnValue = ParseLog.parseDate(line, "yyyy-MM-dd HH:mm:ss", false); logger.debug("testParseDate: returnValue: " + returnValue); line = returnValue.toString().substring(0, returnValue.toString().lastIndexOf(":30") + 3); assertEquals("Tue Feb 23 08:07:30", line); logger.debug("testParseDate: exit"); }
public static Date parseDate(final String dateline, final String pattern, final boolean singleSplit) { Date returnDate; final String[] splitString = dateline.split(" "); final SimpleDateFormat formatter = new SimpleDateFormat(pattern); if (singleSplit) { try { returnDate = formatter.parse(dateline); } catch (final ParseException e) { logger.error("Unable to parse date for line: " + dateline); returnDate = null; } } else { final String tmpString = splitString[0] + " " + splitString[1]; try { returnDate = formatter.parse(tmpString); } catch (final ParseException e) { logger.error("Unable to parse date for line: " + dateline); returnDate = null; } } return returnDate; }
ParseLog { public static Date parseDate(final String dateline, final String pattern, final boolean singleSplit) { Date returnDate; final String[] splitString = dateline.split(" "); final SimpleDateFormat formatter = new SimpleDateFormat(pattern); if (singleSplit) { try { returnDate = formatter.parse(dateline); } catch (final ParseException e) { logger.error("Unable to parse date for line: " + dateline); returnDate = null; } } else { final String tmpString = splitString[0] + " " + splitString[1]; try { returnDate = formatter.parse(tmpString); } catch (final ParseException e) { logger.error("Unable to parse date for line: " + dateline); returnDate = null; } } return returnDate; } }
ParseLog { public static Date parseDate(final String dateline, final String pattern, final boolean singleSplit) { Date returnDate; final String[] splitString = dateline.split(" "); final SimpleDateFormat formatter = new SimpleDateFormat(pattern); if (singleSplit) { try { returnDate = formatter.parse(dateline); } catch (final ParseException e) { logger.error("Unable to parse date for line: " + dateline); returnDate = null; } } else { final String tmpString = splitString[0] + " " + splitString[1]; try { returnDate = formatter.parse(tmpString); } catch (final ParseException e) { logger.error("Unable to parse date for line: " + dateline); returnDate = null; } } return returnDate; }  }
ParseLog { public static Date parseDate(final String dateline, final String pattern, final boolean singleSplit) { Date returnDate; final String[] splitString = dateline.split(" "); final SimpleDateFormat formatter = new SimpleDateFormat(pattern); if (singleSplit) { try { returnDate = formatter.parse(dateline); } catch (final ParseException e) { logger.error("Unable to parse date for line: " + dateline); returnDate = null; } } else { final String tmpString = splitString[0] + " " + splitString[1]; try { returnDate = formatter.parse(tmpString); } catch (final ParseException e) { logger.error("Unable to parse date for line: " + dateline); returnDate = null; } } return returnDate; }  static void main(final String[] args); static int countLines(final String filename); static String pullLastLineRead(final File file, final String dataFileName); static LogEntryObject pullOutLogValues(final String line, final String type); static void process(final String line, final String type, final LogType logFile); static Date parseDate(final String dateline, final String pattern, final boolean singleSplit); static String parseRemoteSystem(final String line); static String[] getPaths(final String logPath); static Properties getPropertiesValue(final String fileName); static Connection getDbConnection(); }
ParseLog { public static Date parseDate(final String dateline, final String pattern, final boolean singleSplit) { Date returnDate; final String[] splitString = dateline.split(" "); final SimpleDateFormat formatter = new SimpleDateFormat(pattern); if (singleSplit) { try { returnDate = formatter.parse(dateline); } catch (final ParseException e) { logger.error("Unable to parse date for line: " + dateline); returnDate = null; } } else { final String tmpString = splitString[0] + " " + splitString[1]; try { returnDate = formatter.parse(tmpString); } catch (final ParseException e) { logger.error("Unable to parse date for line: " + dateline); returnDate = null; } } return returnDate; }  static void main(final String[] args); static int countLines(final String filename); static String pullLastLineRead(final File file, final String dataFileName); static LogEntryObject pullOutLogValues(final String line, final String type); static void process(final String line, final String type, final LogType logFile); static Date parseDate(final String dateline, final String pattern, final boolean singleSplit); static String parseRemoteSystem(final String line); static String[] getPaths(final String logPath); static Properties getPropertiesValue(final String fileName); static Connection getDbConnection();  }