Program: 70378
Project: 70378
Buggy source:
private JobDescription prepareJob() throws Exception {
  TaskDescription taskParams=this.taskParams;
  String targetPath=getResourceNode().getInstallDir();
  String targetHost=getResourceNode().getHost();
  String targetUser=getResourceNode().getUser();
  if (userNeeded && !targetUser.isEmpty()) {
    targetUser+="String_Node_Str";
  }
 else {
    targetUser="String_Node_Str";
  }
  SoftwareDescription sd=new SoftwareDescription();
  sd.setExecutable(targetPath + WORKER_SCRIPT_PATH + WORKER_SCRIPT_NAME);
  ArrayList<String> lArgs=new ArrayList<String>();
  lArgs.add(lang);
  lArgs.add(getResourceNode().getWorkingDir());
  lArgs.add(getResourceNode().getLibPath());
  LinkedList<LogicalData> obsoleteFiles=getResource().clearObsoletes();
  if (obsoleteFiles != null) {
    lArgs.add("String_Node_Str" + obsoleteFiles.size());
    for (    LogicalData ld : obsoleteFiles) {
      String renaming=ld.getName();
      lArgs.add(renaming);
    }
  }
 else {
    lArgs.add("String_Node_Str");
  }
  ArrayList<String> symlinks=new ArrayList<String>();
  ArrayList<String> paramArgs=new ArrayList<String>();
  String sandboxDir=getResourceNode().getWorkingDir() + File.separator + "String_Node_Str"+ File.separator+ "String_Node_Str"+ this.jobId;
  processParameters(sandboxDir,symlinks,paramArgs);
  lArgs.add(sandboxDir);
  if (symlinks.size() > 0) {
    lArgs.add("String_Node_Str" + symlinks.size());
    lArgs.addAll(symlinks);
  }
 else {
    lArgs.add("String_Node_Str");
  }
  lArgs.add(Boolean.toString(Tracer.isActivated()));
  lArgs.add(getHostName());
  if (debug) {
    logger.debug("String_Node_Str" + getHostName());
  }
  if (Tracer.isActivated()) {
    lArgs.add(String.valueOf(Tracer.getTaskEventsType()));
    lArgs.add(String.valueOf(this.taskParams.getId() + 1));
    int slot=Tracer.getNextSlot(targetHost);
    lArgs.add(String.valueOf(slot));
    sd.addAttribute("String_Node_Str",slot);
  }
  lArgs.add(sandboxDir);
  lArgs.add(getResourceNode().getAppDir());
  lArgs.add(getClasspath());
  lArgs.add(getPythonpath());
  lArgs.add(String.valueOf(debug));
  lArgs.add(STORAGE_CONF);
  AbstractMethodImplementation absImpl=(AbstractMethodImplementation)this.impl;
  lArgs.add(String.valueOf(absImpl.getMethodType()));
switch (absImpl.getMethodType()) {
case METHOD:
    MethodImplementation methodImpl=(MethodImplementation)absImpl;
  lArgs.add(methodImpl.getDeclaringClass());
String methodName=methodImpl.getAlternativeMethodName();
if (methodName == null || methodName.isEmpty()) {
methodName=taskParams.getName();
}
lArgs.add(methodName);
break;
case MPI:
MPIImplementation mpiImpl=(MPIImplementation)absImpl;
lArgs.add(mpiImpl.getMpiRunner());
lArgs.add(mpiImpl.getBinary());
break;
case OMPSS:
OmpSsImplementation ompssImpl=(OmpSsImplementation)absImpl;
lArgs.add(ompssImpl.getBinary());
break;
case OPENCL:
OpenCLImplementation openclImpl=(OpenCLImplementation)absImpl;
lArgs.add(openclImpl.getKernel());
break;
case BINARY:
BinaryImplementation binaryImpl=(BinaryImplementation)absImpl;
lArgs.add(binaryImpl.getBinary());
break;
}
lArgs.add(String.valueOf(slaveWorkersNodeNames.size()));
lArgs.addAll(slaveWorkersNodeNames);
lArgs.add(String.valueOf(((MethodResourceDescription)this.impl.getRequirements()).getTotalCPUComputingUnits()));
lArgs.addAll(paramArgs);
String[] arguments=new String[lArgs.size()];
arguments=lArgs.toArray(arguments);
try {
sd.setArguments(arguments);
}
 catch (NullPointerException e) {
StringBuilder sb=new StringBuilder("String_Node_Str" + this.jobId + "String_Node_Str"+ absImpl.getMethodDefinition()+ "String_Node_Str");
int i=0;
for (Parameter param : taskParams.getParameters()) {
sb.append("String_Node_Str").append(i).append("String_Node_Str");
DataType type=param.getType();
sb.append("String_Node_Str").append(param.getType()).append("String_Node_Str");
if (type == DataType.FILE_T || type == DataType.OBJECT_T) {
DependencyParameter dPar=(DependencyParameter)param;
DataAccessId dAccId=dPar.getDataAccessId();
sb.append("String_Node_Str").append(dPar.getDataTarget()).append("String_Node_Str");
if (type == DataType.OBJECT_T) {
if (dAccId instanceof RAccessId) {
sb.append("String_Node_Str" + "String_Node_Str").append("String_Node_Str");
}
 else {
sb.append("String_Node_Str" + "String_Node_Str").append("String_Node_Str");
}
}
}
 else if (type == DataType.STRING_T) {
BasicTypeParameter btParS=(BasicTypeParameter)param;
String value=btParS.getValue().toString();
int numSubStrings=value.split("String_Node_Str").length;
sb.append("String_Node_Str" + Integer.toString(numSubStrings)).append("String_Node_Str");
sb.append("String_Node_Str" + value).append("String_Node_Str");
}
 else {
BasicTypeParameter btParB=(BasicTypeParameter)param;
sb.append("String_Node_Str" + btParB.getValue().toString()).append("String_Node_Str");
}
i++;
}
logger.error(sb.toString());
listener.jobFailed(this,JobEndStatus.SUBMISSION_FAILED);
}
sd.addAttribute("String_Node_Str",jobId);
sd.addAttribute(SoftwareDescription.WALLTIME_MAX,absImpl.getRequirements().getWallClockLimit());
if (absImpl.getRequirements().getHostQueues().size() > 0) {
sd.addAttribute(SoftwareDescription.JOB_QUEUE,absImpl.getRequirements().getHostQueues().get(0));
}
sd.addAttribute("String_Node_Str",absImpl.getRequirements().getTotalCPUComputingUnits());
sd.addAttribute("String_Node_Str",absImpl.getRequirements().getTotalGPUComputingUnits());
sd.addAttribute("String_Node_Str",absImpl.getRequirements().getTotalFPGAComputingUnits());
sd.addAttribute(SoftwareDescription.MEMORY_MAX,absImpl.getRequirements().getMemorySize());
sd.addAttribute(SoftwareDescription.SANDBOX_ROOT,getResourceNode().getWorkingDir());
sd.addAttribute(SoftwareDescription.SANDBOX_USEROOT,"String_Node_Str");
sd.addAttribute(SoftwareDescription.SANDBOX_DELETE,"String_Node_Str");
if (debug) {
File outFile=GAT.createFile(context,Protocol.ANY_URI.getSchema() + File.separator + JOBS_DIR+ "String_Node_Str"+ jobId+ "String_Node_Str"+ this.getHistory()+ "String_Node_Str");
sd.setStdout(outFile);
}
if (debug || usingGlobus) {
File errFile=GAT.createFile(context,Protocol.ANY_URI.getSchema() + File.separator + JOBS_DIR+ "String_Node_Str"+ jobId+ "String_Node_Str"+ this.getHistory()+ "String_Node_Str");
sd.setStderr(errFile);
}
Map<String,Object> attributes=new HashMap<String,Object>();
attributes.put(RES_ATTR,Protocol.ANY_URI.getSchema() + targetUser + targetHost);
attributes.put("String_Node_Str","String_Node_Str" + jobId);
ResourceDescription rd=new HardwareResourceDescription(attributes);
if (debug) {
logger.debug("String_Node_Str" + jobId + "String_Node_Str");
logger.debug("String_Node_Str" + targetHost);
logger.debug("String_Node_Str" + sd.getExecutable());
StringBuilder sb=new StringBuilder("String_Node_Str");
for (String arg : sd.getArguments()) {
sb.append("String_Node_Str").append(arg);
}
logger.debug(sb.toString());
}
JobDescription jd=new JobDescription(sd,rd);
return jd;
}

