nus-yam/ex-repair huggingface dataset:
Program: 16867
Project: 16867
Buggy source:
private void testChainRefs(Chain c){
  assertNotNull(c.getCompound());
  for (  Group g : c.getAtomGroups()) {
    assertSame("String_Node_Str" + g.toString(),c,g.getChain());
    for (    Atom a : g.getAtoms()) {
      assertSame(g,a.getGroup());
      assertSame(c,a.getGroup().getChain());
    }
    if (c.getSeqResGroups().size() > 0) {
      assertTrue("String_Node_Str" + g.toString(),c.getSeqResGroups().contains(g));
    }
  }
  for (  Group g : c.getSeqResGroups()) {
    assertSame("String_Node_Str" + g.toString(),c,g.getChain());
    for (    Atom a : g.getAtoms()) {
      assertSame(g,a.getGroup());
      assertSame(c,a.getGroup().getChain());
    }
  }
}

Fixed version (ground truth):
private void testChainRefs(Chain c){
  assertNotNull(c.getCompound());
  for (  Group g : c.getAtomGroups()) {
    assertSame("String_Node_Str" + g.toString(),c,g.getChain());
    for (    Atom a : g.getAtoms()) {
      assertSame(g,a.getGroup());
      assertSame(c,a.getGroup().getChain());
    }
    if (c.getSeqResGroups().size() > 0) {
      assertTrue("String_Node_Str" + g.toString(),containsReference(g,c.getSeqResGroups()));
    }
  }
  for (  Group g : c.getSeqResGroups()) {
    assertSame("String_Node_Str" + g.toString(),c,g.getChain());
    for (    Atom a : g.getAtoms()) {
      assertSame(g,a.getGroup());
      assertSame(c,a.getGroup().getChain());
    }
  }
}
Program: 16870
Project: 16870
Buggy source:
/** 
 * After the parsing of a PDB file the   {@link Chain} and  {@link Compound}objects need to be linked to each other.
 * @param s the structure
 */
