Program: 16415
Project: 16415
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);
  for (  StructAsym asym : structAsyms) {
    logger.debug("String_Node_Str",asym.getEntity_id(),asym.getId());
    asymId2entityId.put(asym.getId(),asym.getEntity_id());
    Chain s=getEntityChain(asym.getEntity_id());
    Chain seqres=(Chain)s.clone();
    seqres=removeSeqResHeterogeneity(seqres);
    seqres.setId(asym.getId());
    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 mmSize=0;
      int bioAssemblyId=-1;
      try {
        bioAssemblyId=Integer.parseInt(psa.getId());
      }
 catch (      NumberFormatException e) {
        logger.info("String_Node_Str",psa.getId());
      }
      try {
        mmSize=Integer.parseInt(psa.getOligomeric_count());
      }
 catch (      NumberFormatException e) {
        if (bioAssemblyId != -1)         logger.warn("String_Node_Str",psa.getOligomeric_count(),psa.getId());
 else         logger.info("String_Node_Str",psa.getOligomeric_count(),psa.getId());
      }
      if (bioAssemblyId != -1) {
        BioAssemblyInfo bioAssembly=new BioAssemblyInfo();
        bioAssembly.setId(bioAssemblyId);
        bioAssembly.setMacromolecularSize(mmSize);
        bioAssembly.setTransforms(transformations);
        bioAssemblies.put(bioAssemblyId,bioAssembly);
      }
    }
    structure.getPDBHeader().setBioAssemblies(bioAssemblies);
  }
  ArrayList<Matrix4d> ncsOperators=new ArrayList<Matrix4d>();
  for (  StructNcsOper sNcsOper : structNcsOper) {
    if (sNcsOper.getCode().equals("String_Node_Str")) {
      ncsOperators.add(sNcsOper.getOperator());
    }
  }
  if (ncsOperators.size() > 0) {
    structure.getCrystallographicInfo().setNcsOperators(ncsOperators.toArray(new Matrix4d[ncsOperators.size()]));
  }
  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 c=structure.getPolyChainByPDB(chainId);
    if (c == null) {
      logger.warn("String_Node_Str" + chainId);
      continue;
    }
    c.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 != 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 mmSize=0;
      int bioAssemblyId=-1;
      try {
        bioAssemblyId=Integer.parseInt(psa.getId());
      }
 catch (      NumberFormatException e) {
        logger.info("String_Node_Str",psa.getId());
      }
      try {
        mmSize=Integer.parseInt(psa.getOligomeric_count());
      }
 catch (      NumberFormatException e) {
        if (bioAssemblyId != -1)         logger.warn("String_Node_Str",psa.getOligomeric_count(),psa.getId());
 else         logger.info("String_Node_Str",psa.getOligomeric_count(),psa.getId());
      }
      if (bioAssemblyId != -1) {
        BioAssemblyInfo bioAssembly=new BioAssemblyInfo();
        bioAssembly.setId(bioAssemblyId);
        bioAssembly.setMacromolecularSize(mmSize);
        bioAssembly.setTransforms(transformations);
        bioAssemblies.put(bioAssemblyId,bioAssembly);
      }
    }
    structure.getPDBHeader().setBioAssemblies(bioAssemblies);
  }
  ArrayList<Matrix4d> ncsOperators=new ArrayList<Matrix4d>();
  for (  StructNcsOper sNcsOper : structNcsOper) {
    if (sNcsOper.getCode().equals("String_Node_Str")) {
      ncsOperators.add(sNcsOper.getOperator());
    }
  }
  if (ncsOperators.size() > 0) {
    structure.getCrystallographicInfo().setNcsOperators(ncsOperators.toArray(new Matrix4d[ncsOperators.size()]));
  }
  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 c=structure.getPolyChainByPDB(chainId);
    if (c == null) {
      logger.warn("String_Node_Str" + chainId);
      continue;
    }
    c.setSeqMisMatches(misMatchMap.get(chainId));
  }
}