Fixed version (ground truth):
private JobDescription prepareJob() throws Exception {
  TaskDescription taskParams=this.taskParams;
  String targetPath=getResourceNode().getInstallDir();
  String targetHost=getResourceNode().getHost();
  String targetUser=getResourceNode().getUser();
  if (userNeeded && !targetUser.isEmpty()) {
    targetUser+="String_Node_Str";
  }
 else {
    targetUser="String_Node_Str";
  }
  SoftwareDescription sd=new SoftwareDescription();
  sd.setExecutable(targetPath + WORKER_SCRIPT_PATH + WORKER_SCRIPT_NAME);
  ArrayList<String> lArgs=new ArrayList<String>();
  lArgs.add(lang);
  lArgs.add(getResourceNode().getWorkingDir());
  lArgs.add(getResourceNode().getLibPath());
  LinkedList<LogicalData> obsoleteFiles=getResource().clearObsoletes();
  if (obsoleteFiles != null) {
    lArgs.add("String_Node_Str" + obsoleteFiles.size());
    for (    LogicalData ld : obsoleteFiles) {
      String renaming=ld.getName();
      lArgs.add(renaming);
    }
  }
 else {
    lArgs.add("String_Node_Str");
  }
  boolean isSpecific=false;
  String sandboxDir=null;
  AbstractMethodImplementation absImpl=(AbstractMethodImplementation)this.impl;
switch (absImpl.getMethodType()) {
case BINARY:
    BinaryImplementation binaryImpl=(BinaryImplementation)absImpl;
  sandboxDir=binaryImpl.getWorkingDir();
isSpecific=true;
break;
case MPI:
MPIImplementation mpiImpl=(MPIImplementation)absImpl;
sandboxDir=mpiImpl.getWorkingDir();
isSpecific=true;
break;
case OMPSS:
OmpSsImplementation ompssImpl=(OmpSsImplementation)absImpl;
sandboxDir=ompssImpl.getWorkingDir();
isSpecific=true;
break;
case OPENCL:
OpenCLImplementation openclImpl=(OpenCLImplementation)absImpl;
sandboxDir=openclImpl.getWorkingDir();
isSpecific=true;
break;
case METHOD:
sandboxDir=null;
break;
}
if (sandboxDir == null || sandboxDir.isEmpty() || sandboxDir.equals(Constants.UNASSIGNED)) {
sandboxDir=getResourceNode().getWorkingDir() + File.separator + "String_Node_Str"+ File.separator+ "String_Node_Str"+ this.jobId;
isSpecific=false;
}
ArrayList<String> symlinks=new ArrayList<>();
ArrayList<String> paramArgs=new ArrayList<>();
processParameters(sandboxDir,symlinks,paramArgs);
lArgs.add(Boolean.toString(isSpecific));
lArgs.add(sandboxDir);
if (symlinks.size() > 0) {
lArgs.add(String.valueOf(symlinks.size()));
lArgs.addAll(symlinks);
}
 else {
lArgs.add("String_Node_Str");
}
lArgs.add(Boolean.toString(Tracer.isActivated()));
lArgs.add(getHostName());
if (debug) {
logger.debug("String_Node_Str" + getHostName());
}
if (Tracer.isActivated()) {
lArgs.add(String.valueOf(Tracer.getTaskEventsType()));
lArgs.add(String.valueOf(this.taskParams.getId() + 1));
int slot=Tracer.getNextSlot(targetHost);
lArgs.add(String.valueOf(slot));
sd.addAttribute("String_Node_Str",slot);
}
lArgs.add(sandboxDir);
lArgs.add(getResourceNode().getAppDir());
lArgs.add(getClasspath());
lArgs.add(getPythonpath());
lArgs.add(String.valueOf(debug));
lArgs.add(STORAGE_CONF);
lArgs.add(String.valueOf(absImpl.getMethodType()));
switch (absImpl.getMethodType()) {
case METHOD:
MethodImplementation methodImpl=(MethodImplementation)absImpl;
lArgs.add(methodImpl.getDeclaringClass());
String methodName=methodImpl.getAlternativeMethodName();
if (methodName == null || methodName.isEmpty()) {
methodName=taskParams.getName();
}
lArgs.add(methodName);
break;
case MPI:
MPIImplementation mpiImpl=(MPIImplementation)absImpl;
lArgs.add(mpiImpl.getMpiRunner());
lArgs.add(mpiImpl.getBinary());
break;
case OMPSS:
OmpSsImplementation ompssImpl=(OmpSsImplementation)absImpl;
lArgs.add(ompssImpl.getBinary());
break;
case OPENCL:
OpenCLImplementation openclImpl=(OpenCLImplementation)absImpl;
lArgs.add(openclImpl.getKernel());
break;
case BINARY:
BinaryImplementation binaryImpl=(BinaryImplementation)absImpl;
lArgs.add(binaryImpl.getBinary());
break;
}
lArgs.add(String.valueOf(slaveWorkersNodeNames.size()));
lArgs.addAll(slaveWorkersNodeNames);
lArgs.add(String.valueOf(((MethodResourceDescription)this.impl.getRequirements()).getTotalCPUComputingUnits()));
lArgs.addAll(paramArgs);
String[] arguments=new String[lArgs.size()];
arguments=lArgs.toArray(arguments);
try {
sd.setArguments(arguments);
}
 catch (NullPointerException e) {
StringBuilder sb=new StringBuilder("String_Node_Str" + this.jobId + "String_Node_Str"+ absImpl.getMethodDefinition()+ "String_Node_Str");
int i=0;
for (Parameter param : taskParams.getParameters()) {
sb.append("String_Node_Str").append(i).append("String_Node_Str");
DataType type=param.getType();
sb.append("String_Node_Str").append(param.getType()).append("String_Node_Str");
if (type == DataType.FILE_T || type == DataType.OBJECT_T) {
DependencyParameter dPar=(DependencyParameter)param;
DataAccessId dAccId=dPar.getDataAccessId();
sb.append("String_Node_Str").append(dPar.getDataTarget()).append("String_Node_Str");
if (type == DataType.OBJECT_T) {
if (dAccId instanceof RAccessId) {
sb.append("String_Node_Str" + "String_Node_Str").append("String_Node_Str");
}
 else {
sb.append("String_Node_Str" + "String_Node_Str").append("String_Node_Str");
}
}
}
 else if (type == DataType.STRING_T) {
BasicTypeParameter btParS=(BasicTypeParameter)param;
String value=btParS.getValue().toString();
int numSubStrings=value.split("String_Node_Str").length;
sb.append("String_Node_Str" + Integer.toString(numSubStrings)).append("String_Node_Str");
sb.append("String_Node_Str" + value).append("String_Node_Str");
}
 else {
BasicTypeParameter btParB=(BasicTypeParameter)param;
sb.append("String_Node_Str" + btParB.getValue().toString()).append("String_Node_Str");
}
i++;
}
logger.error(sb.toString());
listener.jobFailed(this,JobEndStatus.SUBMISSION_FAILED);
}
sd.addAttribute("String_Node_Str",jobId);
sd.addAttribute(SoftwareDescription.WALLTIME_MAX,absImpl.getRequirements().getWallClockLimit());
if (absImpl.getRequirements().getHostQueues().size() > 0) {
sd.addAttribute(SoftwareDescription.JOB_QUEUE,absImpl.getRequirements().getHostQueues().get(0));
}
sd.addAttribute("String_Node_Str",absImpl.getRequirements().getTotalCPUComputingUnits());
sd.addAttribute("String_Node_Str",absImpl.getRequirements().getTotalGPUComputingUnits());
sd.addAttribute("String_Node_Str",absImpl.getRequirements().getTotalFPGAComputingUnits());
sd.addAttribute(SoftwareDescription.MEMORY_MAX,absImpl.getRequirements().getMemorySize());
sd.addAttribute(SoftwareDescription.SANDBOX_ROOT,getResourceNode().getWorkingDir());
sd.addAttribute(SoftwareDescription.SANDBOX_USEROOT,"String_Node_Str");
sd.addAttribute(SoftwareDescription.SANDBOX_DELETE,"String_Node_Str");
if (debug) {
File outFile=GAT.createFile(context,Protocol.ANY_URI.getSchema() + File.separator + JOBS_DIR+ "String_Node_Str"+ jobId+ "String_Node_Str"+ this.getHistory()+ "String_Node_Str");
sd.setStdout(outFile);
}
if (debug || usingGlobus) {
File errFile=GAT.createFile(context,Protocol.ANY_URI.getSchema() + File.separator + JOBS_DIR+ "String_Node_Str"+ jobId+ "String_Node_Str"+ this.getHistory()+ "String_Node_Str");
sd.setStderr(errFile);
}
Map<String,Object> attributes=new HashMap<String,Object>();
attributes.put(RES_ATTR,Protocol.ANY_URI.getSchema() + targetUser + targetHost);
attributes.put("String_Node_Str","String_Node_Str" + jobId);
ResourceDescription rd=new HardwareResourceDescription(attributes);
if (debug) {
logger.debug("String_Node_Str" + jobId + "String_Node_Str");
logger.debug("String_Node_Str" + targetHost);
logger.debug("String_Node_Str" + sd.getExecutable());
StringBuilder sb=new StringBuilder("String_Node_Str");
for (String arg : sd.getArguments()) {
sb.append("String_Node_Str").append(arg);
}
logger.debug(sb.toString());
}
JobDescription jd=new JobDescription(sd,rd);
return jd;
}