Program: 16857
Project: 16857
Buggy source:
public void newAtomSite(AtomSite atom){
  boolean startOfNewChain=false;
  String chain_id=atom.getLabel_asym_id();
  String recordName=atom.getGroup_PDB();
  String residueNumberS=atom.getAuth_seq_id();
  Integer residueNrInt=Integer.parseInt(residueNumberS);
  String groupCode3=atom.getLabel_comp_id();
  if (groupCode3.length() == 1) {
    groupCode3="String_Node_Str" + groupCode3;
  }
  if (groupCode3.length() == 2) {
    groupCode3="String_Node_Str" + groupCode3;
  }
  Character aminoCode1=null;
  if (recordName.equals("String_Node_Str"))   aminoCode1=StructureTools.get1LetterCode(groupCode3);
 else {
    aminoCode1=StructureTools.get1LetterCode(groupCode3);
    if (aminoCode1 != null && aminoCode1.equals(StructureTools.UNKNOWN_GROUP_LABEL))     aminoCode1=null;
  }
  String insCodeS=atom.getPdbx_PDB_ins_code();
  Character insCode=null;
  if (!insCodeS.equals("String_Node_Str")) {
    insCode=insCodeS.charAt(0);
  }
  long seq_id=-1;
  try {
    seq_id=Long.parseLong(atom.getLabel_seq_id());
  }
 catch (  NumberFormatException e) {
  }
  String nmrModel=atom.getPdbx_PDB_model_num();
  if (current_nmr_model == null) {
    current_nmr_model=nmrModel;
  }
  if (!current_nmr_model.equals(nmrModel)) {
    current_nmr_model=nmrModel;
    if (current_chain != null) {
      current_chain.addGroup(current_group);
      current_group.trimToSize();
    }
    structure.addModel(current_model);
    current_model=new ArrayList<Chain>();
    current_chain=null;
    current_group=null;
  }
  if (current_chain == null) {
    current_chain=new ChainImpl();
    current_chain.setChainID(chain_id);
    current_model.add(current_chain);
    startOfNewChain=true;
  }
  if (!chain_id.equals(current_chain.getChainID())) {
    startOfNewChain=true;
    current_chain.addGroup(current_group);
    Chain testchain;
    testchain=isKnownChain(current_chain.getChainID(),current_model);
    if (testchain != null && testchain.getChainID().equals(chain_id)) {
    }
 else {
      testchain=isKnownChain(chain_id,current_model);
    }
    if (testchain == null) {
      current_chain=new ChainImpl();
      current_chain.setChainID(chain_id);
    }
 else {
      current_chain=testchain;
    }
    if (!current_model.contains(current_chain))     current_model.add(current_chain);
  }
  ResidueNumber residueNumber=new ResidueNumber(chain_id,residueNrInt,insCode);
  if (current_group == null) {
    current_group=getNewGroup(recordName,aminoCode1,seq_id,groupCode3);
    current_group.setResidueNumber(residueNumber);
    current_group.setPDBName(groupCode3);
  }
  if (startOfNewChain) {
    current_group=getNewGroup(recordName,aminoCode1,seq_id,groupCode3);
    current_group.setResidueNumber(residueNumber);
    current_group.setPDBName(groupCode3);
  }
  Group altGroup=null;
  String altLocS=atom.getLabel_alt_id();
  Character altLoc=' ';
  if (altLocS.length() > 0) {
    altLoc=altLocS.charAt(0);
    if (altLoc.equals('.'))     altLoc=' ';
  }
  if (!residueNumber.equals(current_group.getResidueNumber())) {
    current_chain.addGroup(current_group);
    current_group.trimToSize();
    current_group=getNewGroup(recordName,aminoCode1,seq_id,groupCode3);
    current_group.setPDBName(groupCode3);
    current_group.setResidueNumber(residueNumber);
  }
 else {
    if (!altLoc.equals(' ') && (!altLoc.equals('.'))) {
      altGroup=getCorrectAltLocGroup(altLoc,recordName,aminoCode1,groupCode3,seq_id);
    }
  }
  if (params.isHeaderOnly())   return;
  if (params.isParseCAOnly()) {
    if (!(atom.getLabel_atom_id().equals("String_Node_Str") && atom.getType_symbol().equals("String_Node_Str"))) {
      return;
    }
  }
  Atom a=convertAtom(atom);
  if (altGroup != null) {
    altGroup.addAtom(a);
    altGroup=null;
  }
 else {
    current_group.addAtom(a);
  }
  if (!current_group.hasAtom(a.getName())) {
    current_group.addAtom(a);
  }
}

