Program: 16312
Project: 16312
Buggy source:
@Override public void documentEnd(){
  if (currentChain != null) {
    currentChain.addGroup(currentGroup);
    if (isKnownChain(currentChain.getId(),currentModel) == null) {
      currentModel.add(currentChain);
    }
  }
 else   if (!params.isHeaderOnly()) {
    logger.warn("String_Node_Str");
  }
  allModels.add(currentModel);
  initMaps();
  for (  StructAsym asym : structAsyms) {
    logger.debug("String_Node_Str",asym.getEntity_id(),asym.getId());
    Chain s=getEntityChain(asym.getEntity_id());
    Chain seqres=(Chain)s.clone();
    seqres=removeSeqResHeterogeneity(seqres);
    seqres.setId(asym.getId());
    if (asymId2authorId.get(asym.getId()) != null) {
      seqres.setName(asymId2authorId.get(asym.getId()));
    }
 else {
      seqres.setName(asym.getId());
    }
    EntityType type=null;
    try {
      Entity ent=getEntity(Integer.parseInt(asym.getEntity_id()));
      type=EntityType.entityTypeFromString(ent.getType());
    }
 catch (    NumberFormatException e) {
      logger.debug("String_Node_Str",asym.getEntity_id());
    }
    if (type == null || (type != null && type == EntityType.POLYMER)) {
      seqResChains.add(seqres);
    }
    logger.debug("String_Node_Str" + asym.getId() + "String_Node_Str"+ seqres+ "String_Node_Str");
    addEntities(asym);
  }
  if (structAsyms.isEmpty()) {
    logger.warn("String_Node_Str");
  }
  linkEntities();
  for (  List<Chain> model : allModels) {
    structure.addModel(model);
  }
  if (params.isAlignSeqRes() && !params.isHeaderOnly()) {
    logger.debug("String_Node_Str");
    alignSeqRes();
  }
 else {
    logger.debug("String_Node_Str");
    SeqRes2AtomAligner.storeUnAlignedSeqRes(structure,seqResChains,params.isHeaderOnly());
  }
  StructureTools.cleanUpAltLocs(structure);
  if (!params.isHeaderOnly()) {
    if (params.shouldCreateAtomBonds()) {
      addBonds();
    }
    if (params.shouldCreateAtomCharges()) {
      addCharges();
    }
  }
  if (!params.isHeaderOnly()) {
    addSites();
  }
  if (params.isParseBioAssembly()) {
    Map<Integer,BioAssemblyInfo> bioAssemblies=new HashMap<Integer,BioAssemblyInfo>();
    for (    PdbxStructAssembly psa : strucAssemblies) {
      List<PdbxStructAssemblyGen> psags=new ArrayList<PdbxStructAssemblyGen>(1);
      for (      PdbxStructAssemblyGen psag : strucAssemblyGens) {
        if (psag.getAssembly_id().equals(psa.getId())) {
          psags.add(psag);
        }
      }
      BiologicalAssemblyBuilder builder=new BiologicalAssemblyBuilder();
      List<BiologicalAssemblyTransformation> transformations=builder.getBioUnitTransformationList(psa,psags,structOpers);
      int bioAssemblyId=-1;
      try {
        bioAssemblyId=Integer.parseInt(psa.getId());
      }
 catch (      NumberFormatException e) {
        logger.info("String_Node_Str",psa.getId());
      }
      if (bioAssemblyId != -1) {
        int mmSize=0;
        for (        BiologicalAssemblyTransformation transf : transformations) {
          Chain c=structure.getChain(transf.getChainId());
          if (c == null) {
            logger.warn("String_Node_Str",transf.getChainId());
            continue;
          }
          if (c.getEntityType() == EntityType.POLYMER && !c.getEntityInfo().getDescription().contains("String_Node_Str")) {
            mmSize++;
          }
        }
        BioAssemblyInfo bioAssembly=new BioAssemblyInfo();
        bioAssembly.setId(bioAssemblyId);
        bioAssembly.setMacromolecularSize(mmSize);
        bioAssembly.setTransforms(transformations);
        bioAssemblies.put(bioAssemblyId,bioAssembly);
      }
    }
    structure.getPDBHeader().setBioAssemblies(bioAssemblies);
  }
  setStructNcsOps();
  Map<String,List<SeqMisMatch>> misMatchMap=new HashMap<String,List<SeqMisMatch>>();
  for (  StructRefSeqDif sdif : sequenceDifs) {
    SeqMisMatch misMatch=new SeqMisMatchImpl();
    misMatch.setDetails(sdif.getDetails());
    String insCode=sdif.getPdbx_pdb_ins_code();
    if (insCode != null && insCode.equals("String_Node_Str"))     insCode=null;
    misMatch.setInsCode(insCode);
    misMatch.setOrigGroup(sdif.getDb_mon_id());
    misMatch.setPdbGroup(sdif.getMon_id());
    misMatch.setPdbResNum(sdif.getPdbx_auth_seq_num());
    misMatch.setUniProtId(sdif.getPdbx_seq_db_accession_code());
    misMatch.setSeqNum(sdif.getSeq_num());
    List<SeqMisMatch> mms=misMatchMap.get(sdif.getPdbx_pdb_strand_id());
    if (mms == null) {
      mms=new ArrayList<SeqMisMatch>();
      misMatchMap.put(sdif.getPdbx_pdb_strand_id(),mms);
    }
    mms.add(misMatch);
  }
  for (  String chainId : misMatchMap.keySet()) {
    Chain chain=structure.getPolyChainByPDB(chainId);
    if (chain == null) {
      logger.warn("String_Node_Str" + chainId);
      continue;
    }
    chain.setSeqMisMatches(misMatchMap.get(chainId));
  }
}

