Program: 51954
Project: 51954
Buggy source:
public void addBody(Body body) throws SAXException, WingException, UIException, SQLException, IOException, AuthorizeException {
  if (this.editFile != null) {
    editFile.addBody(body);
    return;
  }
 else   if (editBitstreamPolicies != null && isAdvancedFormEnabled) {
    editBitstreamPolicies.addBody(body);
    return;
  }
 else   if (editPolicy != null && isAdvancedFormEnabled) {
    editPolicy.addBody(body);
    return;
  }
  Item item=submission.getItem();
  Collection collection=submission.getCollection();
  String actionURL=contextPath + "String_Node_Str" + collection.getHandle()+ "String_Node_Str"+ knot.getId()+ "String_Node_Str";
  boolean disableFileEditing=(submissionInfo.isInWorkflow()) && !ConfigurationManager.getBooleanProperty("String_Node_Str","String_Node_Str");
  java.util.List<Bundle> bundles=itemService.getBundles(item,"String_Node_Str");
  java.util.List<Bitstream> bitstreams=new ArrayList<>();
  if (bundles.size() > 0) {
    bitstreams=bundles.get(0).getBitstreams();
  }
  Division div=body.addInteractiveDivision("String_Node_Str",actionURL,Division.METHOD_MULTIPART,"String_Node_Str");
  div.setHead(T_submission_head);
  addSubmissionProgressList(div);
  List upload=null;
  if (!disableFileEditing) {
    upload=div.addList("String_Node_Str",List.TYPE_FORM);
    upload.setHead(T_head);
    File file=upload.addItem().addFile("String_Node_Str");
    file.setLabel(T_file);
    file.setHelp(T_file_help);
    file.setRequired();
    if (this.errorFlag == org.dspace.submit.step.UploadWithEmbargoStep.STATUS_NO_FILES_ERROR) {
      file.addError(T_file_error);
    }
    if (this.errorFlag == org.dspace.submit.step.UploadWithEmbargoStep.STATUS_UPLOAD_ERROR) {
      file.addError(T_upload_error);
    }
    if (this.errorFlag == org.dspace.submit.step.UploadWithEmbargoStep.STATUS_VIRUS_CHECKER_UNAVAILABLE) {
      file.addError(T_virus_checker_error);
    }
    if (this.errorFlag == org.dspace.submit.step.UploadWithEmbargoStep.STATUS_CONTAINS_VIRUS) {
      file.addError(T_virus_error);
    }
    Text description=upload.addItem().addText("String_Node_Str");
    description.setLabel(T_description);
    description.setHelp(T_description_help);
    if (!isAdvancedFormEnabled) {
      AccessStepUtil asu=new AccessStepUtil(context);
      asu.addEmbargoDateSimpleForm(item,upload,errorFlag);
      asu.addReason(null,upload,errorFlag);
    }
    Button uploadSubmit=upload.addItem().addButton("String_Node_Str");
    uploadSubmit.setValue(T_submit_upload);
  }
  make_sherpaRomeo_submission(item,div);
  if (bitstreams.size() > 0 || disableFileEditing) {
    Table summary=div.addTable("String_Node_Str",(bitstreams.size() * 2) + 2,7);
    summary.setHead(T_head2);
    Row header=summary.addRow(Row.ROLE_HEADER);
    header.addCellContent(T_column0);
    header.addCellContent(T_column1);
    header.addCellContent(T_column2);
    header.addCellContent(T_column3);
    header.addCellContent(T_column4);
    header.addCellContent(T_column5);
    header.addCellContent(T_column6);
    for (    Bitstream bitstream : bitstreams) {
      UUID id=bitstream.getID();
      String name=bitstream.getName();
      String url=makeBitstreamLink(item,bitstream);
      long bytes=bitstream.getSize();
      String desc=bitstream.getDescription();
      String algorithm=bitstream.getChecksumAlgorithm();
      String checksum=bitstream.getChecksum();
      Row row=summary.addRow();
      Radio primary=row.addCell().addRadio("String_Node_Str");
      primary.addOption(String.valueOf(id));
      if (bundles.get(0).getPrimaryBitstream() != null && bundles.get(0).getPrimaryBitstream().equals(id)) {
        primary.setOptionSelected(String.valueOf(id));
      }
      if (!disableFileEditing) {
        CheckBox remove=row.addCell().addCheckBox("String_Node_Str");
        remove.setLabel("String_Node_Str");
        remove.addOption(id.toString());
      }
 else {
        row.addCell();
      }
      row.addCell().addXref(url,name);
      row.addCellContent(bytes + "String_Node_Str");
      if (desc == null || desc.length() == 0) {
        row.addCellContent(T_unknown_name);
      }
 else {
        row.addCellContent(desc);
      }
      BitstreamFormat format=bitstream.getFormat(context);
      if (format == null) {
        row.addCellContent(T_unknown_format);
      }
 else {
        int support=format.getSupportLevel();
        Cell cell=row.addCell();
        cell.addContent(format.getMIMEType());
        cell.addContent("String_Node_Str");
switch (support) {
case 1:
          cell.addContent(T_supported);
        break;
case 2:
      cell.addContent(T_known);
    break;
case 3:
  cell.addContent(T_unsupported);
break;
}
}
Button edit=row.addCell().addButton("String_Node_Str" + id);
edit.setValue(T_submit_edit);
if (isAdvancedFormEnabled) {
Button policy=row.addCell().addButton("String_Node_Str" + id);
policy.setValue(T_submit_policy);
}
Row checksumRow=summary.addRow();
checksumRow.addCell();
Cell checksumCell=checksumRow.addCell(null,null,0,6,null);
checksumCell.addHighlight("String_Node_Str").addContent(T_checksum);
checksumCell.addContent("String_Node_Str");
checksumCell.addContent(algorithm + "String_Node_Str" + checksum);
}
if (!disableFileEditing) {
Row actionRow=summary.addRow();
actionRow.addCell();
Button removeSeleceted=actionRow.addCell(null,null,0,6,null).addButton("String_Node_Str");
removeSeleceted.setValue(T_submit_remove);
}
upload=div.addList("String_Node_Str",List.TYPE_FORM);
}
addControlButtons(upload);
}

