Program: 115318
Project: 115318
Buggy source:
/** 
 * process the page from whence you came, i.e. extract a dataset
 * @param id, the id of the extract properties bean, gained from Core Resources
 * @param datasetId, the id of the dataset, found through DatasetDAO
 * @param request, http request
 * @return model map, but more importantly, creates a quartz job which runs right away and generates all output there
 */
@RequestMapping(method=RequestMethod.GET) public ModelMap processSubmit(@RequestParam("String_Node_Str") String id,@RequestParam("String_Node_Str") String datasetId,HttpServletRequest request){
  ModelMap map=new ModelMap();
  System.out.println("String_Node_Str" + id + "String_Node_Str"+ datasetId);
  datasetDao=new DatasetDAO(dataSource);
  studyDao=new StudyDAO(dataSource);
  ExtractPropertyBean epBean=CoreResources.findExtractPropertyBeanById(new Integer(id).intValue());
  DatasetBean dsBean=(DatasetBean)datasetDao.findByPK(new Integer(datasetId).intValue());
  XsltTriggerService xsltService=new XsltTriggerService();
  generateFileService=new GenerateExtractFileService(dataSource,request,new UserAccountBean());
  String generalFileDir=SQLInitServlet.getField("String_Node_Str");
  long sysTimeBegin=System.currentTimeMillis();
  UserAccountBean userBean=(UserAccountBean)request.getSession().getAttribute("String_Node_Str");
  StudyBean currentStudy=(StudyBean)studyDao.findByPK(userBean.getActiveStudyId());
  StudyBean parentStudy=(StudyBean)studyDao.findByPK(currentStudy.getParentStudyId());
  ExtractBean eb=generateFileService.generateExtractBean(dsBean,currentStudy,parentStudy);
  String pattern="String_Node_Str" + File.separator + "String_Node_Str"+ File.separator+ "String_Node_Str"+ File.separator+ "String_Node_Str"+ File.separator;
  SimpleDateFormat sdfDir=new SimpleDateFormat(pattern);
  generalFileDir=generalFileDir + "String_Node_Str" + File.separator+ dsBean.getId()+ File.separator+ sdfDir.format(new java.util.Date());
  dsBean.setName(dsBean.getName().replaceAll("String_Node_Str","String_Node_Str"));
  HashMap answerMap=generateFileService.createODMFile("String_Node_Str",sysTimeBegin,generalFileDir,dsBean,currentStudy,"String_Node_Str",eb,currentStudy.getId(),currentStudy.getParentStudyId(),"String_Node_Str",false);
  String ODMXMLFileName="String_Node_Str";
  int fId=0;
  for (Iterator it=answerMap.entrySet().iterator(); it.hasNext(); ) {
    java.util.Map.Entry entry=(java.util.Map.Entry)it.next();
    Object key=entry.getKey();
    Object value=entry.getValue();
    ODMXMLFileName=(String)key;
    Integer fileID=(Integer)value;
    fId=fileID.intValue();
  }
  System.out.println("String_Node_Str" + generalFileDir + ODMXMLFileName);
  String xsltPath=SQLInitServlet.getField("String_Node_Str") + "String_Node_Str" + File.separator+ epBean.getFileName();
  System.out.println("String_Node_Str" + xsltPath);
  String xmlFilePath=generalFileDir + ODMXMLFileName;
  SimpleTrigger simpleTrigger=xsltService.generateXsltTrigger(xsltPath,xmlFilePath,generalFileDir + epBean.getFileLocation() + File.separator,resolveExportFilePath(epBean),dsBean.getId(),epBean,userBean);
  scheduler=getScheduler(request);
  JobDetailBean jobDetailBean=new JobDetailBean();
  jobDetailBean.setGroup(xsltService.TRIGGER_GROUP_NAME);
  jobDetailBean.setName(simpleTrigger.getName());
  jobDetailBean.setJobClass(org.akaza.openclinica.job.XsltStatefulJob.class);
  jobDetailBean.setJobDataMap(simpleTrigger.getJobDataMap());
  jobDetailBean.setDurability(true);
  jobDetailBean.setVolatility(false);
  try {
    Date dateStart=scheduler.scheduleJob(jobDetailBean,simpleTrigger);
    System.out.println("String_Node_Str" + dateStart.toString());
  }
 catch (  SchedulerException se) {
    se.printStackTrace();
  }
  request.setAttribute("String_Node_Str",datasetId);
  request.getSession().setAttribute("String_Node_Str",jobDetailBean.getName());
  request.getSession().setAttribute("String_Node_Str",simpleTrigger.getGroup());
  request.getSession().setAttribute("String_Node_Str",new Integer(dsBean.getId()));
  return map;
}

