Program: 90167
Project: 90167
Buggy source:
/** 
 * Set/initialize environment variables for this job.
 * @param ji2 job info object for this job
 * @return a map containing environment variables for this job
 * @throws CloudServiceException if there is any error in initialization
 */
protected Map<String,String> initEnv(Job ji2) throws CloudServiceException {
  LOG.info("String_Node_Str");
  Map<String,String> hEnv=new HashMap<String,String>();
  if ((ji2.getFileDependencies() != null) && (!ji2.getFileDependencies().isEmpty())) {
    hEnv.put("String_Node_Str",ji2.getFileDependencies());
  }
  cluster=getClusterConfig(ji2);
  ArrayList<String> clusterConfigList=cluster.getConfigs();
  hEnv.put("String_Node_Str",convertListToCSV(clusterConfigList));
  CommandConfig command=null;
  ApplicationConfig application=null;
  boolean done=false;
  if ((ji2.getCommandId() != null) && (!(ji2.getCommandId().isEmpty()))) {
    String cmdId=ji2.getCommandId();
    command=pmCommand.getEntity(cmdId,CommandConfig.class);
    for (    final ApplicationConfig ace : command.getApplications()) {
      if ((ji2.getApplicationId() != null) && ((!ji2.getApplicationId().isEmpty()))) {
        if (ace.getId().equals(ji2.getApplicationId())) {
          application=ace;
          break;
        }
      }
 else       if ((ji2.getApplicationName() != null) && ((!ji2.getApplicationName().isEmpty()))) {
        if (ace.getName().equals(ji2.getApplicationName())) {
          application=ace;
          break;
        }
      }
 else {
        application=ace;
        break;
      }
    }
  }
 else   if ((ji2.getCommandName() != null) && (!(ji2.getCommandName().isEmpty()))) {
    for (    final CommandConfig cce : cluster.getCommands()) {
      if (cce.getName().equals(ji2.getCommandName())) {
        for (        final ApplicationConfig ace : cce.getApplications()) {
          if ((ji2.getApplicationId() != null) && ((!ji2.getApplicationId().isEmpty()))) {
            if (ace.getId().equals(ji2.getApplicationId())) {
              command=cce;
              application=ace;
              done=true;
              break;
            }
          }
 else           if ((ji2.getApplicationName() != null) && ((!ji2.getApplicationName().isEmpty()))) {
            if (ace.getName().equals(ji2.getApplicationName())) {
              command=cce;
              application=ace;
              done=true;
              break;
            }
          }
 else {
            command=cce;
            application=ace;
            done=true;
            break;
          }
        }
        if (done) {
          break;
        }
      }
    }
  }
  if (command == null) {
    final String msg="String_Node_Str";
    LOG.error(msg);
    throw new CloudServiceException(HttpURLConnection.HTTP_INTERNAL_ERROR,msg);
  }
  ji2.setCommandId(command.getId());
  ji2.setCommandName(command.getName());
  if (application != null) {
    ji2.setApplicationId(application.getId());
    ji2.setApplicationName(application.getName());
  }
  hEnv.put("String_Node_Str",convertListToCSV(command.getConfigs()));
  hEnv.put("String_Node_Str",convertListToCSV(application.getConfigs()));
  hEnv.put("String_Node_Str",convertListToCSV(application.getJars()));
  this.executable=command.getExecutable();
  ji2.setExecutionClusterName(cluster.getName());
  ji2.setExecutionClusterId(cluster.getId());
  hEnv.put("String_Node_Str",application.getEnvPropFile());
  hEnv.put("String_Node_Str",command.getEnvPropFile());
  hEnv.put("String_Node_Str",ji2.getEnvPropFile());
  hEnv.put("String_Node_Str",ji2.getUserName());
  hEnv.put("String_Node_Str",ji2.getUserName());
  String groupName=HADOOP_GROUP_NAME;
  if (ji2.getGroupName() != null) {
    groupName=ji2.getGroupName();
    hEnv.put("String_Node_Str",groupName);
  }
  hEnv.put("String_Node_Str",groupName);
  String javaHome=ConfigurationManager.getConfigInstance().getString("String_Node_Str");
  if ((javaHome != null) && (!javaHome.isEmpty())) {
    hEnv.put("String_Node_Str",javaHome);
  }
  String genieHome=ConfigurationManager.getConfigInstance().getString("String_Node_Str");
  if ((genieHome == null) || genieHome.isEmpty()) {
    String msg="String_Node_Str";
    LOG.error(msg);
    throw new CloudServiceException(HttpURLConnection.HTTP_INTERNAL_ERROR,msg);
  }
  hEnv.put("String_Node_Str",genieHome);
  String hadoopHome;
  if (cluster.getVersion() != null) {
    String hadoopVersion=cluster.getVersion();
    LOG.debug("String_Node_Str" + hadoopVersion);
    hadoopHome=ConfigurationManager.getConfigInstance().getString("String_Node_Str" + hadoopVersion + "String_Node_Str");
    if (hadoopHome == null) {
      hadoopVersion=StringUtil.trimVersion(hadoopVersion);
      hadoopHome=ConfigurationManager.getConfigInstance().getString("String_Node_Str" + hadoopVersion + "String_Node_Str");
    }
    if ((hadoopHome == null) || (!new File(hadoopHome).exists())) {
      String msg="String_Node_Str" + hadoopVersion;
      LOG.error(msg);
      throw new CloudServiceException(HttpURLConnection.HTTP_INTERNAL_ERROR,msg);
    }
    LOG.info("String_Node_Str" + hadoopHome);
    hEnv.put("String_Node_Str",hadoopHome);
  }
 else {
    hadoopHome=ConfigurationManager.getConfigInstance().getString("String_Node_Str");
    if ((hadoopHome == null) || (!new File(hadoopHome).exists())) {
      String msg="String_Node_Str";
      LOG.error(msg);
      throw new CloudServiceException(HttpURLConnection.HTTP_INTERNAL_ERROR,msg);
    }
    hEnv.put("String_Node_Str",hadoopHome);
  }
  hEnv.put("String_Node_Str",ConfigurationManager.getConfigInstance().getString("String_Node_Str","String_Node_Str"));
  String cpOpts="String_Node_Str";
  cpOpts=ConfigurationManager.getConfigInstance().getString("String_Node_Str","String_Node_Str");
  String copyCommand=hadoopHome + "String_Node_Str" + cpOpts+ "String_Node_Str";
  hEnv.put("String_Node_Str",copyCommand);
  String mkdirCommand=hadoopHome + "String_Node_Str" + cpOpts+ "String_Node_Str";
  hEnv.put("String_Node_Str",mkdirCommand);
  String baseUserWorkingDir=ConfigurationManager.getConfigInstance().getString("String_Node_Str");
  if ((baseUserWorkingDir == null) || (baseUserWorkingDir.isEmpty())) {
    String msg="String_Node_Str";
    LOG.error(msg);
    throw new CloudServiceException(HttpURLConnection.HTTP_INTERNAL_ERROR,msg);
  }
 else {
    hEnv.put("String_Node_Str",baseUserWorkingDir);
  }
  if (!ji2.isDisableLogArchival()) {
    String s3ArchiveLocation=ConfigurationManager.getConfigInstance().getString("String_Node_Str");
    if ((s3ArchiveLocation != null) && (!s3ArchiveLocation.isEmpty())) {
      hEnv.put("String_Node_Str",s3ArchiveLocation);
    }
  }
  hEnv.put("String_Node_Str",genieJobIDProp + "String_Node_Str" + netflixEnvProp+ "String_Node_Str"+ lipstickUuidProp);
  return hEnv;
}

