Program: 80227
Project: 80227
Buggy source:
@Override public void buildContainerLaunchContext(ContainerLauncher launcher,AggregateConf instanceDefinition,Container container,ProviderRole providerRole,SliderFileSystem fileSystem,Path generatedConfPath,MapOperations resourceComponent,MapOperations appComponent,Path containerTmpDirPath) throws IOException, SliderException {
  String roleName=providerRole.name;
  String roleGroup=providerRole.group;
  String appDef=SliderUtils.getApplicationDefinitionPath(instanceDefinition.getAppConfOperations(),roleGroup);
  initializeApplicationConfiguration(instanceDefinition,fileSystem,roleGroup);
  log.info("String_Node_Str");
  log.debug(instanceDefinition.toString());
  if (isYarnDockerContainer(roleGroup)) {
    launcher.setYarnDockerMode(true);
    launcher.setDockerImage(getConfigFromMetaInfo(roleGroup,"String_Node_Str"));
    launcher.setRunPrivilegedContainer(getConfigFromMetaInfo(roleGroup,"String_Node_Str"));
    launcher.setYarnContainerMountPoints(getConfigFromMetaInfoWithAppConfigOverriding(roleGroup,"String_Node_Str"));
  }
  launcher.putEnv(SliderUtils.buildEnvMap(appComponent,getStandardTokenMap(getAmState().getAppConfSnapshot(),roleName,roleGroup)));
  String workDir=ApplicationConstants.Environment.PWD.$();
  launcher.setEnv("String_Node_Str",workDir);
  log.info("String_Node_Str",workDir);
  String logDir=ApplicationConstants.LOG_DIR_EXPANSION_VAR;
  launcher.setEnv("String_Node_Str",logDir);
  log.info("String_Node_Str",logDir);
  if (System.getenv(HADOOP_USER_NAME) != null) {
    launcher.setEnv(HADOOP_USER_NAME,System.getenv(HADOOP_USER_NAME));
  }
  launcher.setEnv(SLIDER_PASSPHRASE,instanceDefinition.getPassphrase());
  launcher.setEnv("String_Node_Str","String_Node_Str");
  launcher.setEnv("String_Node_Str","String_Node_Str");
  launcher.setEnv("String_Node_Str","String_Node_Str");
  String scriptPath=new File(AgentKeys.AGENT_MAIN_SCRIPT_ROOT,AgentKeys.AGENT_MAIN_SCRIPT).getPath();
  String appHome=instanceDefinition.getAppConfOperations().getGlobalOptions().get(AgentKeys.PACKAGE_PATH);
  if (SliderUtils.isSet(appHome)) {
    scriptPath=new File(appHome,AgentKeys.AGENT_MAIN_SCRIPT).getPath();
  }
  List<String> pythonPaths=new ArrayList<String>();
  pythonPaths.add(AgentKeys.AGENT_MAIN_SCRIPT_ROOT);
  pythonPaths.add(AgentKeys.AGENT_JINJA2_ROOT);
  String pythonPath=StringUtils.join(File.pathSeparator,pythonPaths);
  launcher.setEnv(PYTHONPATH,pythonPath);
  log.info("String_Node_Str",pythonPath);
  Path agentImagePath=null;
  String agentImage=instanceDefinition.getInternalOperations().get(InternalKeys.INTERNAL_APPLICATION_IMAGE_PATH);
  if (SliderUtils.isUnset(agentImage)) {
    agentImagePath=new Path(new Path(new Path(instanceDefinition.getInternalOperations().get(InternalKeys.INTERNAL_TMP_DIR),container.getId().getApplicationAttemptId().getApplicationId().toString()),AgentKeys.PROVIDER_AGENT),SliderKeys.AGENT_TAR);
  }
 else {
    agentImagePath=new Path(agentImage);
  }
  if (fileSystem.getFileSystem().exists(agentImagePath)) {
    LocalResource agentImageRes=fileSystem.createAmResource(agentImagePath,LocalResourceType.ARCHIVE);
    launcher.addLocalResource(AgentKeys.AGENT_INSTALL_DIR,agentImageRes);
  }
 else {
    String msg=String.format("String_Node_Str",agentImagePath.toString());
    MapOperations compOps=appComponent;
    boolean relaxVerificationForTest=compOps != null ? Boolean.valueOf(compOps.getOptionBool(AgentKeys.TEST_RELAX_VERIFICATION,false)) : false;
    log.error(msg);
    if (!relaxVerificationForTest) {
      throw new SliderException(SliderExitCodes.EXIT_DEPLOYMENT_FAILED,msg);
    }
  }
  log.info("String_Node_Str",scriptPath);
  LocalResource appDefRes=fileSystem.createAmResource(fileSystem.getFileSystem().resolvePath(new Path(appDef)),LocalResourceType.ARCHIVE);
  launcher.addLocalResource(AgentKeys.APP_DEFINITION_DIR,appDefRes);
  for (  Package pkg : getMetaInfo().getApplication().getPackages()) {
    Path pkgPath=fileSystem.buildResourcePath(pkg.getName());
    if (!fileSystem.isFile(pkgPath)) {
      pkgPath=fileSystem.buildResourcePath(getClusterName(),pkg.getName());
    }
    if (!fileSystem.isFile(pkgPath)) {
      throw new IOException("String_Node_Str" + pkg.getName());
    }
    log.info("String_Node_Str",pkg.getName());
    LocalResourceType type=LocalResourceType.FILE;
    if ("String_Node_Str".equals(pkg.getType())) {
      type=LocalResourceType.ARCHIVE;
    }
    LocalResource packageResource=fileSystem.createAmResource(pkgPath,type);
    launcher.addLocalResource(AgentKeys.APP_PACKAGES_DIR,packageResource);
  }
  String agentConf=instanceDefinition.getAppConfOperations().getGlobalOptions().getOption(AgentKeys.AGENT_CONF,"String_Node_Str");
  if (SliderUtils.isSet(agentConf)) {
    LocalResource agentConfRes=fileSystem.createAmResource(fileSystem.getFileSystem().resolvePath(new Path(agentConf)),LocalResourceType.FILE);
    launcher.addLocalResource(AgentKeys.AGENT_CONFIG_FILE,agentConfRes);
  }
  String agentVer=instanceDefinition.getAppConfOperations().getGlobalOptions().getOption(AgentKeys.AGENT_VERSION,null);
  if (agentVer != null) {
    LocalResource agentVerRes=fileSystem.createAmResource(fileSystem.getFileSystem().resolvePath(new Path(agentVer)),LocalResourceType.FILE);
    launcher.addLocalResource(AgentKeys.AGENT_VERSION_FILE,agentVerRes);
  }
  if (SliderUtils.isHadoopClusterSecure(getConfig())) {
    localizeServiceKeytabs(launcher,instanceDefinition,fileSystem);
  }
  MapOperations amComponent=instanceDefinition.getAppConfOperations().getComponent(SliderKeys.COMPONENT_AM);
  boolean twoWayEnabled=amComponent != null ? Boolean.valueOf(amComponent.getOptionBool(AgentKeys.KEY_AGENT_TWO_WAY_SSL_ENABLED,false)) : false;
  if (twoWayEnabled) {
    localizeContainerSSLResources(launcher,container,fileSystem);
  }
  MapOperations compOps=appComponent;
  if (areStoresRequested(compOps)) {
    localizeContainerSecurityStores(launcher,container,roleName,fileSystem,instanceDefinition,compOps);
  }
  launcher.addLocalResources(fileSystem.submitDirectory(generatedConfPath,SliderKeys.PROPAGATED_CONF_DIR_NAME));
  if (appComponent.getOptionBool(AgentKeys.AM_CONFIG_GENERATION,false)) {
    Map<String,Map<String,String>> configurations=buildCommandConfigurations(instanceDefinition.getAppConfOperations(),container.getId().toString(),roleName,roleGroup);
    localizeConfigFiles(launcher,roleName,roleGroup,getMetaInfo(),configurations,launcher.getEnv(),fileSystem);
  }
  String label=getContainerLabel(container,roleName,roleGroup);
  CommandLineBuilder operation=new CommandLineBuilder();
  String pythonExec=instanceDefinition.getAppConfOperations().getGlobalOptions().getOption(SliderXmlConfKeys.PYTHON_EXECUTABLE_PATH,AgentKeys.PYTHON_EXE);
  operation.add(pythonExec);
  operation.add(scriptPath);
  operation.add(ARG_LABEL,label);
  operation.add(ARG_ZOOKEEPER_QUORUM);
  operation.add(getClusterOptionPropertyValue(OptionKeys.ZOOKEEPER_QUORUM));
  operation.add(ARG_ZOOKEEPER_REGISTRY_PATH);
  operation.add(getZkRegistryPath());
  String debugCmd=agentLaunchParameter.getNextLaunchParameter(roleGroup);
  if (SliderUtils.isSet(debugCmd)) {
    operation.add(ARG_DEBUG);
    operation.add(debugCmd);
  }
  operation.add("String_Node_Str" + ApplicationConstants.LOG_DIR_EXPANSION_VAR + "String_Node_Str"+ AgentKeys.AGENT_OUT_FILE+ "String_Node_Str");
  launcher.addCommand(operation.build());
  String addonAppDefString=instanceDefinition.getAppConfOperations().getGlobalOptions().getOption(AgentKeys.ADDONS,null);
  log.debug("String_Node_Str",addonAppDefString);
  if (addonAppDefString != null) {
    Scanner scanner=new Scanner(addonAppDefString).useDelimiter("String_Node_Str");
    while (scanner.hasNext()) {
      String addonAppDef=scanner.next();
      String addonAppDefPath=instanceDefinition.getAppConfOperations().getGlobalOptions().get(addonAppDef);
      log.debug("String_Node_Str",addonAppDef,addonAppDefPath);
      LocalResource addonPkgRes=fileSystem.createAmResource(fileSystem.getFileSystem().resolvePath(new Path(addonAppDefPath)),LocalResourceType.ARCHIVE);
      launcher.addLocalResource(AgentKeys.ADDON_DEFINITION_DIR + "String_Node_Str" + addonAppDef,addonPkgRes);
    }
    log.debug("String_Node_Str",packageMetainfo.toString());
  }
  String appResourcesString=instanceDefinition.getAppConfOperations().getGlobalOptions().getOption(AgentKeys.APP_RESOURCES,null);
  log.info("String_Node_Str",appResourcesString);
  if (null != appResourcesString) {
    try (Scanner scanner=new Scanner(appResourcesString).useDelimiter("String_Node_Str")){
      while (scanner.hasNext()) {
        String resource=scanner.next();
        Path resourcePath=new Path(resource);
        LocalResource extraResource=fileSystem.createAmResource(fileSystem.getFileSystem().resolvePath(resourcePath),LocalResourceType.FILE);
        String destination=AgentKeys.APP_RESOURCES_DIR + "String_Node_Str" + resourcePath.getName();
        log.info("String_Node_Str",resourcePath,destination);
        launcher.addLocalResource(destination,extraResource);
      }
    }
   }
  Map<String,State> pkgStatuses=new TreeMap<>();
  for (  Metainfo appPkg : packageMetainfo.values()) {
    for (    ComponentsInAddonPackage comp : appPkg.getApplicationPackage().getComponents()) {
      log.debug("String_Node_Str",roleName,comp.getName());
      if (comp.getName().equals(roleGroup) || comp.getName().equals(AgentKeys.ADDON_FOR_ALL_COMPONENTS)) {
        pkgStatuses.put(appPkg.getApplicationPackage().getName(),State.INIT);
      }
    }
  }
  log.debug("String_Node_Str",roleName,pkgStatuses.toString());
  getComponentStatuses().put(label,new ComponentInstanceState(roleGroup,container.getId(),getClusterInfoPropertyValue(OptionKeys.APPLICATION_NAME),pkgStatuses));
}

