Program: 51955
Project: 51955
Buggy source:
/** 
 * Render the METS file section. This will contain a list of all bitstreams in the item. Each bundle, even those that are not typically displayed will be listed. Example: <fileSec> <fileGrp USE="CONTENT"> <file ... > <fLocate ... > </file> </fileGrp> <fileGrp USE="TEXT"> <file ... > <fLocate ... > </file> </fileGrp> </fileSec>
 */
@Override protected void renderFileSection(Context context) throws SQLException, SAXException {
  AttributeMap attributes;
  startElement(METS,"String_Node_Str");
  List<Bundle> bundles=findEnabledBundles();
  Boolean showLicense=ConfigurationManager.getBooleanProperty("String_Node_Str");
  for (  Bundle bundle : bundles) {
    String use=bundle.getName();
    boolean isContentBundle=false;
    boolean isDerivedBundle=false;
    if ("String_Node_Str".equals(use)) {
      use="String_Node_Str";
      isContentBundle=true;
    }
    if ("String_Node_Str".equals(bundle.getName()) || "String_Node_Str".equals(bundle.getName())) {
      isDerivedBundle=true;
    }
    if ("String_Node_Str".equals(bundle.getName()) && !showLicense) {
      continue;
    }
    attributes=new AttributeMap();
    attributes.put("String_Node_Str",use);
    startElement(METS,"String_Node_Str",attributes);
    for (    Bitstream bitstream : bundle.getBitstreams()) {
      String fileID=getFileID(bitstream);
      Bitstream originalBitstream=null;
      if (isDerivedBundle) {
        originalBitstream=findOriginalBitstream(item,bitstream);
      }
      String groupID=getGroupFileID((originalBitstream == null) ? bitstream : originalBitstream);
      String admIDs=null;
      if (fileAmdSecIDs.containsKey(fileID)) {
        admIDs=fileAmdSecIDs.get(fileID).toString();
      }
      renderFileWithAllowed(item,bitstream,fileID,groupID,admIDs);
      if (isContentBundle) {
        contentBitstreams.add(bitstream);
        if (bundle.getPrimaryBitstream() != null && bundle.getBitstreams().equals(bitstream)) {
          primaryBitstream=bitstream;
        }
      }
    }
    endElement(METS,"String_Node_Str");
  }
  endElement(METS,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Render the METS file section. This will contain a list of all bitstreams in the item. Each bundle, even those that are not typically displayed will be listed. Example: <fileSec> <fileGrp USE="CONTENT"> <file ... > <fLocate ... > </file> </fileGrp> <fileGrp USE="TEXT"> <file ... > <fLocate ... > </file> </fileGrp> </fileSec>
 */
@Override protected void renderFileSection(Context context) throws SQLException, SAXException {
  AttributeMap attributes;
  startElement(METS,"String_Node_Str");
  List<Bundle> bundles=findEnabledBundles();
  Boolean showLicense=ConfigurationManager.getBooleanProperty("String_Node_Str");
  for (  Bundle bundle : bundles) {
    String use=bundle.getName();
    boolean isContentBundle=false;
    boolean isDerivedBundle=false;
    if ("String_Node_Str".equals(use)) {
      use="String_Node_Str";
      isContentBundle=true;
    }
    if ("String_Node_Str".equals(bundle.getName()) || "String_Node_Str".equals(bundle.getName())) {
      isDerivedBundle=true;
    }
    if ("String_Node_Str".equals(bundle.getName()) && !showLicense) {
      continue;
    }
    attributes=new AttributeMap();
    attributes.put("String_Node_Str",use);
    startElement(METS,"String_Node_Str",attributes);
    for (    Bitstream bitstream : bundle.getBitstreams()) {
      String fileID=getFileID(bitstream);
      Bitstream originalBitstream=null;
      if (isDerivedBundle) {
        originalBitstream=findOriginalBitstream(item,bitstream);
      }
      String groupID=getGroupFileID((originalBitstream == null) ? bitstream : originalBitstream);
      String admIDs=null;
      if (fileAmdSecIDs.containsKey(fileID)) {
        admIDs=fileAmdSecIDs.get(fileID).toString();
      }
      renderFileWithAllowed(item,bitstream,fileID,groupID,admIDs);
      if (isContentBundle) {
        contentBitstreams.add(bitstream);
        if (bundle.getPrimaryBitstream() != null && bundle.getPrimaryBitstream().equals(bitstream)) {
          primaryBitstream=bitstream;
        }
      }
    }
    endElement(METS,"String_Node_Str");
  }
  endElement(METS,"String_Node_Str");
}