private String parseException(String jobId, String diagnosticInfo) throws MalformedURLException, IOException,
                                                                            AuthenticationException {
    Matcher m = ThreadContextMR2.getDiagnosticMatcher(diagnosticInfo);
    if (m.matches()) {
      String taskId = m.group(1);
      return _jsonFactory.getTaskFailedStackTrace(_urlFactory.getTaskAllAttemptsURL(jobId, taskId));
    }
    logger.warn("Does not match regex!!");
    // Diagnostic info not present in the job. Usually due to exception during AM setup
    return "No sufficient diagnostic Info";
  }
This class implements the Fetcher for MapReduce Applications on Hadoop2
app/com/linkedin/drelephant/mapreduce/fetchers/MapReduceFetcherHadoop2.java