Fixed version (ground truth):
@Override public void documentEnd(){
  if (currentChain != null) {
    currentChain.addGroup(currentGroup);
    if (isKnownChain(currentChain.getId(),currentModel) == null) {
      currentModel.add(currentChain);
    }
  }
 else   if (!params.isHeaderOnly()) {
    logger.warn("String_Node_Str");
  }
  allModels.add(currentModel);
  initMaps();
  for (  StructAsym asym : structAsyms) {
    logger.debug("String_Node_Str",asym.getEntity_id(),asym.getId());
    Chain s=getEntityChain(asym.getEntity_id());
    Chain seqres=(Chain)s.clone();
    seqres=removeSeqResHeterogeneity(seqres);
    seqres.setId(asym.getId());
    if (asymId2authorId.get(asym.getId()) != null) {
      seqres.setName(asymId2authorId.get(asym.getId()));
    }
 else {
      seqres.setName(asym.getId());
    }
    EntityType type=null;
    try {
      Entity ent=getEntity(Integer.parseInt(asym.getEntity_id()));
      type=EntityType.entityTypeFromString(ent.getType());
    }
 catch (    NumberFormatException e) {
      logger.debug("String_Node_Str",asym.getEntity_id());
    }
    if (type == null || type == EntityType.POLYMER) {
      seqResChains.add(seqres);
    }
    logger.debug("String_Node_Str" + asym.getId() + "String_Node_Str"+ seqres+ "String_Node_Str");
    addEntities(asym);
  }
  if (structAsyms.isEmpty()) {
    logger.warn("String_Node_Str");
  }
  linkEntities();
  for (  List<Chain> model : allModels) {
    structure.addModel(model);
  }
  if (params.isAlignSeqRes() && !params.isHeaderOnly()) {
    logger.debug("String_Node_Str");
    alignSeqRes();
  }
 else {
    logger.debug("String_Node_Str");
    SeqRes2AtomAligner.storeUnAlignedSeqRes(structure,seqResChains,params.isHeaderOnly());
  }
  StructureTools.cleanUpAltLocs(structure);
  if (!params.isHeaderOnly()) {
    if (params.shouldCreateAtomBonds()) {
      addBonds();
    }
    if (params.shouldCreateAtomCharges()) {
      addCharges();
    }
  }
  if (!params.isHeaderOnly()) {
    addSites();
  }
  if (params.isParseBioAssembly()) {
    Map<Integer,BioAssemblyInfo> bioAssemblies=new HashMap<Integer,BioAssemblyInfo>();
    for (    PdbxStructAssembly psa : strucAssemblies) {
      List<PdbxStructAssemblyGen> psags=new ArrayList<PdbxStructAssemblyGen>(1);
      for (      PdbxStructAssemblyGen psag : strucAssemblyGens) {
        if (psag.getAssembly_id().equals(psa.getId())) {
          psags.add(psag);
        }
      }
      BiologicalAssemblyBuilder builder=new BiologicalAssemblyBuilder();
      List<BiologicalAssemblyTransformation> transformations=builder.getBioUnitTransformationList(psa,psags,structOpers);
      int bioAssemblyId=-1;
      try {
        bioAssemblyId=Integer.parseInt(psa.getId());
      }
 catch (      NumberFormatException e) {
        logger.info("String_Node_Str",psa.getId());
      }
      if (bioAssemblyId != -1) {
        int mmSize=0;
        for (        BiologicalAssemblyTransformation transf : transformations) {
          Chain c=structure.getChain(transf.getChainId());
          if (c == null) {
            logger.warn("String_Node_Str",transf.getChainId());
            continue;
          }
          if (c.getEntityType() == EntityType.POLYMER && !c.getEntityInfo().getDescription().contains("String_Node_Str")) {
            mmSize++;
          }
        }
        BioAssemblyInfo bioAssembly=new BioAssemblyInfo();
        bioAssembly.setId(bioAssemblyId);
        bioAssembly.setMacromolecularSize(mmSize);
        bioAssembly.setTransforms(transformations);
        bioAssemblies.put(bioAssemblyId,bioAssembly);
      }
    }
    structure.getPDBHeader().setBioAssemblies(bioAssemblies);
  }
  setStructNcsOps();
  Map<String,List<SeqMisMatch>> misMatchMap=new HashMap<String,List<SeqMisMatch>>();
  for (  StructRefSeqDif sdif : sequenceDifs) {
    SeqMisMatch misMatch=new SeqMisMatchImpl();
    misMatch.setDetails(sdif.getDetails());
    String insCode=sdif.getPdbx_pdb_ins_code();
    if (insCode != null && insCode.equals("String_Node_Str"))     insCode=null;
    misMatch.setInsCode(insCode);
    misMatch.setOrigGroup(sdif.getDb_mon_id());
    misMatch.setPdbGroup(sdif.getMon_id());
    misMatch.setPdbResNum(sdif.getPdbx_auth_seq_num());
    misMatch.setUniProtId(sdif.getPdbx_seq_db_accession_code());
    misMatch.setSeqNum(sdif.getSeq_num());
    List<SeqMisMatch> mms=misMatchMap.get(sdif.getPdbx_pdb_strand_id());
    if (mms == null) {
      mms=new ArrayList<SeqMisMatch>();
      misMatchMap.put(sdif.getPdbx_pdb_strand_id(),mms);
    }
    mms.add(misMatch);
  }
  for (  String chainId : misMatchMap.keySet()) {
    Chain chain=structure.getPolyChainByPDB(chainId);
    if (chain == null) {
      logger.warn("String_Node_Str" + chainId);
      continue;
    }
    chain.setSeqMisMatches(misMatchMap.get(chainId));
  }
}