Fixed version (ground truth):
public void newAtomSite(AtomSite atom){
  boolean startOfNewChain=false;
  String chain_id=atom.getLabel_asym_id();
  String recordName=atom.getGroup_PDB();
  String residueNumberS=atom.getAuth_seq_id();
  Integer residueNrInt=Integer.parseInt(residueNumberS);
  String groupCode3=atom.getLabel_comp_id();
  if (groupCode3.length() == 1) {
    groupCode3="String_Node_Str" + groupCode3;
  }
  if (groupCode3.length() == 2) {
    groupCode3="String_Node_Str" + groupCode3;
  }
  Character aminoCode1=null;
  if (recordName.equals("String_Node_Str"))   aminoCode1=StructureTools.get1LetterCode(groupCode3);
 else {
    aminoCode1=StructureTools.get1LetterCode(groupCode3);
    if (aminoCode1 != null && aminoCode1.equals(StructureTools.UNKNOWN_GROUP_LABEL))     aminoCode1=null;
  }
  String insCodeS=atom.getPdbx_PDB_ins_code();
  Character insCode=null;
  if (!insCodeS.equals("String_Node_Str")) {
    insCode=insCodeS.charAt(0);
  }
  long seq_id=-1;
  try {
    seq_id=Long.parseLong(atom.getLabel_seq_id());
  }
 catch (  NumberFormatException e) {
  }
  String nmrModel=atom.getPdbx_PDB_model_num();
  if (current_nmr_model == null) {
    current_nmr_model=nmrModel;
  }
  if (!current_nmr_model.equals(nmrModel)) {
    current_nmr_model=nmrModel;
    if (current_chain != null) {
      current_chain.addGroup(current_group);
      current_group.trimToSize();
    }
    structure.addModel(current_model);
    current_model=new ArrayList<Chain>();
    current_chain=null;
    current_group=null;
  }
  if (current_chain == null) {
    current_chain=new ChainImpl();
    current_chain.setChainID(chain_id);
    current_model.add(current_chain);
    startOfNewChain=true;
  }
  if (!chain_id.equals(current_chain.getChainID())) {
    startOfNewChain=true;
    current_chain.addGroup(current_group);
    Chain testchain;
    testchain=isKnownChain(current_chain.getChainID(),current_model);
    if (testchain != null && testchain.getChainID().equals(chain_id)) {
    }
 else {
      testchain=isKnownChain(chain_id,current_model);
    }
    if (testchain == null) {
      current_chain=new ChainImpl();
      current_chain.setChainID(chain_id);
    }
 else {
      current_chain=testchain;
    }
    if (!current_model.contains(current_chain))     current_model.add(current_chain);
  }
  ResidueNumber residueNumber=new ResidueNumber(chain_id,residueNrInt,insCode);
  if (current_group == null) {
    current_group=getNewGroup(recordName,aminoCode1,seq_id,groupCode3);
    current_group.setResidueNumber(residueNumber);
    current_group.setPDBName(groupCode3);
  }
  if (startOfNewChain) {
    current_group=getNewGroup(recordName,aminoCode1,seq_id,groupCode3);
    current_group.setResidueNumber(residueNumber);
    current_group.setPDBName(groupCode3);
  }
  Group altGroup=null;
  String altLocS=atom.getLabel_alt_id();
  Character altLoc=' ';
  if (altLocS.length() > 0) {
    altLoc=altLocS.charAt(0);
    if (altLoc.equals('.'))     altLoc=' ';
  }
  if (!residueNumber.equals(current_group.getResidueNumber())) {
    current_chain.addGroup(current_group);
    current_group.trimToSize();
    current_group=getNewGroup(recordName,aminoCode1,seq_id,groupCode3);
    current_group.setPDBName(groupCode3);
    current_group.setResidueNumber(residueNumber);
  }
 else {
    if (!altLoc.equals(' ') && (!altLoc.equals('.'))) {
      logger.debug("String_Node_Str" + altLoc + "String_Node_Str"+ current_group+ "String_Node_Str"+ altGroup);
      altGroup=getCorrectAltLocGroup(altLoc,recordName,aminoCode1,groupCode3,seq_id);
      if (altGroup.getChain() == null) {
        altGroup.setChain(current_chain);
      }
    }
  }
  if (params.isHeaderOnly())   return;
  if (params.isParseCAOnly()) {
    if (!(atom.getLabel_atom_id().equals("String_Node_Str") && atom.getType_symbol().equals("String_Node_Str"))) {
      return;
    }
  }
  Atom a=convertAtom(atom);
  if (altGroup != null) {
    altGroup.addAtom(a);
    altGroup=null;
  }
 else {
    current_group.addAtom(a);
  }
  if (!current_group.hasAtom(a.getName())) {
    current_group.addAtom(a);
  }
}