Program: 52165
Project: 52165
Buggy source:
/** 
 * If the user has any workflow tasks, either assigned to them or in an available pool of tasks, then build two tables listing each of these queues. If the user dosn't have any workflows then don't do anything.
 * @param division The division to add the two queues too.
 */
private void addWorkflowTasks(Division division) throws SQLException, WingException, AuthorizeException, IOException {
  @SuppressWarnings("String_Node_Str") java.util.List<ClaimedTask> ownedItems=ClaimedTask.findByEperson(context,context.getCurrentUser().getID());
  @SuppressWarnings("String_Node_Str") java.util.List<PoolTask> pooledItems=PoolTask.findByEperson(context,context.getCurrentUser().getID());
  if (!(ownedItems.size() > 0 || pooledItems.size() > 0))   return;
  Division workflow=division.addDivision("String_Node_Str");
  workflow.setHead(T_w_head1);
  workflow.addPara(T_w_info1);
  Table table=workflow.addTable("String_Node_Str",ownedItems.size() + 2,5);
  table.setHead(T_w_head2);
  Row header=table.addRow(Row.ROLE_HEADER);
  header.addCellContent(T_w_column1);
  header.addCellContent(T_w_column2);
  header.addCellContent(T_w_column3);
  header.addCellContent(T_w_column4);
  header.addCellContent(T_w_column5);
  boolean showReturnToPoolButton=false;
  if (ownedItems.size() > 0) {
    for (    ClaimedTask owned : ownedItems) {
      int workflowItemID=owned.getWorkflowItemID();
      String step_id=owned.getStepID();
      String action_id=owned.getActionID();
      XmlWorkflowItem item=null;
      try {
        item=XmlWorkflowItem.find(context,workflowItemID);
        Workflow wf=WorkflowFactory.getWorkflow(item.getCollection());
        Step step=wf.getStep(step_id);
        WorkflowActionConfig action=step.getActionConfig(action_id);
        String url=contextPath + "String_Node_Str" + item.getCollection().getHandle()+ "String_Node_Str"+ workflowItemID+ "String_Node_Str"+ step_id+ "String_Node_Str"+ action_id;
        DCValue[] titles=item.getItem().getDC("String_Node_Str",null,Item.ANY);
        String collectionName=item.getCollection().getMetadata("String_Node_Str");
        EPerson submitter=item.getSubmitter();
        String submitterName=submitter.getFullName();
        String submitterEmail=submitter.getEmail();
        boolean taskHasPool=step.getUserSelectionMethod().getProcessingAction().usesTaskPool();
        if (taskHasPool) {
          showReturnToPoolButton=true;
        }
        Row row=table.addRow();
        Cell firstCell=row.addCell();
        if (taskHasPool) {
          CheckBox remove=firstCell.addCheckBox("String_Node_Str");
          remove.setLabel("String_Node_Str");
          remove.addOption(workflowItemID + "String_Node_Str" + step.getId());
        }
        row.addCell().addXref(url,message("String_Node_Str" + wf.getID() + "String_Node_Str"+ step_id+ "String_Node_Str"+ action_id));
        if (titles != null && titles.length > 0) {
          String displayTitle=titles[0].value;
          if (displayTitle.length() > 50)           displayTitle=displayTitle.substring(0,50) + "String_Node_Str";
          row.addCell().addXref(url,displayTitle);
        }
 else         row.addCell().addXref(url,T_untitled);
        row.addCell().addXref(url,collectionName);
        Cell cell=row.addCell();
        cell.addContent(T_email);
        cell.addXref("String_Node_Str" + submitterEmail,submitterName);
      }
 catch (      WorkflowConfigurationException e) {
        Row row=table.addRow();
        row.addCell().addContent("String_Node_Str");
        log.error(LogManager.getHeader(context,"String_Node_Str","String_Node_Str"),e);
      }
catch (      Exception e) {
        log.error(LogManager.getHeader(context,"String_Node_Str","String_Node_Str"),e);
      }
    }
    if (showReturnToPoolButton) {
      Row row=table.addRow();
      row.addCell(0,5).addButton("String_Node_Str").setValue(T_w_submit_return);
    }
  }
 else {
    Row row=table.addRow();
    row.addCell(0,5).addHighlight("String_Node_Str").addContent(T_w_info2);
  }
  table=workflow.addTable("String_Node_Str",pooledItems.size() + 2,5);
  table.setHead(T_w_head3);
  header=table.addRow(Row.ROLE_HEADER);
  header.addCellContent(T_w_column2);
  header.addCellContent(T_w_column3);
  header.addCellContent(T_w_column4);
  header.addCellContent(T_w_column5);
  if (pooledItems.size() > 0) {
    for (    PoolTask pooled : pooledItems) {
      String step_id=pooled.getStepID();
      int workflowItemID=pooled.getWorkflowItemID();
      String action_id=pooled.getActionID();
      XmlWorkflowItem item;
      try {
        item=XmlWorkflowItem.find(context,workflowItemID);
        Workflow wf=WorkflowFactory.getWorkflow(item.getCollection());
        Step step=wf.getStep(step_id);
        String url=contextPath + "String_Node_Str" + item.getCollection().getHandle()+ "String_Node_Str"+ workflowItemID+ "String_Node_Str"+ step_id+ "String_Node_Str"+ action_id;
        DCValue[] titles=item.getItem().getDC("String_Node_Str",null,Item.ANY);
        String collectionName=item.getCollection().getMetadata("String_Node_Str");
        EPerson submitter=item.getSubmitter();
        String submitterName=submitter.getFullName();
        String submitterEmail=submitter.getEmail();
        Row row=table.addRow();
        row.addCell().addXref(url,message("String_Node_Str" + wf.getID() + "String_Node_Str"+ step_id+ "String_Node_Str"+ action_id));
        if (titles != null && titles.length > 0) {
          String displayTitle=titles[0].value;
          if (displayTitle.length() > 50)           displayTitle=displayTitle.substring(0,50) + "String_Node_Str";
          row.addCell().addXref(url,displayTitle);
        }
 else         row.addCell().addXref(url,T_untitled);
        row.addCell().addXref(url,collectionName);
        Cell cell=row.addCell();
        cell.addContent(T_email);
        cell.addXref("String_Node_Str" + submitterEmail,submitterName);
      }
 catch (      WorkflowConfigurationException e) {
        Row row=table.addRow();
        row.addCell().addContent("String_Node_Str");
        log.error(LogManager.getHeader(context,"String_Node_Str","String_Node_Str"),e);
      }
catch (      Exception e) {
        log.error(LogManager.getHeader(context,"String_Node_Str","String_Node_Str"),e);
      }
    }
  }
 else {
    Row row=table.addRow();
    row.addCell(0,4).addHighlight("String_Node_Str").addContent(T_w_info3);
  }
}

