Program: 130216
Project: 130216
Buggy source:
/** 
 * Gets the job details.
 * @param yamlLoader the loader
 * @param jobID the job id
 * @return the job details
 * @throws IOException Signals that an I/O exception has occurred.
 * @throws ClassNotFoundException 
 */
public JobOutput getJobDetails(Loader loader,String jobID) throws IOException {
  YamlLoader yamlLoader=(YamlLoader)loader;
  String appHome=yamlLoader.getjHome() + File.separator;
  YamlConfig yamlConfig=(YamlConfig)yamlLoader.getYamlConfiguration();
  String agentHome=RemotingUtil.getAgentHome(yamlConfig);
  Remoter remoter=RemotingUtil.getRemoter(yamlLoader,appHome);
  String logsHistory=null;
  SupportedHadoopDistributions hadoopVersion=RemotingUtil.getHadoopVersion(yamlConfig);
  String user=yamlConfig.getMaster().getUser();
  logsHistory=changeLogHistoryPathAccToHadoopVersion(HADOOP_HOME,hadoopVersion,user);
  CommandWritableBuilder builder=new CommandWritableBuilder();
  boolean isYarn=yamlConfig.getEnableYarn().equals(Enable.TRUE);
  String logfilePath=null;
  String relLocalPath=null;
  if (!isYarn) {
    logfilePath=getLogFilePath(jobID,remoter,logsHistory,builder);
    relLocalPath=Constants.JOB_JARS_LOC + yamlLoader.getJumbuneJobName();
    String relRemotePath=relLocalPath + RUMEN;
    StringBuilder stringAppender=new StringBuilder(agentHome);
    stringAppender.append(File.separator).append(relRemotePath).append(File.separator);
    String pathToRumenDir=stringAppender.toString();
    String jsonFilepath=pathToRumenDir + JSON_FILE;
    String topologyFilePath=pathToRumenDir + TOPOLOGY_FILE;
    builder.getCommandBatch().clear();
    builder.addCommand(MKDIR_CMD + pathToRumenDir,false,null,CommandType.FS);
    remoter.fireAndForgetCommand(builder.getCommandWritable());
    String remoteHadoopLib=HADOOP_HOME + LIB;
    Properties props=loadHadoopJarConfigurationProperties();
    String coreJar;
    if (SupportedHadoopDistributions.HADOOP_NON_YARN.equals(hadoopVersion)) {
      coreJar=HADOOP_HOME + props.getProperty("String_Node_Str");
    }
 else {
      coreJar=HADOOP_HOME + WILDCARD;
    }
    String commonsLoggingJar=agentHome + LIB + props.getProperty("String_Node_Str");
    String commonsCliJar=remoteHadoopLib + props.getProperty("String_Node_Str");
    String commonsConfigurationJar=agentHome + LIB + props.getProperty("String_Node_Str");
    String commonsLangJar=agentHome + LIB + props.getProperty("String_Node_Str");
    String jacksonMapperAslJar=agentHome + LIB + props.getProperty("String_Node_Str");
    String jacksonMapperCoreJar=agentHome + LIB + props.getProperty("String_Node_Str");
    String rumenJar=agentHome + LIB + props.getProperty("String_Node_Str")+ "String_Node_Str"+ Versioning.BUILD_VERSION+ Versioning.DISTRIBUTION_NAME+ "String_Node_Str";
    StringBuilder sb=new StringBuilder(JAVA_CP_CMD);
    checkHadoopVersionsForRumen(hadoopVersion,logfilePath,jsonFilepath,topologyFilePath,coreJar,commonsLoggingJar,commonsCliJar,commonsConfigurationJar,commonsLangJar,jacksonMapperAslJar,jacksonMapperCoreJar,rumenJar,sb);
    LOGGER.debug("String_Node_Str" + sb.toString() + "String_Node_Str");
    startRumenProcessing(remoter,relLocalPath,relRemotePath,sb);
    remoter=RemotingUtil.getRemoter(yamlLoader,appHome);
    remoter.receiveLogFiles(relLocalPath,relRemotePath);
    LOGGER.debug("String_Node_Str" + relRemotePath);
    Gson gson=new Gson();
    JobDetails jobDetails=extractJobDetails(appHome,relLocalPath,gson);
    return convertToFinalOutput(jobDetails);
  }
 else {
    String relativeRemotePath=Constants.JOB_JARS_LOC + yamlLoader.getJumbuneJobName() + File.separator+ jobID;
    String remotePath=agentHome + relativeRemotePath;
    builder.addCommand(MKDIR_CMD + remotePath,false,null,CommandType.FS);
    builder.addCommand(CHMOD_CMD + remotePath,false,null,CommandType.FS);
    remoter.fireAndForgetCommand(builder.getCommandWritable());
    checkAndgetCurrentLogFilePathForYarn(remoter,logsHistory,yamlLoader.getYamlConfiguration(),agentHome,remotePath,jobID);
    relLocalPath=Constants.JOB_JARS_LOC + yamlLoader.getJumbuneJobName();
    remoter.receiveLogFiles(relLocalPath,relativeRemotePath);
    String absolutePath=appHome + relLocalPath + jobID+ File.separator;
    String fileName=checkAndGetHistFile(absolutePath);
    String localPath=absolutePath + fileName;
    java.lang.reflect.Method method=null;
    Class<?> yarnJobStatsUtility=null;
    try {
      yarnJobStatsUtility=Class.forName(YARN_JOB_STATS_UTILITY_CLASS);
      method=yarnJobStatsUtility.getDeclaredMethod(YARN_JOB_STATS_UTILITY_CLASS_PARSE_METHOD,String.class);
      return (JobOutput)method.invoke(yarnJobStatsUtility.newInstance(),localPath);
    }
 catch (    Exception e) {
      LOGGER.error("String_Node_Str",e.getCause());
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Gets the job details.
 * @param yamlLoader the loader
 * @param jobID the job id
 * @return the job details
 * @throws IOException Signals that an I/O exception has occurred.
 * @throws ClassNotFoundException 
 */
public JobOutput getJobDetails(Loader loader,String jobID) throws IOException {
  YamlLoader yamlLoader=(YamlLoader)loader;
  String appHome=yamlLoader.getjHome() + File.separator;
  YamlConfig yamlConfig=(YamlConfig)yamlLoader.getYamlConfiguration();
  String agentHome=RemotingUtil.getAgentHome(yamlConfig);
  Remoter remoter=RemotingUtil.getRemoter(yamlLoader,appHome);
  String logsHistory=null;
  SupportedHadoopDistributions hadoopVersion=RemotingUtil.getHadoopVersion(yamlConfig);
  String user=yamlConfig.getMaster().getUser();
  logsHistory=changeLogHistoryPathAccToHadoopVersion(HADOOP_HOME,hadoopVersion,user);
  CommandWritableBuilder builder=new CommandWritableBuilder();
  boolean isYarn=yamlConfig.getEnableYarn().equals(Enable.TRUE);
  String logfilePath=null;
  String relLocalPath=null;
  if (!isYarn) {
    logfilePath=getLogFilePath(jobID,remoter,logsHistory,builder);
    relLocalPath=Constants.JOB_JARS_LOC + yamlLoader.getJumbuneJobName();
    String relRemotePath=relLocalPath + RUMEN;
    StringBuilder stringAppender=new StringBuilder(agentHome);
    stringAppender.append(File.separator).append(relRemotePath).append(File.separator);
    String pathToRumenDir=stringAppender.toString();
    String jsonFilepath=pathToRumenDir + JSON_FILE;
    String topologyFilePath=pathToRumenDir + TOPOLOGY_FILE;
    builder.getCommandBatch().clear();
    builder.addCommand(MKDIR_CMD + pathToRumenDir,false,null,CommandType.FS);
    remoter.fireAndForgetCommand(builder.getCommandWritable());
    String remoteHadoopLib=HADOOP_HOME + LIB;
    Properties props=loadHadoopJarConfigurationProperties();
    String coreJar;
    if (SupportedHadoopDistributions.HADOOP_NON_YARN.equals(hadoopVersion)) {
      coreJar=HADOOP_HOME + props.getProperty("String_Node_Str");
    }
 else {
      coreJar=HADOOP_HOME + WILDCARD;
    }
    String commonsLoggingJar=agentHome + LIB + props.getProperty("String_Node_Str");
    String commonsCliJar=remoteHadoopLib + props.getProperty("String_Node_Str");
    String commonsConfigurationJar=agentHome + LIB + props.getProperty("String_Node_Str");
    String commonsLangJar=agentHome + LIB + props.getProperty("String_Node_Str");
    String jacksonMapperAslJar=agentHome + LIB + props.getProperty("String_Node_Str");
    String jacksonMapperCoreJar=agentHome + LIB + props.getProperty("String_Node_Str");
    String rumenJar=agentHome + LIB + props.getProperty("String_Node_Str")+ "String_Node_Str"+ Versioning.BUILD_VERSION+ Versioning.DISTRIBUTION_NAME+ "String_Node_Str";
    StringBuilder sb=new StringBuilder(JAVA_CP_CMD);
    checkHadoopVersionsForRumen(hadoopVersion,logfilePath,jsonFilepath,topologyFilePath,coreJar,commonsLoggingJar,commonsCliJar,commonsConfigurationJar,commonsLangJar,jacksonMapperAslJar,jacksonMapperCoreJar,rumenJar,sb);
    LOGGER.debug("String_Node_Str" + sb.toString() + "String_Node_Str");
    startRumenProcessing(remoter,relLocalPath,relRemotePath,sb);
    remoter=RemotingUtil.getRemoter(yamlLoader,appHome);
    remoter.receiveLogFiles(relLocalPath,relRemotePath);
    LOGGER.debug("String_Node_Str" + relRemotePath);
    Gson gson=new Gson();
    JobDetails jobDetails=extractJobDetails(appHome,relLocalPath,gson);
    return convertToFinalOutput(jobDetails);
  }
 else {
    String relativeRemotePath=Constants.JOB_JARS_LOC + yamlLoader.getJumbuneJobName() + File.separator+ jobID;
    String remotePath=agentHome + relativeRemotePath;
    builder.addCommand(MKDIR_CMD + remotePath,false,null,CommandType.FS);
    builder.addCommand(CHMOD_CMD + remotePath,false,null,CommandType.FS);
    remoter.fireAndForgetCommand(builder.getCommandWritable());
    checkAndgetCurrentLogFilePathForYarn(remoter,logsHistory,yamlLoader.getYamlConfiguration(),agentHome,remotePath,jobID);
    relLocalPath=Constants.JOB_JARS_LOC + yamlLoader.getJumbuneJobName();
    remoter.receiveLogFiles(relLocalPath,relativeRemotePath);
    String absolutePath=appHome + relLocalPath + jobID+ File.separator;
    String fileName=checkAndGetHistFile(absolutePath);
    String localPath=absolutePath + fileName;
    java.lang.reflect.Method method=null;
    Class<?> yarnJobStatsUtility=null;
    try {
      yarnJobStatsUtility=Class.forName(YARN_JOB_STATS_UTILITY_CLASS);
      method=yarnJobStatsUtility.getDeclaredMethod(YARN_JOB_STATS_UTILITY_CLASS_PARSE_METHOD,String.class);
      return (JobOutput)method.invoke(yarnJobStatsUtility.newInstance(),localPath);
    }
 catch (    Exception e) {
      LOGGER.error("String_Node_Str",e);
    }
  }
  return null;
}