public void linkChains2Compound(Structure s){
  List<Compound> compounds=s.getCompounds();
  for (  Compound comp : compounds) {
    List<Chain> chains=new ArrayList<Chain>();
    List<String> chainIds=comp.getChainIds();
    if (chainIds == null)     continue;
    for (    String chainId : chainIds) {
      if (chainId.equals("String_Node_Str"))       chainId="String_Node_Str";
      try {
        Chain c=s.findChain(chainId);
        chains.add(c);
      }
 catch (      StructureException e) {
        e.printStackTrace();
      }
    }
    comp.setChains(chains);
  }
  if (compounds.size() == 1) {
    Compound comp=compounds.get(0);
    if (comp.getChainIds() == null) {
      List<Chain> chains=s.getChains(0);
      if (chains.size() == 1) {
        Chain ch=chains.get(0);
        List<String> chainIds=new ArrayList<String>();
        chainIds.add(ch.getChainID());
        comp.setChainIds(chainIds);
        comp.addChain(ch);
      }
    }
  }
  for (  Compound comp : compounds) {
    if (comp.getChainIds() == null) {
      continue;
    }
    for (    String chainId : comp.getChainIds()) {
      if (chainId.equals("String_Node_Str"))       continue;
      try {
        Chain c=s.getChainByPDB(chainId);
        c.setCompound(comp);
      }
 catch (      StructureException e) {
        e.printStackTrace();
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * After the parsing of a PDB file the   {@link Chain} and  {@link Compound}objects need to be linked to each other.
 * @param s the structure
 */
public void linkChains2Compound(Structure s){
  List<Compound> compounds=s.getCompounds();
  for (  Compound comp : compounds) {
    List<Chain> chains=new ArrayList<Chain>();
    List<String> chainIds=comp.getChainIds();
    if (chainIds == null)     continue;
    for (    String chainId : chainIds) {
      if (chainId.equals("String_Node_Str"))       chainId="String_Node_Str";
      try {
        Chain c=s.findChain(chainId);
        chains.add(c);
      }
 catch (      StructureException e) {
        logger.error("String_Node_Str",e);
      }
    }
    comp.setChains(chains);
  }
  if (compounds.size() == 1) {
    Compound comp=compounds.get(0);
    if (comp.getChainIds() == null) {
      List<Chain> chains=s.getChains(0);
      if (chains.size() == 1) {
        Chain ch=chains.get(0);
        List<String> chainIds=new ArrayList<String>();
        chainIds.add(ch.getChainID());
        comp.setChainIds(chainIds);
        comp.addChain(ch);
      }
    }
  }
  for (  Compound comp : compounds) {
    if (comp.getChainIds() == null) {
      continue;
    }
    for (    String chainId : comp.getChainIds()) {
      if (chainId.equals("String_Node_Str"))       continue;
      try {
        Chain c=s.getChainByPDB(chainId);
        c.setCompound(comp);
      }
 catch (      StructureException e) {
        logger.error("String_Node_Str",e);
      }
    }
  }
}
Program: 16871
Project: 16871
Buggy source:
private Chain getChainFromList(List<Chain> chains,String name){
  for (  Chain chain : chains) {
    if (chain.getChainID().equals(name)) {
      return chain;
    }
  }
  Chain chain=new ChainImpl();
  chain.setChainID(name);
  chains.add(chain);
  return chain;
}

Fixed version (ground truth):
private static Chain getChainFromList(List<Chain> chains,String name){
  for (  Chain chain : chains) {
    if (chain.getChainID().equals(name)) {
      return chain;
    }
  }
  Chain chain=new ChainImpl();
  chain.setChainID(name);
  chains.add(chain);
  return chain;
}
Program: 16872
Project: 16872
Buggy source:
/** 
 * Start the parsing
 */
public void documentStart(){
  structure=new StructureImpl();
  current_chain=null;
  current_group=null;
  current_nmr_model=null;
  current_model=new ArrayList<Chain>();
  entities=new ArrayList<Entity>();
  strucRefs=new ArrayList<StructRef>();
  seqResChains=new ArrayList<Chain>();
  entityChains=new ArrayList<Chain>();
  structAsyms=new ArrayList<StructAsym>();
  asymStrandId=new HashMap<String,String>();
  structOpers=new ArrayList<PdbxStructOperList>();
  strucAssemblies=new ArrayList<PdbxStructAssembly>();
  strucAssemblyGens=new ArrayList<PdbxStructAssemblyGen>();
  entitySrcGens=new ArrayList<EntitySrcGen>();
  entitySrcNats=new ArrayList<EntitySrcNat>();
  entitySrcSyns=new ArrayList<EntitySrcSyn>();
  structConn=new ArrayList<StructConn>();
  structNcsOper=new ArrayList<StructNcsOper>();
}

Fixed version (ground truth):
/** 
 * Start the parsing
 */
public void documentStart(){
  structure=new StructureImpl();
  current_chain=null;
  current_group=null;
  current_nmr_model=null;
  current_model=new ArrayList<Chain>();
  entities=new ArrayList<Entity>();
  strucRefs=new ArrayList<StructRef>();
  seqResChains=new ArrayList<Chain>();
  entityChains=new ArrayList<Chain>();
  structAsyms=new ArrayList<StructAsym>();
  asymStrandId=new HashMap<String,String>();
  asymId2entityId=new HashMap<String,String>();
  structOpers=new ArrayList<PdbxStructOperList>();
  strucAssemblies=new ArrayList<PdbxStructAssembly>();
  strucAssemblyGens=new ArrayList<PdbxStructAssemblyGen>();
  entitySrcGens=new ArrayList<EntitySrcGen>();
  entitySrcNats=new ArrayList<EntitySrcNat>();
  entitySrcSyns=new ArrayList<EntitySrcSyn>();
  structConn=new ArrayList<StructConn>();
  structNcsOper=new ArrayList<StructNcsOper>();
}
Program: 16874
Project: 16874
Buggy source:
public void newEntity(Entity entity){
  logger.debug(entity.toString());
  entities.add(entity);
}

Fixed version (ground truth):
public void newEntity(Entity entity){
  logger.debug("String_Node_Str",entity.toString());
  entities.add(entity);
}
Program: 16877
Project: 16877
Buggy source:
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) public String toString(){
  StringBuffer buf=new StringBuffer();
  buf.append(this.getClass().getName()).append("String_Node_Str");
  try {
    Class c=this.getClass();
    Method[] methods=c.getMethods();
    for (int i=0; i < methods.length; i++) {
      Method m=methods[i];
      String name=m.getName();
      if (name.substring(0,3).equals("String_Node_Str")) {
        Object o=m.invoke(this,new Object[]{});
        if (o instanceof String) {
          buf.append(name.substring(3,name.length()) + "String_Node_Str" + o+ "String_Node_Str");
        }
 else         if (o instanceof List) {
          buf.append(name.substring(3,name.length())).append("String_Node_Str");
          List<Object> lst=(List<Object>)o;
          for (          Object obj : lst) {
            if (obj instanceof Chain) {
              continue;
            }
            buf.append(obj).append("String_Node_Str");
          }
        }
 else {
        }
      }
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return buf.toString();
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str"}) public String toString(){
  StringBuffer buf=new StringBuffer();
  buf.append(this.getClass().getName()).append("String_Node_Str");
  try {
    Class<? extends AbstractBean> c=this.getClass();
    Method[] methods=c.getMethods();
    for (int i=0; i < methods.length; i++) {
      Method m=methods[i];
      String name=m.getName();
      if (name.substring(0,3).equals("String_Node_Str")) {
        Object o=m.invoke(this,new Object[]{});
        if (o instanceof String) {
          buf.append(name.substring(3,name.length()) + "String_Node_Str" + o+ "String_Node_Str");
        }
 else         if (o instanceof List) {
          buf.append(name.substring(3,name.length())).append("String_Node_Str");
          List<Object> lst=(List<Object>)o;
          for (          Object obj : lst) {
            if (obj instanceof Chain) {
              continue;
            }
            buf.append(obj).append("String_Node_Str");
          }
        }
 else {
        }
      }
    }
  }
 catch (  InvocationTargetException e) {
    logger.error("String_Node_Str",e);
  }
catch (  IllegalAccessException e) {
    logger.error("String_Node_Str",e);
  }
  return buf.toString();
}
Program: 16879
Project: 16879
Buggy source:
/** 
 * returns and identical copy of this Group object .
 * @return  and identical copy of this Group object
 */
public Object clone(){
  AminoAcidImpl n=new AminoAcidImpl();
  n.setPDBFlag(has3D());
  n.setResidueNumber(getResidueNumber());
  n.setPDBName(getPDBName());
  n.setAminoType(getAminoType());
  n.setRecordType(recordType);
  for (int i=0; i < atoms.size(); i++) {
    Atom atom=(Atom)atoms.get(i);
    n.addAtom((Atom)atom.clone());
  }
  return n;
}

Fixed version (ground truth):
/** 
 * returns and identical copy of this Group object .
 * @return  and identical copy of this Group object
 */
public Object clone(){
  AminoAcidImpl n=new AminoAcidImpl();
  n.setPDBFlag(has3D());
  n.setResidueNumber(getResidueNumber());
  n.setPDBName(getPDBName());
  n.setAminoType(getAminoType());
  n.setRecordType(recordType);
  for (int i=0; i < atoms.size(); i++) {
    Atom atom=(Atom)atoms.get(i).clone();
    n.addAtom(atom);
    atom.setGroup(n);
  }
  return n;
}
Program: 16880
Project: 16880
Buggy source:
/** 
 * Returns an identical copy of this Chain .
 * @return an identical copy of this Chain
 */
public Object clone(){
  ChainImpl n=new ChainImpl();
  n.setChainID(getChainID());
  n.setSwissprotId(getSwissprotId());
  n.setCompound(this.getCompound());
  n.setInternalChainID(internalChainID);
  for (int i=0; i < groups.size(); i++) {
    Group g=groups.get(i);
    n.addGroup((Group)g.clone());
  }
  if (seqResGroups.size() > 0) {
    List<Group> tmpSeqRes=new ArrayList<Group>();
    for (int i=0; i < seqResGroups.size(); i++) {
      Group g=(Group)seqResGroups.get(i).clone();
      tmpSeqRes.add(g);
    }
    Chain tmp=new ChainImpl();
    tmp.setAtomGroups(tmpSeqRes);
    SeqRes2AtomAligner seqresaligner=new SeqRes2AtomAligner();
    seqresaligner.mapSeqresRecords(n,tmp);
  }
  return n;
}

Fixed version (ground truth):
/** 
 * Returns an identical copy of this Chain .
 * @return an identical copy of this Chain
 */
public Object clone(){
  ChainImpl n=new ChainImpl();
  n.setChainID(getChainID());
  n.setSwissprotId(getSwissprotId());
  n.setCompound(this.mol);
  n.setInternalChainID(internalChainID);
  for (int i=0; i < groups.size(); i++) {
    Group g=(Group)groups.get(i).clone();
    n.addGroup(g);
    g.setChain(n);
  }
  if (seqResGroups.size() > 0) {
    List<Group> tmpSeqRes=new ArrayList<Group>();
    for (int i=0; i < seqResGroups.size(); i++) {
      Group g=(Group)seqResGroups.get(i).clone();
      g.setChain(n);
      tmpSeqRes.add(g);
    }
    Chain tmp=new ChainImpl();
    tmp.setAtomGroups(tmpSeqRes);
    SeqRes2AtomAligner seqresaligner=new SeqRes2AtomAligner();
    seqresaligner.mapSeqresRecords(n,tmp);
  }
  return n;
}
Program: 16881
Project: 16881
Buggy source:
public Compound(){
  chains=new ArrayList<Chain>();
  molId=-1;
}

Fixed version (ground truth):
/** 
 * Constructs a new Compound copying all data from the given one but not setting the Chains
 * @param c
 */
public Compound(Compound c){
  this.chains=new ArrayList<Chain>();
  this.molId=c.molId;
  this.refChainId=c.refChainId;
  this.molName=c.molName;
  this.title=c.title;
  if (c.synonyms != null) {
    this.synonyms=new ArrayList<String>();
    synonyms.addAll(c.synonyms);
  }
  if (c.ecNums != null) {
    this.ecNums=new ArrayList<String>();
    ecNums.addAll(c.ecNums);
  }
  this.engineered=c.engineered;
  this.mutation=c.mutation;
  this.biologicalUnit=c.biologicalUnit;
  this.details=c.details;
  this.numRes=c.numRes;
  this.resNames=c.resNames;
  this.headerVars=c.headerVars;
  this.synthetic=c.synthetic;
  this.fragment=c.fragment;
  this.organismScientific=c.organismScientific;
  this.organismTaxId=c.organismTaxId;
  this.organismCommon=c.organismCommon;
  this.strain=c.strain;
  this.variant=c.variant;
  this.cellLine=c.cellLine;
  this.atcc=c.atcc;
  this.organ=c.organ;
  this.tissue=c.tissue;
  this.cell=c.cell;
  this.organelle=c.organelle;
  this.secretion=c.secretion;
  this.gene=c.gene;
  this.cellularLocation=c.cellularLocation;
  this.expressionSystem=c.expressionSystem;
  this.expressionSystemTaxId=c.expressionSystemTaxId;
  this.expressionSystemStrain=c.expressionSystemStrain;
  this.expressionSystemVariant=c.expressionSystemVariant;
  this.expressionSystemCellLine=c.expressionSystemCellLine;
  this.expressionSystemAtccNumber=c.expressionSystemAtccNumber;
  this.expressionSystemOrgan=c.expressionSystemOrgan;
  this.expressionSystemTissue=c.expressionSystemTissue;
  this.expressionSystemCell=c.expressionSystemCell;
  this.expressionSystemOrganelle=c.expressionSystemOrganelle;
  this.expressionSystemCellularLocation=c.expressionSystemCellularLocation;
  this.expressionSystemVectorType=c.expressionSystemVectorType;
  this.expressionSystemVector=c.expressionSystemVector;
  this.expressionSystemPlasmid=c.expressionSystemPlasmid;
  this.expressionSystemGene=c.expressionSystemGene;
  this.expressionSystemOtherDetails=c.expressionSystemOtherDetails;
}
Program: 16882
Project: 16882
Buggy source:
/** 
 * returns and identical copy of this Group object .
 * @return  and identical copy of this Group object
 */
public Object clone(){
  HetatomImpl n=new HetatomImpl();
  n.setPDBFlag(has3D());
  n.setResidueNumber(residueNumber);
  n.setPDBName(getPDBName());
  for (int i=0; i < atoms.size(); i++) {
    Atom atom=atoms.get(i);
    n.addAtom((Atom)atom.clone());
  }
  return n;
}

Fixed version (ground truth):
/** 
 * returns and identical copy of this Group object .
 * @return  and identical copy of this Group object
 */
public Object clone(){
  HetatomImpl n=new HetatomImpl();
  n.setPDBFlag(has3D());
  n.setResidueNumber(residueNumber);
  n.setPDBName(getPDBName());
  for (int i=0; i < atoms.size(); i++) {
    Atom atom=(Atom)atoms.get(i).clone();
    n.addAtom(atom);
    atom.setGroup(n);
  }
  return n;
}
Program: 16883
Project: 16883
Buggy source:
public Object clone(){
  NucleotideImpl n=new NucleotideImpl();
  n.setPDBFlag(has3D());
  n.setResidueNumber(getResidueNumber());
  n.setPDBName(getPDBName());
  for (int i=0; i < atoms.size(); i++) {
    Atom atom=(Atom)atoms.get(i);
    n.addAtom((Atom)atom.clone());
  }
  return n;
}

Fixed version (ground truth):
public Object clone(){
  NucleotideImpl n=new NucleotideImpl();
  n.setPDBFlag(has3D());
  n.setResidueNumber(getResidueNumber());
  n.setPDBName(getPDBName());
  for (int i=0; i < atoms.size(); i++) {
    Atom atom=(Atom)atoms.get(i).clone();
    n.addAtom(atom);
    atom.setGroup(n);
  }
  return n;
}
Program: 16884
Project: 16884
Buggy source:
/** 
 * returns an identical copy of this structure .
 * @return an identical Structure object
 */
public Structure clone(){
  Structure n=new StructureImpl();
  n.setPDBCode(getPDBCode());
  n.setName(getName());
  n.setPDBHeader(pdbHeader);
  n.setDBRefs(this.getDBRefs());
  n.setConnections(getConnections());
  n.setSites(getSites());
  n.setCrystallographicInfo(getCrystallographicInfo());
  for (int i=0; i < nrModels(); i++) {
    List<Chain> cloned_model=new ArrayList<Chain>();
    for (int j=0; j < size(i); j++) {
      Chain current_chain=(Chain)getChain(i,j);
      Chain cloned_chain=(Chain)current_chain.clone();
      cloned_model.add(cloned_chain);
    }
    n.addModel(cloned_model);
  }
  for (  SSBond ssbond : ssbonds) {
    n.addSSBond(ssbond.clone());
  }
  return n;
}

Fixed version (ground truth):
public Structure clone(){
  Structure n=new StructureImpl();
  n.setPDBCode(getPDBCode());
  n.setName(getName());
  n.setPDBHeader(pdbHeader);
  n.setDBRefs(this.getDBRefs());
  n.setConnections(getConnections());
  n.setSites(getSites());
  for (int i=0; i < nrModels(); i++) {
    List<Chain> cloned_model=new ArrayList<Chain>();
    for (int j=0; j < size(i); j++) {
      Chain cloned_chain=(Chain)getChain(i,j).clone();
      cloned_chain.setParent(n);
      cloned_model.add(cloned_chain);
    }
    n.addModel(cloned_model);
  }
  List<Compound> newCompoundList=new ArrayList<Compound>();
  for (  Compound compound : this.compounds) {
    Compound newCompound=new Compound(compound);
    for (    String chainId : compound.getChainIds()) {
      try {
        Chain newChain=n.getChainByPDB(chainId);
        newChain.setCompound(newCompound);
        newCompound.addChain(newChain);
      }
 catch (      StructureException e) {
        logger.error("String_Node_Str");
      }
    }
    newCompoundList.add(newCompound);
  }
  n.setCompounds(newCompoundList);
  for (  SSBond ssbond : ssbonds) {
    n.addSSBond(ssbond.clone());
  }
  return n;
}
Program: 16885
Project: 16885
Buggy source:
public void basicLoad(){
  try {
    PDBFileReader reader=new PDBFileReader();
    reader.setPath("String_Node_Str");
    reader.setPdbDirectorySplit(true);
    reader.setAutoFetch(true);
    FileParsingParameters params=new FileParsingParameters();
    params.setAlignSeqRes(true);
    params.setParseSecStruc(false);
    reader.setFileParsingParameters(params);
    Structure structure=reader.getStructureById("String_Node_Str");
    System.out.println(structure);
    Chain c=structure.getChainByPDB("String_Node_Str");
    System.out.print(c);
    System.out.println(c.getHeader());
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void basicLoad(){
  try {
    PDBFileReader reader=new PDBFileReader();
    reader.setPath("String_Node_Str");
    reader.setPdbDirectorySplit(true);
    reader.setAutoFetch(true);
    FileParsingParameters params=new FileParsingParameters();
    params.setAlignSeqRes(true);
    params.setParseSecStruc(false);
    reader.setFileParsingParameters(params);
    Structure structure=reader.getStructureById("String_Node_Str");
    System.out.println(structure);
    Chain c=structure.getChainByPDB("String_Node_Str");
    System.out.print(c);
    System.out.println(c.getCompound());
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 16886
Project: 16886
Buggy source:
/** 
 * Returns an identical copy of this Chain .
 * @return an identical copy of this Chain
 */
public Object clone(){
  ChainImpl n=new ChainImpl();
  n.setChainID(getChainID());
  n.setSwissprotId(getSwissprotId());
  n.setHeader(this.getHeader());
  n.setInternalChainID(internalChainID);
  for (int i=0; i < groups.size(); i++) {
    Group g=(Group)groups.get(i);
    n.addGroup((Group)g.clone());
  }
  if (seqResGroups.size() > 0) {
    List<Group> tmpSeqRes=new ArrayList<Group>();
    for (int i=0; i < seqResGroups.size(); i++) {
      Group g=(Group)seqResGroups.get(i);
      tmpSeqRes.add(g);
    }
    Chain tmp=new ChainImpl();
    tmp.setAtomGroups(tmpSeqRes);
    SeqRes2AtomAligner seqresaligner=new SeqRes2AtomAligner();
    try {
      seqresaligner.mapSeqresRecords(n,tmp);
    }
 catch (    StructureException e) {
      logger.error("String_Node_Str",e);
    }
  }
  return n;
}

Fixed version (ground truth):
/** 
 * Returns an identical copy of this Chain .
 * @return an identical copy of this Chain
 */
public Object clone(){
  ChainImpl n=new ChainImpl();
  n.setChainID(getChainID());
  n.setSwissprotId(getSwissprotId());
  n.setCompound(this.getCompound());
  n.setInternalChainID(internalChainID);
  for (int i=0; i < groups.size(); i++) {
    Group g=(Group)groups.get(i);
    n.addGroup((Group)g.clone());
  }
  if (seqResGroups.size() > 0) {
    List<Group> tmpSeqRes=new ArrayList<Group>();
    for (int i=0; i < seqResGroups.size(); i++) {
      Group g=(Group)seqResGroups.get(i);
      tmpSeqRes.add(g);
    }
    Chain tmp=new ChainImpl();
    tmp.setAtomGroups(tmpSeqRes);
    SeqRes2AtomAligner seqresaligner=new SeqRes2AtomAligner();
    try {
      seqresaligner.mapSeqresRecords(n,tmp);
    }
 catch (    StructureException e) {
      logger.error("String_Node_Str",e);
    }
  }
  return n;
}
Program: 16887
Project: 16887
Buggy source:
/** 
 * get the chains that are part of this Compound
 * @return a List of Chain objects
 */
public List<Chain> getChains(){
  return this.chainList;
}

Fixed version (ground truth):
/** 
 * Get the list of chains that are part of this Compound
 * @return a List of Chain objects
 */
public List<Chain> getChains(){
  return this.chains;
}
Program: 16888
Project: 16888
Buggy source:
public void addChain(Chain chain){
  this.chainList.add(chain);
}

Fixed version (ground truth):
/** 
 * Add new Chain to this Compound
 * @param chain
 */
public void addChain(Chain chain){
  this.chains.add(chain);
}
Program: 16889
Project: 16889
Buggy source:
/** 
 * Returns the ref chain id value.
 * @return the RefChainID
 * @see #setRefChainId(String)
 */
public String getRefChainId(){
  return refChainId;
}

Fixed version (ground truth):
/** 
 * Return the ref chain id value.
 * @return the RefChainID
 * @see #setRefChainId(String)
 */
public String getRefChainId(){
  return refChainId;
}
Program: 16890
Project: 16890
Buggy source:
@SuppressWarnings("String_Node_Str") public String toString(){
  StringBuffer buf=new StringBuffer();
  buf.append("String_Node_Str" + molId + "String_Node_Str"+ molName+ "String_Node_Str");
  try {
    @SuppressWarnings("String_Node_Str") Class c=Class.forName("String_Node_Str");
    Method[] methods=c.getMethods();
    for (int i=0; i < methods.length; i++) {
      Method m=methods[i];
      String name=m.getName();
      if (name.substring(0,3).equals("String_Node_Str")) {
        if (name.equals("String_Node_Str"))         continue;
        if (name.equals("String_Node_Str"))         continue;
        Object o=m.invoke(this,new Object[]{});
        if (o instanceof String) {
          if (o != null)           buf.append(name.substring(3,name.length()) + "String_Node_Str" + o+ "String_Node_Str");
        }
        if (o instanceof List) {
          if (o != null)           buf.append(name.substring(3,name.length())).append("String_Node_Str");
          List<Object> lst=(List<Object>)o;
          for (          Object obj : lst) {
            if (obj instanceof Chain) {
              continue;
            }
            buf.append(obj).append("String_Node_Str");
          }
        }
      }
    }
  }
 catch (  ClassNotFoundException e) {
    logger.error("String_Node_Str",e);
  }
catch (  InvocationTargetException e) {
    logger.error("String_Node_Str",e);
  }
catch (  IllegalAccessException e) {
    logger.error("String_Node_Str",e);
  }
  return buf.toString();
}

Fixed version (ground truth):
public String toString(){
  StringBuilder buf=new StringBuilder();
  buf.append("String_Node_Str" + molId + "String_Node_Str");
  buf.append(molName == null ? "String_Node_Str" : "String_Node_Str" + molName + "String_Node_Str");
  buf.append("String_Node_Str");
  if (chainIds != null) {
    for (int i=0; i < chainIds.size(); i++) {
      buf.append(chainIds.get(i));
      if (i != chainIds.size() - 1)       buf.append("String_Node_Str");
    }
  }
 else {
    buf.append("String_Node_Str");
  }
  return buf.toString();
}
Program: 16891
Project: 16891
Buggy source:
public void showCompound(){
  System.out.println("String_Node_Str");
  if (this.molId != -1) {
    System.out.println("String_Node_Str" + this.molId);
  }
  if (this.chainId != null) {
    System.out.println("String_Node_Str" + this.chainId);
  }
  if (this.molName != null) {
    System.out.println("String_Node_Str" + this.molName);
  }
  if (this.title != null) {
    System.out.println("String_Node_Str" + this.title);
  }
  if (this.synonyms != null) {
    for (    String x : this.synonyms) {
      System.out.println("String_Node_Str" + x);
    }
  }
  if (this.ecNums != null) {
    for (    String x : this.ecNums) {
      System.out.println("String_Node_Str" + x);
    }
  }
  if (this.fragment != null) {
    System.out.println("String_Node_Str" + this.fragment);
  }
  if (this.engineered != null) {
    System.out.println("String_Node_Str" + this.engineered);
  }
  if (this.mutation != null) {
    System.out.println("String_Node_Str" + this.mutation);
  }
  if (this.biologicalUnit != null) {
    System.out.println("String_Node_Str" + this.biologicalUnit);
  }
  if (this.details != null) {
    System.out.println("String_Node_Str" + this.details);
  }
  if (this.numRes != null) {
    System.out.println("String_Node_Str" + this.numRes);
  }
}

Fixed version (ground truth):
public void showCompound(){
  System.out.println("String_Node_Str");
  if (this.molId != -1) {
    System.out.println("String_Node_Str" + this.molId);
  }
  if (this.chainIds != null) {
    System.out.println("String_Node_Str" + this.chainIds);
  }
  if (this.molName != null) {
    System.out.println("String_Node_Str" + this.molName);
  }
  if (this.title != null) {
    System.out.println("String_Node_Str" + this.title);
  }
  if (this.synonyms != null) {
    for (    String x : this.synonyms) {
      System.out.println("String_Node_Str" + x);
    }
  }
  if (this.ecNums != null) {
    for (    String x : this.ecNums) {
      System.out.println("String_Node_Str" + x);
    }
  }
  if (this.fragment != null) {
    System.out.println("String_Node_Str" + this.fragment);
  }
  if (this.engineered != null) {
    System.out.println("String_Node_Str" + this.engineered);
  }
  if (this.mutation != null) {
    System.out.println("String_Node_Str" + this.mutation);
  }
  if (this.biologicalUnit != null) {
    System.out.println("String_Node_Str" + this.biologicalUnit);
  }
  if (this.details != null) {
    System.out.println("String_Node_Str" + this.details);
  }
  if (this.numRes != null) {
    System.out.println("String_Node_Str" + this.numRes);
  }
}
Program: 16892
Project: 16892
Buggy source:
/** 
 * Returns the ref chain id value.
 * @param refChainId the RefChainID
 * @see #getRefChainId()
 */
public void setRefChainId(String refChainId){
  this.refChainId=refChainId;
}

Fixed version (ground truth):
/** 
 * Return the ref chain id value.
 * @param refChainId the RefChainID
 * @see #getRefChainId()
 */
public void setRefChainId(String refChainId){
  this.refChainId=refChainId;
}
Program: 16893
Project: 16893
Buggy source:
/** 
 * Returns the mol id value.
 * @return the MolId value
 * @see #setMolId(int)
 */
public int getMolId(){
  return molId;
}

Fixed version (ground truth):
/** 
 * Return the mol id value.
 * @return the MolId value
 * @see #setMolId(int)
 */
public int getMolId(){
  return molId;
}
Program: 16894
Project: 16894
Buggy source:
public Compound(){
  chainList=new ArrayList<Chain>();
  molId=-1;
}

Fixed version (ground truth):
public Compound(){
  chains=new ArrayList<Chain>();
  molId=-1;
}
Program: 16895
Project: 16895
Buggy source:
public void setChains(List<Chain> chains){
  this.chainList=chains;
}

Fixed version (ground truth):
public void setChains(List<Chain> chains){
  this.chains=chains;
}
Program: 16897
Project: 16897
Buggy source:
/** 
 * Convert a Chain to a new Chain containing C-alpha atoms only.
 * @param chain to convert
 * @return a new chain containing Amino acids with C-alpha only. 
 */
public static Chain getCAOnly(Chain chain){
  Chain newChain=new ChainImpl();
  newChain.setChainID(chain.getChainID());
  newChain.setHeader(chain.getHeader());
  newChain.setSwissprotId(chain.getSwissprotId());
  List<Group> groups=chain.getAtomGroups();
  grouploop:   for (  Group g : groups) {
    List<Atom> atoms=g.getAtoms();
    if (!(g instanceof AminoAcid))     continue;
    for (    Atom a : atoms) {
      if (a.getName().equals(StructureTools.CA_ATOM_NAME) && a.getElement() == Element.C) {
        AminoAcid n=new AminoAcidImpl();
        n.setPDBName(g.getPDBName());
        n.setResidueNumber(g.getResidueNumber());
        n.addAtom(a);
        newChain.addGroup(n);
        continue grouploop;
      }
    }
  }
  return newChain;
}

Fixed version (ground truth):
/** 
 * Convert a Chain to a new Chain containing C-alpha atoms only.
 * @param chain to convert
 * @return a new chain containing Amino acids with C-alpha only. 
 */
public static Chain getCAOnly(Chain chain){
  Chain newChain=new ChainImpl();
  newChain.setChainID(chain.getChainID());
  newChain.setCompound(chain.getCompound());
  newChain.setSwissprotId(chain.getSwissprotId());
  List<Group> groups=chain.getAtomGroups();
  grouploop:   for (  Group g : groups) {
    List<Atom> atoms=g.getAtoms();
    if (!(g instanceof AminoAcid))     continue;
    for (    Atom a : atoms) {
      if (a.getName().equals(StructureTools.CA_ATOM_NAME) && a.getElement() == Element.C) {
        AminoAcid n=new AminoAcidImpl();
        n.setPDBName(g.getPDBName());
        n.setResidueNumber(g.getResidueNumber());
        n.addAtom(a);
        newChain.addGroup(n);
        continue grouploop;
      }
    }
  }
  return newChain;
}
Program: 16899
Project: 16899
Buggy source:
/** 
 * Returns an identical copy of this Chain .
 * @return an identical copy of this Chain
 */
public Object clone(){
  ChainImpl n=new ChainImpl();
  n.setChainID(getChainID());
  n.setSwissprotId(getSwissprotId());
  n.setCompound(this.getCompound());
  n.setInternalChainID(internalChainID);
  for (int i=0; i < groups.size(); i++) {
    Group g=(Group)groups.get(i);
    n.addGroup((Group)g.clone());
  }
  if (seqResGroups.size() > 0) {
    List<Group> tmpSeqRes=new ArrayList<Group>();
    for (int i=0; i < seqResGroups.size(); i++) {
      Group g=(Group)seqResGroups.get(i);
      tmpSeqRes.add(g);
    }
    Chain tmp=new ChainImpl();
    tmp.setAtomGroups(tmpSeqRes);
    SeqRes2AtomAligner seqresaligner=new SeqRes2AtomAligner();
    seqresaligner.mapSeqresRecords(n,tmp);
  }
  return n;
}

Fixed version (ground truth):
/** 
 * Returns an identical copy of this Chain .
 * @return an identical copy of this Chain
 */
public Object clone(){
  ChainImpl n=new ChainImpl();
  n.setChainID(getChainID());
  n.setSwissprotId(getSwissprotId());
  n.setCompound(this.getCompound());
  n.setInternalChainID(internalChainID);
  for (int i=0; i < groups.size(); i++) {
    Group g=groups.get(i);
    n.addGroup((Group)g.clone());
  }
  if (seqResGroups.size() > 0) {
    List<Group> tmpSeqRes=new ArrayList<Group>();
    for (int i=0; i < seqResGroups.size(); i++) {
      Group g=(Group)seqResGroups.get(i).clone();
      tmpSeqRes.add(g);
    }
    Chain tmp=new ChainImpl();
    tmp.setAtomGroups(tmpSeqRes);
    SeqRes2AtomAligner seqresaligner=new SeqRes2AtomAligner();
    seqresaligner.mapSeqresRecords(n,tmp);
  }
  return n;
}
Program: 16900
Project: 16900
Buggy source:
/** 
 * String representation.
 * @return String representation of the Chain
 */
public String toString(){
  String newline=System.getProperty("String_Node_Str");
  StringBuffer str=new StringBuffer();
  str.append("String_Node_Str" + getChainID() + "String_Node_Str"+ newline);
  if (mol != null) {
    if (mol.getMolName() != null) {
      str.append(mol.getMolName()).append(newline);
    }
  }
  str.append("String_Node_Str" + getSeqResGroups().size() + "String_Node_Str"+ getAtomLength()+ "String_Node_Str"+ newline);
  for (int i=0; i < seqResGroups.size(); i++) {
    Group gr=(Group)seqResGroups.get(i);
    str.append(gr.toString()).append(newline);
  }
  return str.toString();
}

Fixed version (ground truth):
/** 
 * String representation.
 * @return String representation of the Chain
 */
public String toString(){
  String newline=System.getProperty("String_Node_Str");
  StringBuilder str=new StringBuilder();
  str.append("String_Node_Str" + getChainID() + "String_Node_Str"+ newline);
  if (mol != null) {
    if (mol.getMolName() != null) {
      str.append(mol.getMolName()).append(newline);
    }
  }
  str.append("String_Node_Str" + getSeqResGroups().size() + "String_Node_Str"+ getAtomLength()+ "String_Node_Str"+ newline);
  return str.toString();
}
Program: 16901
Project: 16901
Buggy source:
private void storeUnAlignedSeqRes(Structure structure,List<Chain> seqResChains){
  SeqRes2AtomAligner aligner=new SeqRes2AtomAligner();
  for (int i=0; i < structure.nrModels(); i++) {
    List<Chain> atomList=structure.getModel(i);
    for (    Chain seqRes : seqResChains) {
      Chain atomRes;
      atomRes=aligner.getMatchingAtomRes(seqRes,atomList);
      atomRes.setSeqResGroups(seqRes.getAtomGroups());
    }
  }
}

Fixed version (ground truth):
private void storeUnAlignedSeqRes(Structure structure,List<Chain> seqResChains){
  for (int i=0; i < structure.nrModels(); i++) {
    List<Chain> atomList=structure.getModel(i);
    for (    Chain seqRes : seqResChains) {
      Chain atomRes;
      atomRes=SeqRes2AtomAligner.getMatchingAtomRes(seqRes,atomList);
      atomRes.setSeqResGroups(seqRes.getAtomGroups());
    }
  }
}
Program: 16903
Project: 16903
Buggy source:
public Chain getMatchingAtomRes(Chain seqRes,List<Chain> atomList){
  Iterator<Chain> iter=atomList.iterator();
  while (iter.hasNext()) {
    Chain atomChain=iter.next();
    if (atomChain.getChainID().equals(seqRes.getChainID())) {
      return atomChain;
    }
  }
  logger.debug("String_Node_Str" + seqRes.getChainID() + "String_Node_Str"+ atomList.size());
  return null;
}

Fixed version (ground truth):
public static Chain getMatchingAtomRes(Chain seqRes,List<Chain> atomList){
  Iterator<Chain> iter=atomList.iterator();
  while (iter.hasNext()) {
    Chain atomChain=iter.next();
    if (atomChain.getChainID().equals(seqRes.getChainID())) {
      return atomChain;
    }
  }
  logger.debug("String_Node_Str" + seqRes.getChainID() + "String_Node_Str"+ atomList.size());
  return null;
}
Program: 16907
Project: 16907
Buggy source:
/** 
 * @author Daniel Cameron
 */
@Test public void testCaseEquivalence(){
  DNACompoundSet dnacs=DNACompoundSet.getDNACompoundSet();
  SubstitutionMatrix<NucleotideCompound> dnaTest=new SimpleSubstitutionMatrix<NucleotideCompound>(dnacs,"String_Node_Str","String_Node_Str");
  @SuppressWarnings("String_Node_Str") short[][] matrix=dnaTest.getMatrix();
  assertEquals(dnaTest.getValue(dnacs.getCompoundForString("String_Node_Str"),dnacs.getCompoundForString("String_Node_Str")),5);
  assertEquals(dnaTest.getValue(dnacs.getCompoundForString("String_Node_Str"),dnacs.getCompoundForString("String_Node_Str")),0);
  assertEquals(dnaTest.getValue(dnacs.getCompoundForString("String_Node_Str"),dnacs.getCompoundForString("String_Node_Str")),5);
  assertEquals(dnaTest.getValue(dnacs.getCompoundForString("String_Node_Str"),dnacs.getCompoundForString("String_Node_Str")),0);
}

Fixed version (ground truth):
@Test public void testCaseEquivalence(){
  DNACompoundSet dnacs=DNACompoundSet.getDNACompoundSet();
  SubstitutionMatrix<NucleotideCompound> dnaTest=new SimpleSubstitutionMatrix<NucleotideCompound>(dnacs,"String_Node_Str","String_Node_Str");
  @SuppressWarnings("String_Node_Str") short[][] matrix=dnaTest.getMatrix();
  assertEquals(dnaTest.getValue(dnacs.getCompoundForString("String_Node_Str"),dnacs.getCompoundForString("String_Node_Str")),5);
  assertEquals(dnaTest.getValue(dnacs.getCompoundForString("String_Node_Str"),dnacs.getCompoundForString("String_Node_Str")),0);
  assertEquals(dnaTest.getValue(dnacs.getCompoundForString("String_Node_Str"),dnacs.getCompoundForString("String_Node_Str")),5);
  assertEquals(dnaTest.getValue(dnacs.getCompoundForString("String_Node_Str"),dnacs.getCompoundForString("String_Node_Str")),0);
}
Program: 16908
Project: 16908
Buggy source:
public boolean compoundsEquivalent(C compoundOne,C compoundTwo){
  assertCompound(compoundOne);
  assertCompound(compoundTwo);
  return equivalentsMap.get(compoundOne).contains(compoundTwo);
}

Fixed version (ground truth):
public boolean compoundsEquivalent(C compoundOne,C compoundTwo){
  assertCompound(compoundOne);
  assertCompound(compoundTwo);
  return compoundOne.equals(compoundTwo) || equivalentsMap.get(compoundOne).contains(compoundTwo);
}
Program: 16909
Project: 16909
Buggy source:
private void assertCompound(C compound){
  boolean okay=hasCompound(compound);
  if (!okay) {
    logger.warn("String_Node_Str",getClass().getSimpleName(),compound);
  }
}

Fixed version (ground truth):
private void assertCompound(C compound){
  if (!hasCompound(compound)) {
    logger.warn("String_Node_Str",getClass().getSimpleName(),compound);
  }
}
Program: 16910
Project: 16910
Buggy source:
@Override @SuppressWarnings("String_Node_Str") public boolean equals(Object o){
  if (Equals.classEqual(this,o)) {
    AbstractCompoundSet<C> that=(AbstractCompoundSet<C>)o;
    return Equals.equal(charSeqToCompound,that.charSeqToCompound) && Equals.equal(equivalentsMap,that.equivalentsMap);
  }
  return false;
}

Fixed version (ground truth):
@Override @SuppressWarnings("String_Node_Str") public boolean equals(Object o){
  if (!(o instanceof AbstractCompoundSet))   return false;
  if (Equals.classEqual(this,o)) {
    AbstractCompoundSet<C> that=(AbstractCompoundSet<C>)o;
    return Equals.equal(charSeqToCompound,that.charSeqToCompound) && Equals.equal(equivalentsMap,that.equivalentsMap);
  }
  return false;
}
Program: 16911
Project: 16911
Buggy source:
public boolean hasCompound(C compound){
  C retrievedCompound=getCompoundForString(compound.toString());
  return (retrievedCompound == null) ? false : true;
}

Fixed version (ground truth):
public boolean hasCompound(C compound){
  C retrievedCompound=getCompoundForString(compound.toString());
  return retrievedCompound != null;
}
Program: 16912
Project: 16912
Buggy source:
@Override public boolean isCompoundStringLengthEqual(){
  if (compoundStringLengthEqual == null) {
    int lastSize=-1;
    compoundStringLengthEqual=Boolean.TRUE;
    for (    CharSequence c : charSeqToCompound.keySet()) {
      int size=c.length();
      if (lastSize != -1) {
        lastSize=size;
        continue;
      }
      if (lastSize != size) {
        compoundStringLengthEqual=Boolean.FALSE;
        break;
      }
    }
  }
  return compoundStringLengthEqual;
}

Fixed version (ground truth):
@Override public boolean isCompoundStringLengthEqual(){
  if (compoundStringLengthEqual == null) {
    int lastSize=-1;
    compoundStringLengthEqual=Boolean.TRUE;
    for (    CharSequence c : charSeqToCompound.keySet()) {
      if (lastSize != c.length()) {
        compoundStringLengthEqual=Boolean.FALSE;
        break;
      }
    }
  }
  return compoundStringLengthEqual;
}
Program: 16913
Project: 16913
Buggy source:
@Test public void test(){
  String[] uniprotIDs=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  for (  String id : uniprotIDs) {
    try {
      testUniprot(id);
      Thread.sleep(1000);
    }
 catch (    Exception e) {
      e.printStackTrace();
      fail(e.getMessage());
    }
  }
}

Fixed version (ground truth):
@Test public void test() throws IOException, InterruptedException {
  String[] uniprotIDs=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  for (  String id : uniprotIDs) {
    try {
      testUniprot(id);
      Thread.sleep(1000);
    }
 catch (    CompoundNotFoundException e) {
      fail(e.getMessage());
    }
  }
}
Program: 16914
Project: 16914
Buggy source:
private void testUniprot(String uniprotID) throws Exception {
  ProteinSequence seq=getUniprot(uniprotID);
  AminoAcidCompoundSet compoundSet=AminoAcidCompoundSet.getAminoAcidCompoundSet();
  assertTrue(compoundSet.isValidSequence(seq));
  @SuppressWarnings("String_Node_Str") float[] values=Jronn.getDisorderScores(seq);
}

Fixed version (ground truth):
private void testUniprot(String uniprotID) throws CompoundNotFoundException, IOException {
  ProteinSequence seq=getUniprot(uniprotID);
  AminoAcidCompoundSet compoundSet=AminoAcidCompoundSet.getAminoAcidCompoundSet();
  assertTrue(compoundSet.isValidSequence(seq));
  Jronn.getDisorderScores(seq);
}
Program: 16915
Project: 16915
Buggy source:
/** 
 * Fetch a protein sequence from the UniProt web site
 * @param uniProtID
 * @return a Protein Sequence
 * @throws Exception
 */
private static ProteinSequence getUniprot(String uniProtID) throws Exception {
  AminoAcidCompoundSet set=AminoAcidCompoundSet.getAminoAcidCompoundSet();
  UniprotProxySequenceReader<AminoAcidCompound> uniprotSequence=new UniprotProxySequenceReader<AminoAcidCompound>(uniProtID,set);
  ProteinSequence seq=new ProteinSequence(uniprotSequence);
  return seq;
}

Fixed version (ground truth):
/** 
 * Fetch a protein sequence from the UniProt web site
 * @param uniProtID
 * @return a Protein Sequence
 * @throws IOException 
 * @throws CompoundNotFoundException
 */
private static ProteinSequence getUniprot(String uniProtID) throws CompoundNotFoundException, IOException {
  AminoAcidCompoundSet set=AminoAcidCompoundSet.getAminoAcidCompoundSet();
  UniprotProxySequenceReader<AminoAcidCompound> uniprotSequence=new UniprotProxySequenceReader<AminoAcidCompound>(uniProtID,set);
  ProteinSequence seq=new ProteinSequence(uniprotSequence);
  return seq;
}
Program: 16916
Project: 16916
Buggy source:
public Structure rebuildQuaternaryStructure(Structure asymUnit,List<BiologicalAssemblyTransformation> transformations){
  orderTransformationsByChainId(asymUnit,transformations);
  Structure s=asymUnit.clone();
  s.setChains(new ArrayList<Chain>());
  for (  BiologicalAssemblyTransformation transformation : transformations) {
    for (    Chain c : asymUnit.getChains()) {
      String intChainID=c.getInternalChainID();
      if (intChainID == null) {
        intChainID=c.getChainID();
      }
      if (transformation.getChainId().equals(intChainID)) {
        Chain chain=(Chain)c.clone();
        for (        Group g : chain.getAtomGroups()) {
          for (          Atom a : g.getAtoms()) {
            transformation.transformPoint(a.getCoords());
          }
        }
        int modelNumber=Integer.parseInt(transformation.getId());
        addChainAndModel(s,chain,modelNumber);
      }
    }
  }
  s.setBiologicalAssembly(true);
  return s;
}

Fixed version (ground truth):
public Structure rebuildQuaternaryStructure(Structure asymUnit,List<BiologicalAssemblyTransformation> transformations){
  orderTransformationsByChainId(asymUnit,transformations);
  Structure s=asymUnit.clone();
  s.setChains(new ArrayList<Chain>());
  for (  BiologicalAssemblyTransformation transformation : transformations) {
    for (    Chain c : asymUnit.getChains()) {
      String intChainID=c.getInternalChainID();
      if (intChainID == null) {
        intChainID=c.getChainID();
      }
      if (transformation.getChainId().equals(intChainID)) {
        Chain chain=(Chain)c.clone();
        for (        Group g : chain.getAtomGroups()) {
          for (          Atom a : g.getAtoms()) {
            transformation.transformPoint(a.getCoords());
          }
        }
        String transformId=transformation.getId();
        addChainAndModel(s,chain,transformId);
      }
    }
  }
  s.setBiologicalAssembly(true);
  return s;
}
Program: 16917
Project: 16917
Buggy source:
private void addChainAndModel(Structure s,Chain newChain,int modelCount){
  if (modelCount == 0) {
    s.addChain(newChain);
  }
 else   if (modelCount > s.nrModels()) {
    List<Chain> newModel=new ArrayList<Chain>();
    newModel.add(newChain);
    s.addModel(newModel);
  }
 else {
    s.addChain(newChain,modelCount - 1);
  }
}

Fixed version (ground truth):
private void addChainAndModel(Structure s,Chain newChain,String modelId){
  int modelCount=modelIndex.indexOf(modelId);
  if (modelCount == -1) {
    modelIndex.add(modelId);
    modelCount=modelIndex.indexOf(modelId);
  }
  if (modelCount == 0) {
    s.addChain(newChain);
  }
 else   if (modelCount > s.nrModels()) {
    List<Chain> newModel=new ArrayList<Chain>();
    newModel.add(newChain);
    s.addModel(newModel);
  }
 else {
    s.addChain(newChain,modelCount - 1);
  }
}
Program: 16918
Project: 16918
Buggy source:
/** 
 * Get the status of the a collection of PDBs in question in a single query.
 * @see #getStatus(String)
 * @param pdbIds
 * @return The status array, or null if an error occurred.
 */
public static Status[] getStatus(String[] pdbIds){
  Status[] statuses=new Status[pdbIds.length];
  List<Map<String,String>> attrList=getStatusIdRecords(pdbIds);
  if (attrList == null || attrList.size() != pdbIds.length) {
    logger.error("String_Node_Str" + pdbIds + "String_Node_Str");
    return null;
  }
  for (int pdbNum=0; pdbNum < pdbIds.length; pdbNum++) {
    boolean foundAttr=false;
    for (    Map<String,String> attrs : attrList) {
      String id=attrs.get("String_Node_Str");
      if (id == null || !id.equalsIgnoreCase(pdbIds[pdbNum])) {
        continue;
      }
      String statusStr=attrs.get("String_Node_Str");
      if (statusStr == null) {
        logger.error("String_Node_Str" + pdbIds[pdbNum]);
        statuses[pdbNum]=null;
      }
      Status status=Status.fromString(statusStr);
      if (status == null) {
        logger.error("String_Node_Str" + statusStr + "String_Node_Str");
        statuses[pdbNum]=null;
      }
      statuses[pdbNum]=status;
      foundAttr=true;
    }
    if (!foundAttr) {
      logger.error("String_Node_Str" + pdbIds[pdbNum]);
      statuses[pdbNum]=null;
    }
  }
  return statuses;
}

Fixed version (ground truth):
/** 
 * Get the status of the a collection of PDBs in question in a single query.
 * @see #getStatus(String)
 * @param pdbIds
 * @return The status array, or null if an error occurred.
 */
public static Status[] getStatus(String[] pdbIds){
  Status[] statuses=new Status[pdbIds.length];
  List<Map<String,String>> attrList=getStatusIdRecords(pdbIds);
  if (attrList == null || attrList.size() != pdbIds.length) {
    logger.error("String_Node_Str",Arrays.toString(pdbIds));
    return null;
  }
  for (int pdbNum=0; pdbNum < pdbIds.length; pdbNum++) {
    boolean foundAttr=false;
    for (    Map<String,String> attrs : attrList) {
      String id=attrs.get("String_Node_Str");
      if (id == null || !id.equalsIgnoreCase(pdbIds[pdbNum])) {
        continue;
      }
      String statusStr=attrs.get("String_Node_Str");
      Status status=null;
      if (statusStr == null) {
        logger.error("String_Node_Str" + pdbIds[pdbNum]);
        statuses[pdbNum]=null;
      }
 else {
        status=Status.fromString(statusStr);
      }
      if (status == null) {
        logger.error("String_Node_Str",statusStr);
        statuses[pdbNum]=null;
      }
      statuses[pdbNum]=status;
      foundAttr=true;
    }
    if (!foundAttr) {
      logger.error("String_Node_Str" + pdbIds[pdbNum]);
      statuses[pdbNum]=null;
    }
  }
  return statuses;
}