Fixed version (ground truth):
public void addBody(Body body) throws SAXException, WingException, UIException, SQLException, IOException, AuthorizeException {
  if (this.editFile != null) {
    editFile.addBody(body);
    return;
  }
 else   if (editBitstreamPolicies != null && isAdvancedFormEnabled) {
    editBitstreamPolicies.addBody(body);
    return;
  }
 else   if (editPolicy != null && isAdvancedFormEnabled) {
    editPolicy.addBody(body);
    return;
  }
  Item item=submission.getItem();
  Collection collection=submission.getCollection();
  String actionURL=contextPath + "String_Node_Str" + collection.getHandle()+ "String_Node_Str"+ knot.getId()+ "String_Node_Str";
  boolean disableFileEditing=(submissionInfo.isInWorkflow()) && !ConfigurationManager.getBooleanProperty("String_Node_Str","String_Node_Str");
  java.util.List<Bundle> bundles=itemService.getBundles(item,"String_Node_Str");
  java.util.List<Bitstream> bitstreams=new ArrayList<>();
  if (bundles.size() > 0) {
    bitstreams=bundles.get(0).getBitstreams();
  }
  Division div=body.addInteractiveDivision("String_Node_Str",actionURL,Division.METHOD_MULTIPART,"String_Node_Str");
  div.setHead(T_submission_head);
  addSubmissionProgressList(div);
  List upload=null;
  if (!disableFileEditing) {
    upload=div.addList("String_Node_Str",List.TYPE_FORM);
    upload.setHead(T_head);
    File file=upload.addItem().addFile("String_Node_Str");
    file.setLabel(T_file);
    file.setHelp(T_file_help);
    file.setRequired();
    if (this.errorFlag == org.dspace.submit.step.UploadWithEmbargoStep.STATUS_NO_FILES_ERROR) {
      file.addError(T_file_error);
    }
    if (this.errorFlag == org.dspace.submit.step.UploadWithEmbargoStep.STATUS_UPLOAD_ERROR) {
      file.addError(T_upload_error);
    }
    if (this.errorFlag == org.dspace.submit.step.UploadWithEmbargoStep.STATUS_VIRUS_CHECKER_UNAVAILABLE) {
      file.addError(T_virus_checker_error);
    }
    if (this.errorFlag == org.dspace.submit.step.UploadWithEmbargoStep.STATUS_CONTAINS_VIRUS) {
      file.addError(T_virus_error);
    }
    Text description=upload.addItem().addText("String_Node_Str");
    description.setLabel(T_description);
    description.setHelp(T_description_help);
    if (!isAdvancedFormEnabled) {
      AccessStepUtil asu=new AccessStepUtil(context);
      asu.addEmbargoDateSimpleForm(item,upload,errorFlag);
      asu.addReason(null,upload,errorFlag);
    }
    Button uploadSubmit=upload.addItem().addButton("String_Node_Str");
    uploadSubmit.setValue(T_submit_upload);
  }
  make_sherpaRomeo_submission(item,div);
  if (bitstreams.size() > 0 || disableFileEditing) {
    Table summary=div.addTable("String_Node_Str",(bitstreams.size() * 2) + 2,7);
    summary.setHead(T_head2);
    Row header=summary.addRow(Row.ROLE_HEADER);
    header.addCellContent(T_column0);
    header.addCellContent(T_column1);
    header.addCellContent(T_column2);
    header.addCellContent(T_column3);
    header.addCellContent(T_column4);
    header.addCellContent(T_column5);
    header.addCellContent(T_column6);
    for (    Bitstream bitstream : bitstreams) {
      UUID id=bitstream.getID();
      String name=bitstream.getName();
      String url=makeBitstreamLink(item,bitstream);
      long bytes=bitstream.getSize();
      String desc=bitstream.getDescription();
      String algorithm=bitstream.getChecksumAlgorithm();
      String checksum=bitstream.getChecksum();
      Row row=summary.addRow();
      Radio primary=row.addCell().addRadio("String_Node_Str");
      primary.addOption(String.valueOf(id));
      if (bundles.get(0).getPrimaryBitstream() != null && bundles.get(0).getPrimaryBitstream().getID().equals(id)) {
        primary.setOptionSelected(String.valueOf(id));
      }
      if (!disableFileEditing) {
        CheckBox remove=row.addCell().addCheckBox("String_Node_Str");
        remove.setLabel("String_Node_Str");
        remove.addOption(id.toString());
      }
 else {
        row.addCell();
      }
      row.addCell().addXref(url,name);
      row.addCellContent(bytes + "String_Node_Str");
      if (desc == null || desc.length() == 0) {
        row.addCellContent(T_unknown_name);
      }
 else {
        row.addCellContent(desc);
      }
      BitstreamFormat format=bitstream.getFormat(context);
      if (format == null) {
        row.addCellContent(T_unknown_format);
      }
 else {
        int support=format.getSupportLevel();
        Cell cell=row.addCell();
        cell.addContent(format.getMIMEType());
        cell.addContent("String_Node_Str");
switch (support) {
case 1:
          cell.addContent(T_supported);
        break;
case 2:
      cell.addContent(T_known);
    break;
case 3:
  cell.addContent(T_unsupported);
break;
}
}
Button edit=row.addCell().addButton("String_Node_Str" + id);
edit.setValue(T_submit_edit);
if (isAdvancedFormEnabled) {
Button policy=row.addCell().addButton("String_Node_Str" + id);
policy.setValue(T_submit_policy);
}
Row checksumRow=summary.addRow();
checksumRow.addCell();
Cell checksumCell=checksumRow.addCell(null,null,0,6,null);
checksumCell.addHighlight("String_Node_Str").addContent(T_checksum);
checksumCell.addContent("String_Node_Str");
checksumCell.addContent(algorithm + "String_Node_Str" + checksum);
}
if (!disableFileEditing) {
Row actionRow=summary.addRow();
actionRow.addCell();
Button removeSeleceted=actionRow.addCell(null,null,0,6,null).addButton("String_Node_Str");
removeSeleceted.setValue(T_submit_remove);
}
upload=div.addList("String_Node_Str",List.TYPE_FORM);
}
addControlButtons(upload);
}