Fixed version (ground truth):
/** 
 * process the page from whence you came, i.e. extract a dataset
 * @param id, the id of the extract properties bean, gained from Core Resources
 * @param datasetId, the id of the dataset, found through DatasetDAO
 * @param request, http request
 * @return model map, but more importantly, creates a quartz job which runs right away and generates all output there
 */
@RequestMapping(method=RequestMethod.GET) public ModelMap processSubmit(@RequestParam("String_Node_Str") String id,@RequestParam("String_Node_Str") String datasetId,HttpServletRequest request){
  ModelMap map=new ModelMap();
  System.out.println("String_Node_Str" + id + "String_Node_Str"+ datasetId);
  datasetDao=new DatasetDAO(dataSource);
  UserAccountBean userBean=(UserAccountBean)request.getSession().getAttribute("String_Node_Str");
  ExtractPropertyBean epBean=CoreResources.findExtractPropertyBeanById(new Integer(id).intValue());
  DatasetBean dsBean=(DatasetBean)datasetDao.findByPK(new Integer(datasetId).intValue());
  XsltTriggerService xsltService=new XsltTriggerService();
  String generalFileDir=SQLInitServlet.getField("String_Node_Str");
  String pattern="String_Node_Str" + File.separator + "String_Node_Str"+ File.separator+ "String_Node_Str"+ File.separator+ "String_Node_Str"+ File.separator;
  SimpleDateFormat sdfDir=new SimpleDateFormat(pattern);
  generalFileDir=generalFileDir + "String_Node_Str" + File.separator+ dsBean.getId()+ File.separator+ sdfDir.format(new java.util.Date());
  dsBean.setName(dsBean.getName().replaceAll("String_Node_Str","String_Node_Str"));
  System.out.println("String_Node_Str" + generalFileDir);
  String xsltPath=SQLInitServlet.getField("String_Node_Str") + "String_Node_Str" + File.separator+ epBean.getFileName();
  System.out.println("String_Node_Str" + xsltPath);
  SimpleTrigger simpleTrigger=xsltService.generateXsltTrigger(xsltPath,generalFileDir,generalFileDir + epBean.getFileLocation() + File.separator,resolveExportFilePath(epBean),dsBean.getId(),epBean,userBean);
  scheduler=getScheduler(request);
  JobDetailBean jobDetailBean=new JobDetailBean();
  jobDetailBean.setGroup(xsltService.TRIGGER_GROUP_NAME);
  jobDetailBean.setName(simpleTrigger.getName());
  jobDetailBean.setJobClass(org.akaza.openclinica.job.XsltStatefulJob.class);
  jobDetailBean.setJobDataMap(simpleTrigger.getJobDataMap());
  jobDetailBean.setDurability(true);
  jobDetailBean.setVolatility(false);
  try {
    Date dateStart=scheduler.scheduleJob(jobDetailBean,simpleTrigger);
    System.out.println("String_Node_Str" + dateStart.toString());
  }
 catch (  SchedulerException se) {
    se.printStackTrace();
  }
  request.setAttribute("String_Node_Str",datasetId);
  request.getSession().setAttribute("String_Node_Str",jobDetailBean.getName());
  request.getSession().setAttribute("String_Node_Str",simpleTrigger.getGroup());
  request.getSession().setAttribute("String_Node_Str",new Integer(dsBean.getId()));
  return map;
}