Fixed version (ground truth):
/** 
 * If the user has any workflow tasks, either assigned to them or in an available pool of tasks, then build two tables listing each of these queues. If the user dosn't have any workflows then don't do anything.
 * @param division The division to add the two queues too.
 */
private void addWorkflowTasks(Division division) throws SQLException, WingException, AuthorizeException, IOException {
  @SuppressWarnings("String_Node_Str") java.util.List<ClaimedTask> ownedItems=ClaimedTask.findByEperson(context,context.getCurrentUser().getID());
  @SuppressWarnings("String_Node_Str") java.util.List<PoolTask> pooledItems=PoolTask.findByEperson(context,context.getCurrentUser().getID());
  if (!(ownedItems.size() > 0 || pooledItems.size() > 0))   return;
  Division workflow=division.addDivision("String_Node_Str");
  workflow.setHead(T_w_head1);
  workflow.addPara(T_w_info1);
  Table table=workflow.addTable("String_Node_Str",ownedItems.size() + 2,5);
  table.setHead(T_w_head2);
  Row header=table.addRow(Row.ROLE_HEADER);
  header.addCellContent(T_w_column1);
  header.addCellContent(T_w_column2);
  header.addCellContent(T_w_column3);
  header.addCellContent(T_w_column4);
  header.addCellContent(T_w_column5);
  boolean showReturnToPoolButton=false;
  if (ownedItems.size() > 0) {
    for (    ClaimedTask owned : ownedItems) {
      int workflowItemID=owned.getWorkflowItemID();
      String step_id=owned.getStepID();
      String action_id=owned.getActionID();
      XmlWorkflowItem item=null;
      try {
        item=XmlWorkflowItem.find(context,workflowItemID);
        Workflow wf=WorkflowFactory.getWorkflow(item.getCollection());
        Step step=wf.getStep(step_id);
        WorkflowActionConfig action=step.getActionConfig(action_id);
        String url=contextPath + "String_Node_Str" + item.getCollection().getHandle()+ "String_Node_Str"+ workflowItemID+ "String_Node_Str"+ step_id+ "String_Node_Str"+ action_id;
        DCValue[] titles=item.getItem().getDC("String_Node_Str",null,Item.ANY);
        String collectionName=item.getCollection().getMetadata("String_Node_Str");
        EPerson submitter=item.getSubmitter();
        String submitterName=submitter.getFullName();
        String submitterEmail=submitter.getEmail();
        boolean taskHasPool=step.getUserSelectionMethod().getProcessingAction().usesTaskPool();
        if (taskHasPool) {
          showReturnToPoolButton=true;
        }
        Row row=table.addRow();
        Cell firstCell=row.addCell();
        if (taskHasPool) {
          CheckBox remove=firstCell.addCheckBox("String_Node_Str");
          remove.setLabel("String_Node_Str");
          remove.addOption(workflowItemID + "String_Node_Str" + step.getId());
        }
        row.addCell().addXref(url,message("String_Node_Str" + wf.getID() + "String_Node_Str"+ step_id+ "String_Node_Str"+ action_id));
        if (titles != null && titles.length > 0) {
          String displayTitle=titles[0].value;
          if (displayTitle.length() > 50)           displayTitle=displayTitle.substring(0,50) + "String_Node_Str";
          row.addCell().addXref(url,displayTitle);
        }
 else         row.addCell().addXref(url,T_untitled);
        row.addCell().addXref(url,collectionName);
        Cell cell=row.addCell();
        cell.addContent(T_email);
        cell.addXref("String_Node_Str" + submitterEmail,submitterName);
      }
 catch (      WorkflowConfigurationException e) {
        Row row=table.addRow();
        row.addCell().addContent("String_Node_Str");
        log.error(LogManager.getHeader(context,"String_Node_Str","String_Node_Str"),e);
      }
catch (      Exception e) {
        log.error(LogManager.getHeader(context,"String_Node_Str","String_Node_Str"),e);
      }
    }
    if (showReturnToPoolButton) {
      Row row=table.addRow();
      row.addCell(0,5).addButton("String_Node_Str").setValue(T_w_submit_return);
    }
  }
 else {
    Row row=table.addRow();
    row.addCell(0,5).addHighlight("String_Node_Str").addContent(T_w_info2);
  }
  table=workflow.addTable("String_Node_Str",pooledItems.size() + 2,5);
  table.setHead(T_w_head3);
  header=table.addRow(Row.ROLE_HEADER);
  header.addCellContent(T_w_column1);
  header.addCellContent(T_w_column2);
  header.addCellContent(T_w_column3);
  header.addCellContent(T_w_column4);
  header.addCellContent(T_w_column5);
  if (pooledItems.size() > 0) {
    for (    PoolTask pooled : pooledItems) {
      String step_id=pooled.getStepID();
      int workflowItemID=pooled.getWorkflowItemID();
      String action_id=pooled.getActionID();
      XmlWorkflowItem item;
      try {
        item=XmlWorkflowItem.find(context,workflowItemID);
        Workflow wf=WorkflowFactory.getWorkflow(item.getCollection());
        String url=contextPath + "String_Node_Str" + item.getCollection().getHandle()+ "String_Node_Str"+ workflowItemID+ "String_Node_Str"+ step_id+ "String_Node_Str"+ action_id;
        DCValue[] titles=item.getItem().getDC("String_Node_Str",null,Item.ANY);
        String collectionName=item.getCollection().getMetadata("String_Node_Str");
        EPerson submitter=item.getSubmitter();
        String submitterName=submitter.getFullName();
        String submitterEmail=submitter.getEmail();
        Row row=table.addRow();
        CheckBox claimTask=row.addCell().addCheckBox("String_Node_Str");
        claimTask.setLabel("String_Node_Str");
        claimTask.addOption(workflowItemID);
        row.addCell().addXref(url,message("String_Node_Str" + wf.getID() + "String_Node_Str"+ step_id+ "String_Node_Str"+ action_id));
        if (titles != null && titles.length > 0) {
          String displayTitle=titles[0].value;
          if (displayTitle.length() > 50)           displayTitle=displayTitle.substring(0,50) + "String_Node_Str";
          row.addCell().addXref(url,displayTitle);
        }
 else         row.addCell().addXref(url,T_untitled);
        row.addCell().addXref(url,collectionName);
        Cell cell=row.addCell();
        cell.addContent(T_email);
        cell.addXref("String_Node_Str" + submitterEmail,submitterName);
      }
 catch (      WorkflowConfigurationException e) {
        Row row=table.addRow();
        row.addCell().addContent("String_Node_Str");
        log.error(LogManager.getHeader(context,"String_Node_Str","String_Node_Str"),e);
      }
catch (      Exception e) {
        log.error(LogManager.getHeader(context,"String_Node_Str","String_Node_Str"),e);
      }
    }
    Row row=table.addRow();
    row.addCell(0,5).addButton("String_Node_Str").setValue(T_w_submit_take);
  }
 else {
    Row row=table.addRow();
    row.addCell(0,4).addHighlight("String_Node_Str").addContent(T_w_info3);
  }
}