Fixed version (ground truth):
@Override public void buildContainerLaunchContext(ContainerLauncher launcher,AggregateConf instanceDefinition,Container container,ProviderRole providerRole,SliderFileSystem fileSystem,Path generatedConfPath,MapOperations resourceComponent,MapOperations appComponent,Path containerTmpDirPath) throws IOException, SliderException {
  String roleName=providerRole.name;
  String roleGroup=providerRole.group;
  String appDef=SliderUtils.getApplicationDefinitionPath(instanceDefinition.getAppConfOperations(),roleGroup);
  initializeApplicationConfiguration(instanceDefinition,fileSystem,roleGroup);
  log.info("String_Node_Str");
  log.debug(instanceDefinition.toString());
  if (isYarnDockerContainer(roleGroup)) {
    launcher.setYarnDockerMode(true);
    launcher.setDockerImage(getConfigFromMetaInfo(roleGroup,"String_Node_Str"));
    launcher.setRunPrivilegedContainer(getConfigFromMetaInfo(roleGroup,"String_Node_Str"));
    launcher.setYarnContainerMountPoints(getConfigFromMetaInfoWithAppConfigOverriding(roleGroup,"String_Node_Str"));
  }
  launcher.putEnv(SliderUtils.buildEnvMap(appComponent,getStandardTokenMap(getAmState().getAppConfSnapshot(),roleName,roleGroup)));
  String workDir=ApplicationConstants.Environment.PWD.$();
  launcher.setEnv("String_Node_Str",workDir);
  log.info("String_Node_Str",workDir);
  String logDir=ApplicationConstants.LOG_DIR_EXPANSION_VAR;
  launcher.setEnv("String_Node_Str",logDir);
  log.info("String_Node_Str",logDir);
  if (System.getenv(HADOOP_USER_NAME) != null) {
    launcher.setEnv(HADOOP_USER_NAME,System.getenv(HADOOP_USER_NAME));
  }
  launcher.setEnv(SLIDER_PASSPHRASE,instanceDefinition.getPassphrase());
  launcher.setEnv("String_Node_Str","String_Node_Str");
  launcher.setEnv("String_Node_Str","String_Node_Str");
  launcher.setEnv("String_Node_Str","String_Node_Str");
  String scriptPath=new File(AgentKeys.AGENT_MAIN_SCRIPT_ROOT,AgentKeys.AGENT_MAIN_SCRIPT).getPath();
  String appHome=instanceDefinition.getAppConfOperations().getGlobalOptions().get(AgentKeys.PACKAGE_PATH);
  if (SliderUtils.isSet(appHome)) {
    scriptPath=new File(appHome,AgentKeys.AGENT_MAIN_SCRIPT).getPath();
  }
  List<String> pythonPaths=new ArrayList<String>();
  pythonPaths.add(AgentKeys.AGENT_MAIN_SCRIPT_ROOT);
  pythonPaths.add(AgentKeys.AGENT_JINJA2_ROOT);
  String pythonPath=StringUtils.join(File.pathSeparator,pythonPaths);
  launcher.setEnv(PYTHONPATH,pythonPath);
  log.info("String_Node_Str",pythonPath);
  Path agentImagePath=null;
  String agentImage=instanceDefinition.getInternalOperations().get(InternalKeys.INTERNAL_APPLICATION_IMAGE_PATH);
  if (SliderUtils.isUnset(agentImage)) {
    agentImagePath=new Path(new Path(new Path(instanceDefinition.getInternalOperations().get(InternalKeys.INTERNAL_TMP_DIR),container.getId().getApplicationAttemptId().getApplicationId().toString()),AgentKeys.PROVIDER_AGENT),SliderKeys.AGENT_TAR);
  }
 else {
    agentImagePath=new Path(agentImage);
  }
  if (fileSystem.getFileSystem().exists(agentImagePath)) {
    LocalResource agentImageRes=fileSystem.createAmResource(agentImagePath,LocalResourceType.ARCHIVE);
    launcher.addLocalResource(AgentKeys.AGENT_INSTALL_DIR,agentImageRes);
  }
 else {
    String msg=String.format("String_Node_Str",agentImagePath.toString());
    MapOperations compOps=appComponent;
    boolean relaxVerificationForTest=compOps != null ? Boolean.valueOf(compOps.getOptionBool(AgentKeys.TEST_RELAX_VERIFICATION,false)) : false;
    log.error(msg);
    if (!relaxVerificationForTest) {
      throw new SliderException(SliderExitCodes.EXIT_DEPLOYMENT_FAILED,msg);
    }
  }
  log.info("String_Node_Str",scriptPath);
  LocalResource appDefRes=fileSystem.createAmResource(fileSystem.getFileSystem().resolvePath(new Path(appDef)),LocalResourceType.ARCHIVE);
  launcher.addLocalResource(AgentKeys.APP_DEFINITION_DIR,appDefRes);
  for (  Package pkg : getMetaInfo(roleGroup).getApplication().getPackages()) {
    Path pkgPath=fileSystem.buildResourcePath(pkg.getName());
    if (!fileSystem.isFile(pkgPath)) {
      pkgPath=fileSystem.buildResourcePath(getClusterName(),pkg.getName());
    }
    if (!fileSystem.isFile(pkgPath)) {
      throw new IOException("String_Node_Str" + pkg.getName());
    }
    log.info("String_Node_Str",pkg.getName());
    LocalResourceType type=LocalResourceType.FILE;
    if ("String_Node_Str".equals(pkg.getType())) {
      type=LocalResourceType.ARCHIVE;
    }
    LocalResource packageResource=fileSystem.createAmResource(pkgPath,type);
    launcher.addLocalResource(AgentKeys.APP_PACKAGES_DIR,packageResource);
  }
  String agentConf=instanceDefinition.getAppConfOperations().getGlobalOptions().getOption(AgentKeys.AGENT_CONF,"String_Node_Str");
  if (SliderUtils.isSet(agentConf)) {
    LocalResource agentConfRes=fileSystem.createAmResource(fileSystem.getFileSystem().resolvePath(new Path(agentConf)),LocalResourceType.FILE);
    launcher.addLocalResource(AgentKeys.AGENT_CONFIG_FILE,agentConfRes);
  }
  String agentVer=instanceDefinition.getAppConfOperations().getGlobalOptions().getOption(AgentKeys.AGENT_VERSION,null);
  if (agentVer != null) {
    LocalResource agentVerRes=fileSystem.createAmResource(fileSystem.getFileSystem().resolvePath(new Path(agentVer)),LocalResourceType.FILE);
    launcher.addLocalResource(AgentKeys.AGENT_VERSION_FILE,agentVerRes);
  }
  if (SliderUtils.isHadoopClusterSecure(getConfig())) {
    localizeServiceKeytabs(launcher,instanceDefinition,fileSystem);
  }
  MapOperations amComponent=instanceDefinition.getAppConfOperations().getComponent(SliderKeys.COMPONENT_AM);
  boolean twoWayEnabled=amComponent != null ? Boolean.valueOf(amComponent.getOptionBool(AgentKeys.KEY_AGENT_TWO_WAY_SSL_ENABLED,false)) : false;
  if (twoWayEnabled) {
    localizeContainerSSLResources(launcher,container,fileSystem);
  }
  MapOperations compOps=appComponent;
  if (areStoresRequested(compOps)) {
    localizeContainerSecurityStores(launcher,container,roleName,fileSystem,instanceDefinition,compOps);
  }
  launcher.addLocalResources(fileSystem.submitDirectory(generatedConfPath,SliderKeys.PROPAGATED_CONF_DIR_NAME));
  if (appComponent.getOptionBool(AgentKeys.AM_CONFIG_GENERATION,false)) {
    Map<String,Map<String,String>> configurations=buildCommandConfigurations(instanceDefinition.getAppConfOperations(),container.getId().toString(),roleName,roleGroup);
    localizeConfigFiles(launcher,roleName,roleGroup,getMetaInfo(roleGroup),configurations,launcher.getEnv(),fileSystem);
  }
  String label=getContainerLabel(container,roleName,roleGroup);
  CommandLineBuilder operation=new CommandLineBuilder();
  String pythonExec=instanceDefinition.getAppConfOperations().getGlobalOptions().getOption(SliderXmlConfKeys.PYTHON_EXECUTABLE_PATH,AgentKeys.PYTHON_EXE);
  operation.add(pythonExec);
  operation.add(scriptPath);
  operation.add(ARG_LABEL,label);
  operation.add(ARG_ZOOKEEPER_QUORUM);
  operation.add(getClusterOptionPropertyValue(OptionKeys.ZOOKEEPER_QUORUM));
  operation.add(ARG_ZOOKEEPER_REGISTRY_PATH);
  operation.add(getZkRegistryPath());
  String debugCmd=agentLaunchParameter.getNextLaunchParameter(roleGroup);
  if (SliderUtils.isSet(debugCmd)) {
    operation.add(ARG_DEBUG);
    operation.add(debugCmd);
  }
  operation.add("String_Node_Str" + ApplicationConstants.LOG_DIR_EXPANSION_VAR + "String_Node_Str"+ AgentKeys.AGENT_OUT_FILE+ "String_Node_Str");
  launcher.addCommand(operation.build());
  String addonAppDefString=instanceDefinition.getAppConfOperations().getGlobalOptions().getOption(AgentKeys.ADDONS,null);
  log.debug("String_Node_Str",addonAppDefString);
  if (addonAppDefString != null) {
    Scanner scanner=new Scanner(addonAppDefString).useDelimiter("String_Node_Str");
    while (scanner.hasNext()) {
      String addonAppDef=scanner.next();
      String addonAppDefPath=instanceDefinition.getAppConfOperations().getGlobalOptions().get(addonAppDef);
      log.debug("String_Node_Str",addonAppDef,addonAppDefPath);
      LocalResource addonPkgRes=fileSystem.createAmResource(fileSystem.getFileSystem().resolvePath(new Path(addonAppDefPath)),LocalResourceType.ARCHIVE);
      launcher.addLocalResource(AgentKeys.ADDON_DEFINITION_DIR + "String_Node_Str" + addonAppDef,addonPkgRes);
    }
    log.debug("String_Node_Str",packageMetainfo.toString());
  }
  String appResourcesString=instanceDefinition.getAppConfOperations().getGlobalOptions().getOption(AgentKeys.APP_RESOURCES,null);
  log.info("String_Node_Str",appResourcesString);
  if (null != appResourcesString) {
    try (Scanner scanner=new Scanner(appResourcesString).useDelimiter("String_Node_Str")){
      while (scanner.hasNext()) {
        String resource=scanner.next();
        Path resourcePath=new Path(resource);
        LocalResource extraResource=fileSystem.createAmResource(fileSystem.getFileSystem().resolvePath(resourcePath),LocalResourceType.FILE);
        String destination=AgentKeys.APP_RESOURCES_DIR + "String_Node_Str" + resourcePath.getName();
        log.info("String_Node_Str",resourcePath,destination);
        launcher.addLocalResource(destination,extraResource);
      }
    }
   }
  Map<String,State> pkgStatuses=new TreeMap<>();
  for (  Metainfo appPkg : packageMetainfo.values()) {
    for (    ComponentsInAddonPackage comp : appPkg.getApplicationPackage().getComponents()) {
      log.debug("String_Node_Str",roleName,comp.getName());
      if (comp.getName().equals(roleGroup) || comp.getName().equals(AgentKeys.ADDON_FOR_ALL_COMPONENTS)) {
        pkgStatuses.put(appPkg.getApplicationPackage().getName(),State.INIT);
      }
    }
  }
  log.debug("String_Node_Str",roleName,pkgStatuses.toString());
  getComponentStatuses().put(label,new ComponentInstanceState(roleGroup,container.getId(),getClusterInfoPropertyValue(OptionKeys.APPLICATION_NAME),pkgStatuses));
}