Program: 123309
Project: 123309
Buggy source:
/** 
 * Generates the WSDL file for the exported job.
 * @param processItem
 * @return
 */
private ExportFileResource generateWsdlFile(ProcessItem item){
  String jobName=item.getProperty().getLabel();
  String jobVersion=item.getProperty().getVersion();
  PetalsWsdlBean wsdlBean=new PetalsWsdlBean();
  wsdlBean.setJobName(jobName);
  wsdlBean.setJobVersion(jobVersion);
  wsdlBean.setContextDefinitions(PetalsTemporaryOptionsKeeper.INSTANCE.getContexts());
  wsdlBean.setAutogenerate(PetalsTemporaryOptionsKeeper.INSTANCE.isGenerateEndpoint());
  IStructuredSelection selection=PetalsTemporaryOptionsKeeper.INSTANCE.getSelection();
  List<NodeType> petalsComponents=TalendUtils.getTalendComponentsFromSelectedJob(selection,"String_Node_Str");
  if (petalsComponents.size() > 0) {
    List<ElementTypeDefinition> defs;
    try {
      defs=TalendUtils.getWsdlSchemaForComponent(petalsComponents.get(0));
    }
 catch (    PetalsExportException e) {
      ExceptionHandler.process(e);
      defs=Collections.emptyList();
    }
    wsdlBean.settPetalsInputSchema(defs);
  }
  petalsComponents=TalendUtils.getTalendComponentsFromSelectedJob(selection,"String_Node_Str");
  if (petalsComponents.size() > 0) {
    List<ElementTypeDefinition> defs;
    try {
      defs=TalendUtils.getWsdlSchemaForComponent(petalsComponents.get(0));
    }
 catch (    PetalsExportException e) {
      ExceptionHandler.process(e);
      defs=Collections.emptyList();
    }
    wsdlBean.settPetalsOutputSchema(defs);
  }
  File f=null;
  try {
    File jobFolder=new File(getTmpFolder() + PATH_SEPARATOR + jobName);
    if (!jobFolder.exists() && !jobFolder.mkdir())     throw new IOException("String_Node_Str");
    f=new File(jobFolder,jobName + "String_Node_Str");
    if (!f.exists() && !f.createNewFile())     throw new IOException("String_Node_Str");
    String content=new WsdlGenerator().generate(wsdlBean);
    ByteArrayInputStream in=new ByteArrayInputStream(content.getBytes());
    FileOutputStream out=new FileOutputStream(f);
    byte[] buf=new byte[1024];
    int len;
    while ((len=in.read(buf)) > 0)     out.write(buf,0,len);
    out.close();
  }
 catch (  IOException e) {
    ExceptionHandler.process(e);
  }
  ExportFileResource metaInfResource=new ExportFileResource(item,null);
  List<URL> urlList=new ArrayList<URL>();
  try {
    if (f != null)     urlList.add(f.toURL());
  }
 catch (  MalformedURLException e) {
    ExceptionHandler.process(e);
  }
  metaInfResource.addResources(urlList);
  return metaInfResource;
}

Fixed version (ground truth):
/** 
 * Generates the WSDL file for the exported job.
 * @param processItem
 * @return
 */
private ExportFileResource generateWsdlFile(ProcessItem item){
  String jobName=item.getProperty().getLabel();
  String jobVersion=item.getProperty().getVersion();
  PetalsWsdlBean wsdlBean=new PetalsWsdlBean();
  wsdlBean.setJobName(jobName);
  wsdlBean.setJobVersion(jobVersion);
  wsdlBean.setContextDefinitions(PetalsTemporaryOptionsKeeper.INSTANCE.getContexts());
  wsdlBean.setAutogenerate(PetalsTemporaryOptionsKeeper.INSTANCE.isGenerateEndpoint());
  IStructuredSelection selection=PetalsTemporaryOptionsKeeper.INSTANCE.getSelection();
  List<NodeType> petalsComponents=TalendUtils.getTalendComponentsFromSelectedJob(selection,"String_Node_Str");
  if (petalsComponents.size() > 0) {
    List<ElementTypeDefinition> defs;
    try {
      defs=TalendUtils.getWsdlSchemaForComponent(petalsComponents.get(0));
    }
 catch (    PetalsExportException e) {
      ExceptionHandler.process(e);
      defs=Collections.emptyList();
    }
    wsdlBean.settPetalsInputSchema(defs);
  }
  petalsComponents=TalendUtils.getTalendComponentsFromSelectedJob(selection,"String_Node_Str");
  if (petalsComponents.size() > 0) {
    List<ElementTypeDefinition> defs;
    try {
      defs=TalendUtils.getWsdlSchemaForComponent(petalsComponents.get(0));
    }
 catch (    PetalsExportException e) {
      ExceptionHandler.process(e);
      defs=Collections.emptyList();
    }
    wsdlBean.settPetalsOutputSchema(defs);
  }
  File f=null;
  try {
    File jobFolder=new File(getTmpFolder() + PATH_SEPARATOR + jobName);
    if (!jobFolder.exists() && !jobFolder.mkdir())     throw new IOException("String_Node_Str");
    f=new File(jobFolder,jobName + "String_Node_Str");
    if (!f.exists() && !f.createNewFile())     throw new IOException("String_Node_Str");
    String content=new WsdlGenerator().generate(wsdlBean);
    ByteArrayInputStream in=new ByteArrayInputStream(content.getBytes());
    FileOutputStream out=new FileOutputStream(f);
    byte[] buf=new byte[1024];
    int len;
    while ((len=in.read(buf)) > 0)     out.write(buf,0,len);
    out.close();
  }
 catch (  IOException e) {
    ExceptionHandler.process(e);
  }
  ExportFileResource metaInfResource=new ExportFileResource(item,jobName);
  List<URL> urlList=new ArrayList<URL>();
  try {
    if (f != null)     urlList.add(f.toURL());
  }
 catch (  MalformedURLException e) {
    ExceptionHandler.process(e);
  }
  metaInfResource.addResources(urlList);
  return metaInfResource;
}