Fixed version (ground truth):
/** 
 * Set/initialize environment variables for this job.
 * @param ji2 job info object for this job
 * @return a map containing environment variables for this job
 * @throws CloudServiceException if there is any error in initialization
 */
protected Map<String,String> initEnv(Job ji2) throws CloudServiceException {
  LOG.info("String_Node_Str");
  Map<String,String> hEnv=new HashMap<String,String>();
  if ((ji2.getFileDependencies() != null) && (!ji2.getFileDependencies().isEmpty())) {
    hEnv.put("String_Node_Str",ji2.getFileDependencies());
  }
  cluster=getClusterConfig(ji2);
  ArrayList<String> clusterConfigList=cluster.getConfigs();
  hEnv.put("String_Node_Str",convertListToCSV(clusterConfigList));
  CommandConfig command=null;
  ApplicationConfig application=null;
  boolean done=false;
  if ((ji2.getCommandId() != null) && (!(ji2.getCommandId().isEmpty()))) {
    String cmdId=ji2.getCommandId();
    command=pmCommand.getEntity(cmdId,CommandConfig.class);
    for (    final ApplicationConfig ace : command.getApplications()) {
      if ((ji2.getApplicationId() != null) && ((!ji2.getApplicationId().isEmpty()))) {
        if (ace.getId().equals(ji2.getApplicationId())) {
          application=ace;
          break;
        }
      }
 else       if ((ji2.getApplicationName() != null) && ((!ji2.getApplicationName().isEmpty()))) {
        if (ace.getName().equals(ji2.getApplicationName())) {
          application=ace;
          break;
        }
      }
 else {
        application=ace;
        break;
      }
    }
  }
 else   if ((ji2.getCommandName() != null) && (!(ji2.getCommandName().isEmpty()))) {
    for (    final CommandConfig cce : cluster.getCommands()) {
      if (cce.getName().equals(ji2.getCommandName())) {
        for (        final ApplicationConfig ace : cce.getApplications()) {
          if ((ji2.getApplicationId() != null) && ((!ji2.getApplicationId().isEmpty()))) {
            if (ace.getId().equals(ji2.getApplicationId())) {
              command=cce;
              application=ace;
              done=true;
              break;
            }
          }
 else           if ((ji2.getApplicationName() != null) && ((!ji2.getApplicationName().isEmpty()))) {
            if (ace.getName().equals(ji2.getApplicationName())) {
              command=cce;
              application=ace;
              done=true;
              break;
            }
          }
 else {
            command=cce;
            application=ace;
            done=true;
            break;
          }
        }
        if (done) {
          break;
        }
      }
    }
  }
  if (command == null) {
    final String msg="String_Node_Str";
    LOG.error(msg);
    throw new CloudServiceException(HttpURLConnection.HTTP_INTERNAL_ERROR,msg);
  }
  ji2.setCommandId(command.getId());
  ji2.setCommandName(command.getName());
  if (application != null) {
    ji2.setApplicationId(application.getId());
    ji2.setApplicationName(application.getName());
    hEnv.put("String_Node_Str",convertListToCSV(application.getConfigs()));
    hEnv.put("String_Node_Str",convertListToCSV(application.getJars()));
    hEnv.put("String_Node_Str",application.getEnvPropFile());
  }
  hEnv.put("String_Node_Str",convertListToCSV(command.getConfigs()));
  this.executable=command.getExecutable();
  ji2.setExecutionClusterName(cluster.getName());
  ji2.setExecutionClusterId(cluster.getId());
  hEnv.put("String_Node_Str",command.getEnvPropFile());
  hEnv.put("String_Node_Str",ji2.getEnvPropFile());
  hEnv.put("String_Node_Str",ji2.getUserName());
  hEnv.put("String_Node_Str",ji2.getUserName());
  String groupName=HADOOP_GROUP_NAME;
  if (ji2.getGroupName() != null) {
    groupName=ji2.getGroupName();
    hEnv.put("String_Node_Str",groupName);
  }
  hEnv.put("String_Node_Str",groupName);
  String javaHome=ConfigurationManager.getConfigInstance().getString("String_Node_Str");
  if ((javaHome != null) && (!javaHome.isEmpty())) {
    hEnv.put("String_Node_Str",javaHome);
  }
  String genieHome=ConfigurationManager.getConfigInstance().getString("String_Node_Str");
  if ((genieHome == null) || genieHome.isEmpty()) {
    String msg="String_Node_Str";
    LOG.error(msg);
    throw new CloudServiceException(HttpURLConnection.HTTP_INTERNAL_ERROR,msg);
  }
  hEnv.put("String_Node_Str",genieHome);
  String hadoopHome;
  if (cluster.getVersion() != null) {
    String hadoopVersion=cluster.getVersion();
    LOG.debug("String_Node_Str" + hadoopVersion);
    hadoopHome=ConfigurationManager.getConfigInstance().getString("String_Node_Str" + hadoopVersion + "String_Node_Str");
    if (hadoopHome == null) {
      hadoopVersion=StringUtil.trimVersion(hadoopVersion);
      hadoopHome=ConfigurationManager.getConfigInstance().getString("String_Node_Str" + hadoopVersion + "String_Node_Str");
    }
    if ((hadoopHome == null) || (!new File(hadoopHome).exists())) {
      String msg="String_Node_Str" + hadoopVersion;
      LOG.error(msg);
      throw new CloudServiceException(HttpURLConnection.HTTP_INTERNAL_ERROR,msg);
    }
    LOG.info("String_Node_Str" + hadoopHome);
    hEnv.put("String_Node_Str",hadoopHome);
  }
 else {
    hadoopHome=ConfigurationManager.getConfigInstance().getString("String_Node_Str");
    if ((hadoopHome == null) || (!new File(hadoopHome).exists())) {
      String msg="String_Node_Str";
      LOG.error(msg);
      throw new CloudServiceException(HttpURLConnection.HTTP_INTERNAL_ERROR,msg);
    }
    hEnv.put("String_Node_Str",hadoopHome);
  }
  hEnv.put("String_Node_Str",ConfigurationManager.getConfigInstance().getString("String_Node_Str","String_Node_Str"));
  String cpOpts="String_Node_Str";
  cpOpts=ConfigurationManager.getConfigInstance().getString("String_Node_Str","String_Node_Str");
  String copyCommand=hadoopHome + "String_Node_Str" + cpOpts+ "String_Node_Str";
  hEnv.put("String_Node_Str",copyCommand);
  String mkdirCommand=hadoopHome + "String_Node_Str" + cpOpts+ "String_Node_Str";
  hEnv.put("String_Node_Str",mkdirCommand);
  String baseUserWorkingDir=ConfigurationManager.getConfigInstance().getString("String_Node_Str");
  if ((baseUserWorkingDir == null) || (baseUserWorkingDir.isEmpty())) {
    String msg="String_Node_Str";
    LOG.error(msg);
    throw new CloudServiceException(HttpURLConnection.HTTP_INTERNAL_ERROR,msg);
  }
 else {
    hEnv.put("String_Node_Str",baseUserWorkingDir);
  }
  if (!ji2.isDisableLogArchival()) {
    String s3ArchiveLocation=ConfigurationManager.getConfigInstance().getString("String_Node_Str");
    if ((s3ArchiveLocation != null) && (!s3ArchiveLocation.isEmpty())) {
      hEnv.put("String_Node_Str",s3ArchiveLocation);
    }
  }
  hEnv.put("String_Node_Str",genieJobIDProp + "String_Node_Str" + netflixEnvProp+ "String_Node_Str"+ lipstickUuidProp);
  return hEnv;
}