Source:
public static long getSubmitTimeMillisFromJobHistory(byte[] jobHistoryRaw) { long submitTimeMillis = 0; if (null == jobHistoryRaw) { return submitTimeMillis; } HadoopVersion hv = JobHistoryFileParserFactory.getVersion(jobHistoryRaw); switch (hv) { case TWO: int startIndex = ByteUtil.indexOf(jobHistoryRaw, Constants.JOB_SUBMIT_EVENT_BYTES, 0); if (startIndex != -1) { int secondQuoteIndex = ByteUtil.indexOf(jobHistoryRaw, Constants.SUBMIT_TIME_PREFIX_HADOOP2_BYTES, startIndex); if (secondQuoteIndex != -1) { String submitTimeMillisString = Bytes.toString(jobHistoryRaw, secondQuoteIndex + Constants.EPOCH_TIMESTAMP_STRING_LENGTH, Constants.EPOCH_TIMESTAMP_STRING_LENGTH); try { submitTimeMillis = Long.parseLong(submitTimeMillisString); } catch (NumberFormatException nfe) { LOG.error(" caught NFE during conversion of submit time " + submitTimeMillisString + " " + nfe.getMessage()); submitTimeMillis = 0; } } } break; case ONE: default: startIndex = ByteUtil.indexOf(jobHistoryRaw, Constants.SUBMIT_TIME_PREFIX_BYTES, 0); if (startIndex != -1) { int prefixEndIndex = startIndex + Constants.SUBMIT_TIME_PREFIX_BYTES.length; int secondQuoteIndex = ByteUtil.indexOf(jobHistoryRaw, Constants.QUOTE_BYTES, prefixEndIndex); if (secondQuoteIndex != -1) { int numberLength = secondQuoteIndex - prefixEndIndex; String submitTimeMillisString = Bytes.toString(jobHistoryRaw, prefixEndIndex, numberLength); try { submitTimeMillis = Long.parseLong(submitTimeMillisString); } catch (NumberFormatException nfe) { LOG.error(" caught NFE during conversion of submit time " + submitTimeMillisString + " " + nfe.getMessage()); submitTimeMillis = 0; } } } break; } if(submitTimeMillis == 0L) { LOG.info("NOTE: submitTimeMillis is 0, need to check this file"); } return submitTimeMillis; }

Target:
public static long getSubmitTimeMillisFromJobHistory(byte[] jobHistoryRaw) { long submitTimeMillis = 0; if (null == jobHistoryRaw) { return submitTimeMillis; } HadoopVersion hv = JobHistoryFileParserFactory.getVersion(jobHistoryRaw); switch (hv) { case TWO: int startIndex = ByteUtil.indexOf(jobHistoryRaw, Constants.JOB_SUBMIT_EVENT_BYTES, 0); if (startIndex != -1) { int secondQuoteIndex = ByteUtil.indexOf(jobHistoryRaw, Constants.SUBMIT_TIME_PREFIX_HADOOP2_BYTES, startIndex); if (secondQuoteIndex != -1) { String submitTimeMillisString = Bytes.toString(jobHistoryRaw, secondQuoteIndex + Constants.EPOCH_TIMESTAMP_STRING_LENGTH, Constants.EPOCH_TIMESTAMP_STRING_LENGTH); try { submitTimeMillis = Long.parseLong(submitTimeMillisString); } catch (NumberFormatException nfe) { LOG.error(" caught NFE during conversion of submit time " + submitTimeMillisString + " " + nfe.getMessage()); submitTimeMillis = 0; } } } break; case ONE: default: startIndex = ByteUtil.indexOf(jobHistoryRaw, Constants.SUBMIT_TIME_PREFIX_BYTES, 0); if (startIndex != -1) { int prefixEndIndex = startIndex + Constants.SUBMIT_TIME_PREFIX_BYTES.length; int secondQuoteIndex = ByteUtil.indexOf(jobHistoryRaw, Constants.QUOTE_BYTES, prefixEndIndex); if (secondQuoteIndex != -1) { int numberLength = secondQuoteIndex - prefixEndIndex; String submitTimeMillisString = Bytes.toString(jobHistoryRaw, prefixEndIndex, numberLength); try { submitTimeMillis = Long.parseLong(submitTimeMillisString); } catch (NumberFormatException nfe) { LOG.error(" caught NFE during conversion of submit time " + submitTimeMillisString + " " + nfe.getMessage()); submitTimeMillis = 0; } } } break; } return submitTimeMillis; }