nus-yam/ex-repair huggingface dataset:
Program: 16804
Project: 16804
Buggy source:
/** 
 * Returns the list of unique interfaces that the given Structure has upon generation of all crystal symmetry mates. An interface is defined as any pair of chains that contact, i.e. for which there is at least a pair of atoms (one from each chain) within the given cutoff distance.
 * @param cutoff the distance cutoff for 2 chains to be considered in contact
 * @return
 */
public StructureInterfaceList getUniqueInterfaces(double cutoff){
  StructureInterfaceList set=new StructureInterfaceList();
  initialiseVisited();
  calcInterfacesCrystal(set,cutoff,isCrystallographic);
  return set;
}

Fixed version (ground truth):
/** 
 * Returns the list of unique interfaces that the given Structure has upon generation of all crystal symmetry mates. An interface is defined as any pair of chains that contact, i.e. for which there is at least a pair of atoms (one from each chain) within the given cutoff distance.
 * @param cutoff the distance cutoff for 2 chains to be considered in contact
 * @return
 */
public StructureInterfaceList getUniqueInterfaces(double cutoff){
  StructureInterfaceList set=new StructureInterfaceList();
  if (structure.getChains().size() == 0) {
    logger.warn("String_Node_Str");
    return set;
  }
  initialiseVisited();
  calcInterfacesCrystal(set,cutoff,isCrystallographic);
  return set;
}
Program: 16805
Project: 16805
Buggy source:
/** 
 * Returns the list of unique interfaces that the given Structure has upon generation of all crystal symmetry mates. An interface is defined as any pair of chains that contact, i.e. for which there is at least a pair of atoms (one from each chain) within the given cutoff distance.
 * @param cutoff the distance cutoff for 2 chains to be considered in contact
 * @return
 */
public StructureInterfaceList getUniqueInterfaces(double cutoff){
  StructureInterfaceList set=new StructureInterfaceList();
  initialiseVisited();
  calcInterfacesCrystal(set,cutoff,structure.isCrystallographic());
  return set;
}

Fixed version (ground truth):
/** 
 * Returns the list of unique interfaces that the given Structure has upon generation of all crystal symmetry mates. An interface is defined as any pair of chains that contact, i.e. for which there is at least a pair of atoms (one from each chain) within the given cutoff distance.
 * @param cutoff the distance cutoff for 2 chains to be considered in contact
 * @return
 */
public StructureInterfaceList getUniqueInterfaces(double cutoff){
  StructureInterfaceList set=new StructureInterfaceList();
  initialiseVisited();
  calcInterfacesCrystal(set,cutoff,isCrystallographic);
  return set;
}
Program: 16806
Project: 16806
Buggy source:
public CrystalBuilder(Structure structure){
  this.structure=structure;
  this.crystallographicInfo=structure.getCrystallographicInfo();
  this.numChainsAu=structure.getChains().size();
  this.numOperatorsSg=1;
  if (structure.isCrystallographic()) {
    this.numOperatorsSg=this.crystallographicInfo.getSpaceGroup().getMultiplicity();
  }
  this.numCells=DEF_NUM_CELLS;
}

Fixed version (ground truth):
public CrystalBuilder(Structure structure){
  this.structure=structure;
  this.crystallographicInfo=structure.getCrystallographicInfo();
  this.numChainsAu=structure.getChains().size();
  this.numOperatorsSg=1;
  this.isCrystallographic=false;
  if (this.crystallographicInfo.getSpaceGroup() == null) {
    logger.warn("String_Node_Str");
  }
  if (structure.isCrystallographic() && this.crystallographicInfo.getSpaceGroup() != null) {
    this.numOperatorsSg=this.crystallographicInfo.getSpaceGroup().getMultiplicity();
    this.isCrystallographic=true;
  }
  this.numCells=DEF_NUM_CELLS;
}
Program: 16808
Project: 16808
Buggy source:
private void pdb_MODEL_Handler(String line){
  if (current_chain != null) {
    if (current_group != null) {
      current_chain.addGroup(current_group);
      current_group.trimToSize();
    }
    Chain ch=isKnownChain(current_chain.getChainID(),current_model);
    if (ch == null) {
      current_model.add(current_chain);
    }
    structure.addModel(current_model);
    current_model=new ArrayList<Chain>();
    current_chain=null;
    current_group=null;
  }
}

Fixed version (ground truth):
private void pdb_MODEL_Handler(String line){
  if (current_chain != null) {
    if (current_group != null) {
      current_chain.addGroup(current_group);
      current_group.trimToSize();
    }
    Chain ch=isKnownChain(current_chain.getChainID(),current_model);
    if (ch == null) {
      current_model.add(current_chain);
    }
    Iterator<Chain> it=current_model.iterator();
    while (it.hasNext()) {
      Chain c=it.next();
      if (StructureTools.isChainWaterOnly(c)) {
        logger.warn("String_Node_Str",c.getChainID(),c.getAtomGroups().size());
        it.remove();
      }
    }
    structure.addModel(current_model);
    current_model=new ArrayList<Chain>();
    current_chain=null;
    current_group=null;
  }
}
Program: 16811
Project: 16811
Buggy source:
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;
}

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.info("String_Node_Str" + seqRes.getChainID() + "String_Node_Str"+ atomList.size());
  return null;
}
Program: 16814
Project: 16814
Buggy source:
@Override public void newRefine(Refine r){
  PDBHeader pdbHeader=structure.getPDBHeader();
  if (pdbHeader.getResolution() != PDBHeader.DEFAULT_RESOLUTION) {
    logger.warn("String_Node_Str",r.getLs_d_res_high(),String.format("String_Node_Str",pdbHeader.getResolution()));
  }
  try {
    pdbHeader.setResolution(Float.parseFloat(r.getLs_d_res_high()));
  }
 catch (  NumberFormatException e) {
    logger.info("String_Node_Str" + r.getLs_d_res_high() + "String_Node_Str"+ e.getMessage());
  }
  if (pdbHeader.getRfree() != PDBHeader.DEFAULT_RFREE) {
    logger.warn("String_Node_Str",r.getLs_R_factor_R_free(),String.format("String_Node_Str",pdbHeader.getRfree()));
  }
  try {
    pdbHeader.setRfree(Float.parseFloat(r.getLs_R_factor_R_free()));
  }
 catch (  NumberFormatException e) {
    logger.debug("String_Node_Str",r.getLs_R_factor_R_free());
  }
}

Fixed version (ground truth):
@Override public void newRefine(Refine r){
  PDBHeader pdbHeader=structure.getPDBHeader();
  if (pdbHeader.getResolution() != PDBHeader.DEFAULT_RESOLUTION) {
    logger.warn("String_Node_Str",r.getLs_d_res_high(),String.format("String_Node_Str",pdbHeader.getResolution()));
  }
  try {
    pdbHeader.setResolution(Float.parseFloat(r.getLs_d_res_high()));
  }
 catch (  NumberFormatException e) {
    logger.info("String_Node_Str" + r.getLs_d_res_high() + "String_Node_Str"+ e.getMessage());
  }
  if (pdbHeader.getRfree() != PDBHeader.DEFAULT_RFREE) {
    logger.warn("String_Node_Str",r.getLs_R_factor_R_free(),String.format("String_Node_Str",pdbHeader.getRfree()));
  }
  if (r.getLs_R_factor_R_free() == null) {
    logger.info("String_Node_Str");
  }
 else {
    try {
      pdbHeader.setRfree(Float.parseFloat(r.getLs_R_factor_R_free()));
    }
 catch (    NumberFormatException e) {
      logger.debug("String_Node_Str",r.getLs_R_factor_R_free());
    }
  }
}
Program: 16815
Project: 16815
Buggy source:
/** 
 * Get the representative Chain for this Compound. We choose the Chain with the first chain identifier after lexicographical sorting, e.g. chain A if Compound is composed of chains A,B,C,D,E
 * @return
 */
public Chain getRepresentative(){
  String minChainId="String_Node_Str";
  Chain firstLexicographicalIdChain=null;
  for (  Chain chain : chains) {
    if (chain.getChainID().compareTo(minChainId) < 0) {
      minChainId=chain.getChainID();
      firstLexicographicalIdChain=chain;
    }
  }
  return firstLexicographicalIdChain;
}

Fixed version (ground truth):
/** 
 * Get the representative Chain for this Compound. We choose the Chain with the first chain identifier after lexicographical sorting (case insensitive),  e.g. chain A if Compound is composed of chains A,B,C,D,E
 * @return
 */
public Chain getRepresentative(){
  List<String> chainIds=new ArrayList<String>();
  for (  Chain chain : chains) {
    chainIds.add(chain.getChainID());
  }
  Collections.sort(chainIds,String.CASE_INSENSITIVE_ORDER);
  for (  Chain chain : chains) {
    if (chain.getChainID().equals(chainIds.get(0))) {
      return chain;
    }
  }
  logger.error("String_Node_Str",this.toString());
  return null;
}
Program: 16816
Project: 16816
Buggy source:
public static int[] setSteps(Last[][][] traceback,int[] xyMax,List<Step> sx,List<Step> sy){
  return setSteps(traceback,true,xyMax,Last.SUBSTITUTION,sx,sy);
}

Fixed version (ground truth):
/** 
 * Find local alignment path through traceback matrix
 * @param traceback
 * @param xyMax
 * @param sx
 * @param sy
 * @return
 */
public static int[] setSteps(Last[][][] traceback,int[] xyMax,List<Step> sx,List<Step> sy){
  return setSteps(traceback,true,xyMax,Last.SUBSTITUTION,sx,sy);
}
Program: 16817
Project: 16817
Buggy source:
public static Last[][] setScoreVector(int x,int xb,int yb,int ye,int gep,int[] subs,boolean storing,int[][][] scores,int[] xyMax,int score){
  Last[][] pointers;
  ensureScoringMatrixColumn(x,storing,scores);
  if (x == xb) {
    pointers=new Last[ye + 1][1];
  }
 else {
    pointers=new Last[ye + 1][];
    pointers[0]=new Last[1];
    for (int y=1; y < scores[x].length; y++) {
      pointers[y][0]=setScorePoint(x,y,gep,subs[y],scores);
      if (scores[x][y][0] <= 0) {
        scores[x][y][0]=0;
        pointers[y][0]=null;
      }
 else       if (scores[x][y][0] > score) {
        xyMax[0]=x;
        xyMax[1]=y;
        score=scores[x][y][0];
      }
    }
  }
  return pointers;
}

Fixed version (ground truth):
/** 
 * Score local alignment for a given position in the query sequence for a linear gap penalty
 * @param x
 * @param xb
 * @param yb
 * @param ye
 * @param gep
 * @param subs
 * @param storing
 * @param scores
 * @param xyMax
 * @param score
 * @return
 */
public static Last[][] setScoreVector(int x,int xb,int yb,int ye,int gep,int[] subs,boolean storing,int[][][] scores,int[] xyMax,int score){
  Last[][] pointers;
  ensureScoringMatrixColumn(x,storing,scores);
  if (x == xb) {
    pointers=new Last[ye + 1][1];
  }
 else {
    pointers=new Last[ye + 1][];
    pointers[0]=new Last[1];
    for (int y=1; y < scores[x].length; y++) {
      pointers[y][0]=setScorePoint(x,y,gep,subs[y],scores);
      if (scores[x][y][0] <= 0) {
        scores[x][y][0]=0;
        pointers[y][0]=null;
      }
 else       if (scores[x][y][0] > score) {
        xyMax[0]=x;
        xyMax[1]=y;
        score=scores[x][y][0];
      }
    }
  }
  return pointers;
}
Program: 16818
Project: 16818
Buggy source:
/** 
 * Converts a list of anchors into a subproblem list.
 * @param anchors anchored read pairs
 * @param querySequenceLength length of query sequence
 * @param targetSequenceLength length of target sequence
 * @return list alignment subproblems
 */
public static List<Subproblem> getSubproblems(List<Anchor> anchors,int querySequenceLength,int targetSequenceLength){
  Collections.sort(anchors,new Anchor.QueryIndexComparator());
  List<Subproblem> list=new ArrayList<Subproblem>();
  Anchor last=new Anchor(-1,-1);
  boolean isAnchored=false;
  for (int i=0; i < anchors.size(); i++) {
    if (anchors.get(i).targetIndex <= last.targetIndex || anchors.get(i).queryIndex <= last.queryIndex) {
      throw new IllegalArgumentException("String_Node_Str");
    }
    list.add(new Subproblem(last.queryIndex + 1,last.targetIndex + 1,anchors.get(i).queryIndex,anchors.get(i).targetIndex,isAnchored));
    last=anchors.get(i);
    isAnchored=true;
  }
  list.add(new Subproblem(last.queryIndex + 1,last.targetIndex + 1,querySequenceLength,targetSequenceLength,isAnchored));
  return list;
}

Fixed version (ground truth):
/** 
 * Convert a list of anchors into a subproblem list.
 * @param anchors anchored read pairs
 * @param querySequenceLength length of query sequence
 * @param targetSequenceLength length of target sequence
 * @return list alignment subproblems
 */
public static List<Subproblem> getSubproblems(List<Anchor> anchors,int querySequenceLength,int targetSequenceLength){
  Collections.sort(anchors,new Anchor.QueryIndexComparator());
  List<Subproblem> list=new ArrayList<Subproblem>();
  Anchor last=new Anchor(-1,-1);
  boolean isAnchored=false;
  for (int i=0; i < anchors.size(); i++) {
    if (anchors.get(i).targetIndex <= last.targetIndex || anchors.get(i).queryIndex <= last.queryIndex) {
      throw new IllegalArgumentException("String_Node_Str");
    }
    list.add(new Subproblem(last.queryIndex + 1,last.targetIndex + 1,anchors.get(i).queryIndex,anchors.get(i).targetIndex,isAnchored));
    last=anchors.get(i);
    isAnchored=true;
  }
  list.add(new Subproblem(last.queryIndex + 1,last.targetIndex + 1,querySequenceLength,targetSequenceLength,isAnchored));
  return list;
}
Program: 16819
Project: 16819
Buggy source:
public FarmJobRunnable(FarmJobParameters params){
  terminated=false;
  this.params=params;
  verbose=false;
  cache=new AtomCache(params.getPdbFilePath(),params.getCacheFilePath());
  if (params.getServer() != null && (!params.getServer().equals("String_Node_Str"))) {
    RemotePDPProvider pdpprovider=new RemotePDPProvider();
    String serverURL=params.getServer();
    if (!serverURL.endsWith("String_Node_Str"))     serverURL+="String_Node_Str";
    if (serverURL.endsWith(alignURL)) {
      serverURL=serverURL.substring(0,serverURL.length() - alignURL.length());
    }
    pdpprovider.setServer(serverURL + "String_Node_Str");
    cache.setPdpprovider(pdpprovider);
    RemoteScopInstallation scop=new RemoteScopInstallation();
    scop.setServer(serverURL + "String_Node_Str");
    ScopFactory.setScopDatabase(scop);
  }
  FileParsingParameters fparams=cache.getFileParsingParams();
  fparams.setUpdateRemediatedFiles(params.isUpdateRemediatedFiles());
  maxNrAlignments=params.getNrAlignments();
  progressListeners=null;
  if (params.getUsername() == null) {
    userName=randomUsername;
  }
 else {
    userName=params.getUsername();
  }
  counter=new CountProgressListener();
  addAlignmentProgressListener(counter);
  waitForAlignments=true;
  if (params.isVerbose()) {
    verbose=true;
  }
}

Fixed version (ground truth):
public FarmJobRunnable(FarmJobParameters params){
  terminated=false;
  this.params=params;
  verbose=false;
  cache=new AtomCache(params.getPdbFilePath(),params.getCacheFilePath());
  if (params.getServer() != null && (!params.getServer().equals("String_Node_Str"))) {
    RemotePDPProvider pdpprovider=new RemotePDPProvider();
    String serverURL=params.getServer();
    if (!serverURL.endsWith("String_Node_Str"))     serverURL+="String_Node_Str";
    if (serverURL.endsWith(alignURL)) {
      serverURL=serverURL.substring(0,serverURL.length() - alignURL.length());
    }
    pdpprovider.setServer(serverURL + "String_Node_Str");
    cache.setPdpprovider(pdpprovider);
    RemoteScopInstallation scop=new RemoteScopInstallation();
    scop.setServer(serverURL + "String_Node_Str");
    ScopFactory.setScopDatabase(scop);
  }
  cache.setFetchBehavior(FetchBehavior.FETCH_REMEDIATED);
  maxNrAlignments=params.getNrAlignments();
  progressListeners=null;
  if (params.getUsername() == null) {
    userName=randomUsername;
  }
 else {
    userName=params.getUsername();
  }
  counter=new CountProgressListener();
  addAlignmentProgressListener(counter);
  waitForAlignments=true;
  if (params.isVerbose()) {
    verbose=true;
  }
}
Program: 16820
Project: 16820
Buggy source:
/** 
 * @deprecated Use {@link #getFetchBehavior()}
 */
@Deprecated @Override public void setAutoFetch(boolean autoFetch){
  if (autoFetch) {
    setFetchBehavior(FetchBehavior.DEFAULT);
  }
 else {
    setFetchBehavior(FetchBehavior.LOCAL_ONLY);
  }
}

Fixed version (ground truth):
/** 
 * @deprecated Use {@link #setFetchBehavior()}
 */
@Deprecated public void setAutoFetch(boolean autoFetch){
  if (autoFetch) {
    setFetchBehavior(FetchBehavior.DEFAULT);
  }
 else {
    setFetchBehavior(FetchBehavior.LOCAL_ONLY);
  }
}
Program: 16821
Project: 16821
Buggy source:
/** 
 * Returns the path value.
 * @return a String representing the path value
 * @see #setPath
 */
@SuppressWarnings("String_Node_Str") @Override public String getPath(){
  return path.toString();
}

Fixed version (ground truth):
/** 
 * Returns the path value.
 * @return a String representing the path value
 * @see #setPath
 */
public String getPath(){
  return path.toString();
}
Program: 16822
Project: 16822
Buggy source:
/** 
 * @deprecated Use {@link #getFetchBehavior()}
 */
@Deprecated @Override public boolean isAutoFetch(){
  return fetchBehavior != FetchBehavior.LOCAL_ONLY;
}

Fixed version (ground truth):
/** 
 * @deprecated Use {@link #getFetchBehavior()}
 */
@Deprecated public boolean isAutoFetch(){
  return fetchBehavior != FetchBehavior.LOCAL_ONLY;
}
Program: 16823
Project: 16823
Buggy source:
/** 
 * Sets the path for the directory where PDB files are read/written 
 */
@SuppressWarnings("String_Node_Str") @Override public void setPath(String p){
  path=new File(FileDownloadUtils.expandUserHome(p));
  initPaths();
}

Fixed version (ground truth):
/** 
 * Sets the path for the directory where PDB files are read/written 
 */
public void setPath(String p){
  path=new File(FileDownloadUtils.expandUserHome(p));
  initPaths();
}
Program: 16824
Project: 16824
Buggy source:
/** 
 * Attempts to delete all versions of a structure from the local directory.
 * @param pdbId
 * @return True if one or more files were deleted
 */
public boolean deleteStructure(String pdbId){
  boolean deleted=false;
  File existing=getLocalFile(pdbId);
  while (existing != null) {
    assert(existing.exists());
    if (getFetchBehavior() == FetchBehavior.LOCAL_ONLY) {
      throw new RuntimeException("String_Node_Str");
    }
    boolean success=existing.delete();
    if (success) {
      logger.info("String_Node_Str" + existing.getAbsolutePath());
    }
    deleted|=success;
    File parent=existing.getParentFile();
    if (parent != null) {
      success=parent.delete();
      if (success) {
        logger.info("String_Node_Str" + parent.getAbsolutePath());
      }
    }
    existing=getLocalFile(pdbId);
  }
  return deleted;
}

Fixed version (ground truth):
/** 
 * Attempts to delete all versions of a structure from the local directory.
 * @param pdbId
 * @return True if one or more files were deleted
 */
public boolean deleteStructure(String pdbId){
  boolean deleted=false;
  ObsoleteBehavior obsolete=getObsoleteBehavior();
  setObsoleteBehavior(ObsoleteBehavior.FETCH_OBSOLETE);
  try {
    File existing=getLocalFile(pdbId);
    while (existing != null) {
      assert(existing.exists());
      if (getFetchBehavior() == FetchBehavior.LOCAL_ONLY) {
        throw new RuntimeException("String_Node_Str");
      }
      boolean success=existing.delete();
      if (success) {
        logger.info("String_Node_Str" + existing.getAbsolutePath());
      }
      deleted=deleted || success;
      File parent=existing.getParentFile();
      if (parent != null) {
        success=parent.delete();
        if (success) {
          logger.info("String_Node_Str" + parent.getAbsolutePath());
        }
      }
      existing=getLocalFile(pdbId);
    }
    return deleted;
  }
  finally {
    setObsoleteBehavior(obsolete);
  }
}
Program: 16825
Project: 16825
Buggy source:
/** 
 * Should be called whenever any of the path variables change. Thus, if   {@link getSplitDirPath()} or {@link getObsoleteDirPath()}depend on anything, they should call this function when that thing changes (possibly including at the end of the constructor).
 */
protected void initPaths(){
  String[] split=getSplitDirPath();
  String[] obsolete=getObsoleteDirPath();
  StringBuilder splitURL=new StringBuilder("String_Node_Str");
  for (int i=0; i < split.length; i++) {
    splitURL.append("String_Node_Str");
    splitURL.append(split[i]);
  }
  StringBuilder obsoleteURL=new StringBuilder("String_Node_Str");
  for (int i=0; i < obsolete.length; i++) {
    obsoleteURL.append("String_Node_Str");
    obsoleteURL.append(obsolete[i]);
  }
  splitDirURL=splitURL.toString();
  obsoleteDirURL=obsoleteURL.toString();
  splitDirPath=path;
  for (int i=0; i < split.length; i++) {
    splitDirPath=new File(splitDirPath,split[i]);
  }
  obsoleteDirPath=path;
  for (int i=0; i < obsolete.length; i++) {
    obsoleteDirPath=new File(obsoleteDirPath,split[i]);
  }
}

Fixed version (ground truth):
/** 
 * Should be called whenever any of the path variables change. Thus, if   {@link getSplitDirPath()} or {@link getObsoleteDirPath()}depend on anything, they should call this function when that thing changes (possibly including at the end of the constructor).
 */
protected void initPaths(){
  String[] split=getSplitDirPath();
  String[] obsolete=getObsoleteDirPath();
  StringBuilder splitURL=new StringBuilder("String_Node_Str");
  for (int i=0; i < split.length; i++) {
    splitURL.append("String_Node_Str");
    splitURL.append(split[i]);
  }
  StringBuilder obsoleteURL=new StringBuilder("String_Node_Str");
  for (int i=0; i < obsolete.length; i++) {
    obsoleteURL.append("String_Node_Str");
    obsoleteURL.append(obsolete[i]);
  }
  splitDirURL=splitURL.toString();
  obsoleteDirURL=obsoleteURL.toString();
  splitDirPath=path;
  for (int i=0; i < split.length; i++) {
    splitDirPath=new File(splitDirPath,split[i]);
  }
  obsoleteDirPath=path;
  for (int i=0; i < obsolete.length; i++) {
    obsoleteDirPath=new File(obsoleteDirPath,obsolete[i]);
  }
}
Program: 16826
Project: 16826
Buggy source:
@Before public void setUp(){
  cache=new AtomCache();
  String[] uncacheIDs=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"};
  List<LocalPDBDirectory> readers=new ArrayList<LocalPDBDirectory>();
  readers.add(new MMCIFFileReader(cache.getPath()));
  readers.add(new PDBFileReader(cache.getCachePath()));
  for (  LocalPDBDirectory reader : readers) {
    reader.setFetchBehavior(cache.getFetchBehavior());
    reader.setObsoleteBehavior(cache.getObsoleteBehavior());
    for (    String pdbId : uncacheIDs) {
      reader.deleteStructure(pdbId);
    }
  }
}

Fixed version (ground truth):
@Before public void setUp(){
  cache=new AtomCache();
  String[] uncacheIDs=new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"};
  List<LocalPDBDirectory> readers=new ArrayList<LocalPDBDirectory>();
  readers.add(new MMCIFFileReader(cache.getPath()));
  readers.add(new PDBFileReader(cache.getPath()));
  for (  LocalPDBDirectory reader : readers) {
    reader.setFetchBehavior(cache.getFetchBehavior());
    reader.setObsoleteBehavior(cache.getObsoleteBehavior());
    for (    String pdbId : uncacheIDs) {
      reader.deleteStructure(pdbId);
    }
  }
}
Program: 16827
Project: 16827
Buggy source:
/** 
 * Download a structure, but don't parse it yet or store it in memory. Used to pre-fetch large numbers of structures.
 * @param pdbId
 * @throws IOException 
 */
public void prefetchStructure(String pdbId) throws IOException {
  if (pdbId.length() < 4)   throw new IOException("String_Node_Str" + pdbId);
  File file=getLocalFile(pdbId);
  if (file == null) {
    file=downloadStructure(pdbId);
  }
  if (!file.exists()) {
    throw new IOException("String_Node_Str" + pdbId + "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Download a structure, but don't parse it yet or store it in memory. Used to pre-fetch large numbers of structures.
 * @param pdbId
 * @throws IOException 
 */
public void prefetchStructure(String pdbId) throws IOException {
  if (pdbId.length() < 4)   throw new IOException("String_Node_Str" + pdbId);
  File file=downloadStructure(pdbId);
  if (!file.exists()) {
    throw new IOException("String_Node_Str" + pdbId + "String_Node_Str");
  }
}
Program: 16828
Project: 16828
Buggy source:
/** 
 * Load or download the specified structure and return it as an InputStream for direct parsing.
 * @param pdbId
 * @return
 * @throws IOException
 */
protected InputStream getInputStream(String pdbId) throws IOException {
  if (pdbId.length() < 4)   throw new IOException("String_Node_Str" + pdbId);
  File file=getLocalFile(pdbId);
  if (file == null) {
    file=downloadStructure(pdbId);
  }
  if (!file.exists()) {
    throw new IOException("String_Node_Str" + pdbId + "String_Node_Str");
  }
  InputStreamProvider isp=new InputStreamProvider();
  InputStream inputStream=isp.getInputStream(file);
  return inputStream;
}

Fixed version (ground truth):
/** 
 * Load or download the specified structure and return it as an InputStream for direct parsing.
 * @param pdbId
 * @return
 * @throws IOException
 */
protected InputStream getInputStream(String pdbId) throws IOException {
  if (pdbId.length() < 4)   throw new IOException("String_Node_Str" + pdbId);
  File file=downloadStructure(pdbId);
  if (!file.exists()) {
    throw new IOException("String_Node_Str" + pdbId + "String_Node_Str");
  }
  InputStreamProvider isp=new InputStreamProvider();
  InputStream inputStream=isp.getInputStream(file);
  return inputStream;
}
Program: 16829
Project: 16829
Buggy source:
public static void main(String[] args) throws Exception {
  String uniprotID1="String_Node_Str";
  String uniprotID2="String_Node_Str";
  ProteinSequence s1=getSequenceForId(uniprotID1);
  ProteinSequence s2=getSequenceForId(uniprotID2);
  SubstitutionMatrix<AminoAcidCompound> matrix=SubstitutionMatrixHelper.getBlosum65();
  GapPenalty penalty=new SimpleGapPenalty();
  short gop=8;
  short extend=1;
  penalty.setOpenPenalty(gop);
  penalty.setExtensionPenalty(extend);
  PairwiseSequenceAligner<ProteinSequence,AminoAcidCompound> smithWaterman=Alignments.getPairwiseAligner(s1,s2,PairwiseSequenceAlignerType.LOCAL,penalty,matrix);
  SequencePair<ProteinSequence,AminoAcidCompound> pair=smithWaterman.getPair();
  System.out.println(pair.toString(60));
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  String uniprotID1="String_Node_Str";
  String uniprotID2="String_Node_Str";
  ProteinSequence s1=getSequenceForId(uniprotID1);
  ProteinSequence s2=getSequenceForId(uniprotID2);
  SubstitutionMatrix<AminoAcidCompound> matrix=SubstitutionMatrixHelper.getBlosum65();
  GapPenalty penalty=new SimpleGapPenalty();
  int gop=8;
  int extend=1;
  penalty.setOpenPenalty(gop);
  penalty.setExtensionPenalty(extend);
  PairwiseSequenceAligner<ProteinSequence,AminoAcidCompound> smithWaterman=Alignments.getPairwiseAligner(s1,s2,PairwiseSequenceAlignerType.LOCAL,penalty,matrix);
  SequencePair<ProteinSequence,AminoAcidCompound> pair=smithWaterman.getPair();
  System.out.println(pair.toString(60));
}
Program: 16831
Project: 16831
Buggy source:
/** 
 * Sets the default gap extension penalty.
 * @param gep the default gap extension penalty
 */
public static void setDefaultExtensionPenalty(short gep){
  dgep=gep;
}

Fixed version (ground truth):
/** 
 * Sets the default gap extension penalty.
 * @param gep the default gap extension penalty
 */
public static void setDefaultExtensionPenalty(int gep){
  dgep=gep;
}
Program: 16832
Project: 16832
Buggy source:
/** 
 * @param gop Should be nonnegative
 */
@Override public void setOpenPenalty(short gop){
  this.gop=(short)-Math.abs(gop);
  setType();
}

Fixed version (ground truth):
/** 
 * @param gop Should be nonnegative
 */
@Override public void setOpenPenalty(int gop){
  this.gop=-Math.abs(gop);
  setType();
}
Program: 16833
Project: 16833
Buggy source:
/** 
 * <strong>Returns the negative of the opening penalty passed to the constructor.</strong>
 */
@Override public short getOpenPenalty(){
  return gop;
}

Fixed version (ground truth):
/** 
 * <strong>Returns the negative of the opening penalty passed to the constructor.</strong>
 */
@Override public int getOpenPenalty(){
  return gop;
}
Program: 16834
Project: 16834
Buggy source:
/** 
 * <strong>Returns the negative of the extension penalty passed to the constructor.</strong>
 */
@Override public short getExtensionPenalty(){
  return gep;
}

Fixed version (ground truth):
/** 
 * <strong>Returns the negative of the extension penalty passed to the constructor.</strong>
 */
@Override public int getExtensionPenalty(){
  return gep;
}
Program: 16835
Project: 16835
Buggy source:
/** 
 * Sets the default gap open penalty.
 * @param gop the default gap open penalty
 */
public static void setDefaultOpenPenalty(short gop){
  dgop=gop;
}

Fixed version (ground truth):
/** 
 * Sets the default gap open penalty.
 * @param gop the default gap open penalty
 */
public static void setDefaultOpenPenalty(int gop){
  dgop=gop;
}
Program: 16836
Project: 16836
Buggy source:
/** 
 * Creates a new set of gap penalties.
 * @param gop the gap open penalty; should be nonnegative
 * @param gep the gap extension penalty; should be nonnegative
 */
public SimpleGapPenalty(short gop,short gep){
  this.gop=(short)-Math.abs(gop);
  this.gep=(short)-Math.abs(gep);
  setType();
}

Fixed version (ground truth):
/** 
 * Creates a new set of gap penalties.
 * @param gop the gap open penalty; should be nonnegative
 * @param gep the gap extension penalty; should be nonnegative
 */
public SimpleGapPenalty(int gop,int gep){
  this.gop=-Math.abs(gop);
  this.gep=-Math.abs(gep);
  setType();
}
Program: 16837
Project: 16837
Buggy source:
/** 
 * @param gep Should be nonnegative
 */
@Override public void setExtensionPenalty(short gep){
  this.gep=(short)-Math.abs(gep);
  setType();
}

Fixed version (ground truth):
/** 
 * @param gep Should be nonnegative
 */
@Override public void setExtensionPenalty(int gep){
  this.gep=-Math.abs(gep);
  setType();
}
Program: 16838
Project: 16838
Buggy source:
public DefaultAAIndexProvider(){
  InputStream inStream=getInputStreamToAAindexFile();
  AAIndexFileParser parser=new AAIndexFileParser();
  try {
    parser.parse(inStream);
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
  }
  matrices=parser.getMatrices();
}

Fixed version (ground truth):
public DefaultAAIndexProvider(){
  InputStream inStream=getInputStreamToAAindexFile();
  AAIndexFileParser parser=new AAIndexFileParser();
  try {
    parser.parse(inStream);
  }
 catch (  IOException e) {
    logger.error("String_Node_Str",e);
  }
  matrices=parser.getMatrices();
}
Program: 16839
Project: 16839
Buggy source:
/** 
 * Sets penalty given when a deletion or insertion gap first opens
 * @param gop gap open penalty
 */
void setOpenPenalty(short gop);

Fixed version (ground truth):
/** 
 * Sets penalty given when a deletion or insertion gap first opens
 * @param gop gap open penalty
 */
void setOpenPenalty(int gop);
Program: 16840
Project: 16840
Buggy source:
/** 
 * Returns penalty given when a deletion or insertion gap first opens
 * @return gap open penalty
 */
short getOpenPenalty();

Fixed version (ground truth):
/** 
 * Returns penalty given when a deletion or insertion gap first opens
 * @return gap open penalty
 */
int getOpenPenalty();
Program: 16841
Project: 16841
Buggy source:
/** 
 * Returns penalty given when an already open gap elongates by a single element
 * @return gap extension penalty
 */
short getExtensionPenalty();

Fixed version (ground truth):
/** 
 * Returns penalty given when an already open gap elongates by a single element
 * @return gap extension penalty
 */
int getExtensionPenalty();
Program: 16842
Project: 16842
Buggy source:
/** 
 * Sets penalty given when an already open gap elongates by a single element
 * @param gep gap extension penalty
 */
void setExtensionPenalty(short gep);

Fixed version (ground truth):
/** 
 * Sets penalty given when an already open gap elongates by a single element
 * @param gep gap extension penalty
 */
void setExtensionPenalty(int gep);
Program: 16843
Project: 16843
Buggy source:
@Test public void testSimpleGapPenalty(){
  short gop=-12, gep=-3;
  GapPenalty defaults=new SimpleGapPenalty();
  SimpleGapPenalty.setDefaultOpenPenalty(gop);
  SimpleGapPenalty.setDefaultExtensionPenalty(gep);
  GapPenalty gaps=new SimpleGapPenalty();
  assertEquals(gaps.getOpenPenalty(),gop);
  assertEquals(gaps.getExtensionPenalty(),gep);
  assertEquals(gaps.getType(),GapPenalty.Type.AFFINE);
  SimpleGapPenalty.setDefaultOpenPenalty(defaults.getOpenPenalty());
  SimpleGapPenalty.setDefaultExtensionPenalty(defaults.getExtensionPenalty());
}

Fixed version (ground truth):
@Test public void testSimpleGapPenalty(){
  int gop=-12, gep=-3;
  GapPenalty defaults=new SimpleGapPenalty();
  SimpleGapPenalty.setDefaultOpenPenalty(gop);
  SimpleGapPenalty.setDefaultExtensionPenalty(gep);
  GapPenalty gaps=new SimpleGapPenalty();
  assertEquals(gaps.getOpenPenalty(),gop);
  assertEquals(gaps.getExtensionPenalty(),gep);
  assertEquals(gaps.getType(),GapPenalty.Type.AFFINE);
  SimpleGapPenalty.setDefaultOpenPenalty(defaults.getOpenPenalty());
  SimpleGapPenalty.setDefaultExtensionPenalty(defaults.getExtensionPenalty());
}
Program: 16846
Project: 16846
Buggy source:
/** 
 * Returns Nuc 4.4 matrix by Lowe
 * @return Nuc 4.4 matrix
 */
public static SubstitutionMatrix<NucleotideCompound> getNuc4_4(){
  return getNucleotideMatrix("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Returns Nuc 4.4 matrix by Lowe Both of the nucleotide sequences to align can contain ambiguous nucleotides
 * @return Nuc 4.4 matrix
 */
public static SubstitutionMatrix<NucleotideCompound> getNuc4_4(){
  return getNucleotideMatrix("String_Node_Str");
}
Program: 16847
Project: 16847
Buggy source:
/** 
 * Returns Nuc 4.2 matrix by Lowe
 * @return Nuc 4.2 matrix
 */
public static SubstitutionMatrix<NucleotideCompound> getNuc4_2(){
  return getNucleotideMatrix("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Returns Nuc 4.2 matrix by Lowe Only the first nucleotide sequence to align can contain ambiguous nucleotides
 * @return Nuc 4.2 matrix
 */
public static SubstitutionMatrix<NucleotideCompound> getNuc4_2(){
  return getNucleotideMatrix("String_Node_Str");
}
Program: 16848
Project: 16848
Buggy source:
protected void align(){
}

Fixed version (ground truth):
/** 
 * Performs alignment
 */
protected void align(){
}
Program: 16849
Project: 16849
Buggy source:
protected int[] getSubstitutionScoreVector(int queryColumn,Subproblem subproblem){
  int[] subs=new int[subproblem.getTargetEndIndex() + 1];
  if (queryColumn > 0) {
    for (int y=Math.max(1,subproblem.getTargetStartIndex()); y <= subproblem.getTargetEndIndex(); y++) {
      subs[y]=getSubstitutionScore(queryColumn,y);
    }
  }
  return subs;
}

Fixed version (ground truth):
/** 
 * Returns score for the alignment of the query column to all target columns
 * @param queryColumn
 * @param subproblem
 * @return
 */
protected int[] getSubstitutionScoreVector(int queryColumn,Subproblem subproblem){
  int[] subs=new int[subproblem.getTargetEndIndex() + 1];
  if (queryColumn > 0) {
    for (int y=Math.max(1,subproblem.getTargetStartIndex()); y <= subproblem.getTargetEndIndex(); y++) {
      subs[y]=getSubstitutionScore(queryColumn,y);
    }
  }
  return subs;
}
Program: 16850
Project: 16850
Buggy source:
protected void reset(){
  xyMax=new int[]{0,0};
  xyStart=new int[]{0,0};
  scores=null;
  types=(gapPenalty == null || gapPenalty.getType() == GapPenalty.Type.LINEAR) ? new String[]{null} : new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"};
  time=-1;
  profile=null;
}

Fixed version (ground truth):
/** 
 * Resets output fields; should be overridden to set max and min
 */
protected void reset(){
  xyMax=new int[]{0,0};
  xyStart=new int[]{0,0};
  scores=null;
  types=(gapPenalty == null || gapPenalty.getType() == GapPenalty.Type.LINEAR) ? new String[]{null} : new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"};
  time=-1;
  profile=null;
}
Program: 16855
Project: 16855
Buggy source:
/** 
 * attempts to reduce the memory imprint of this group by trimming  all internal Collection objects to the required size.
 */
@SuppressWarnings("String_Node_Str") public void trimToSize(){
  if (atoms instanceof ArrayList) {
    ArrayList myatoms=(ArrayList)atoms;
    myatoms.trimToSize();
  }
  if (altLocs instanceof ArrayList) {
    ArrayList myAltLocs=(ArrayList)altLocs;
    myAltLocs.trimToSize();
  }
  atomNameLookup=new HashMap<String,Atom>(atomNameLookup);
  if (hasAltLoc()) {
    for (    Group alt : getAltLocs()) {
      alt.trimToSize();
    }
  }
}

Fixed version (ground truth):
/** 
 * attempts to reduce the memory imprint of this group by trimming  all internal Collection objects to the required size.
 */
public void trimToSize(){
  if (atoms instanceof ArrayList<?>) {
    ArrayList<Atom> myatoms=(ArrayList<Atom>)atoms;
    myatoms.trimToSize();
  }
  if (altLocs instanceof ArrayList<?>) {
    ArrayList<Group> myAltLocs=(ArrayList<Group>)altLocs;
    myAltLocs.trimToSize();
  }
  atomNameLookup=new HashMap<String,Atom>(atomNameLookup);
  if (hasAltLoc()) {
    for (    Group alt : getAltLocs()) {
      alt.trimToSize();
    }
  }
}
Program: 16858
Project: 16858
Buggy source:
@Test public void test3PIUmmcif() throws IOException, StructureException {
  AtomCache cache=new AtomCache();
  StructureIO.setAtomCache(cache);
  cache.setUseMmCif(true);
  Structure structure=StructureIO.getStructure("String_Node_Str");
  assertNotNull(structure);
  Atom[] ca=StructureTools.getAtomCAArray(structure);
  List<Atom> caList=new ArrayList<Atom>();
  for (  Chain c : structure.getChains()) {
    for (    Group g : c.getAtomGroups()) {
      for (      Group altLocGroup : g.getAltLocs()) {
        ensureAllAtomsSameAltCode(altLocGroup);
      }
      List<Atom> atoms=g.getAtoms();
      boolean caInMain=false;
      for (      Atom a : atoms) {
        if (a.getName().equals(StructureTools.CA_ATOM_NAME)) {
          caList.add(a);
          caInMain=true;
          break;
        }
      }
      if (!caInMain && g.hasAtom(StructureTools.CA_ATOM_NAME)) {
        fail("String_Node_Str");
      }
    }
  }
  assertEquals(ca.length,caList.size());
}

Fixed version (ground truth):
@Test public void test3PIUmmcif() throws IOException, StructureException {
  AtomCache cache=new AtomCache();
  FileParsingParameters params=new FileParsingParameters();
  params.setAlignSeqRes(true);
  cache.setFileParsingParams(params);
  StructureIO.setAtomCache(cache);
  cache.setUseMmCif(true);
  Structure structure=StructureIO.getStructure("String_Node_Str");
  assertNotNull(structure);
  Atom[] ca=StructureTools.getAtomCAArray(structure);
  List<Atom> caList=new ArrayList<Atom>();
  for (  Chain c : structure.getChains()) {
    for (    Group g : c.getAtomGroups()) {
      for (      Group altLocGroup : g.getAltLocs()) {
        ensureAllAtomsSameAltCode(altLocGroup);
        for (        Atom a : altLocGroup.getAtoms()) {
          assertNotNull(a.getGroup());
          assertNotNull(a.getGroup().getChain());
        }
      }
      List<Atom> atoms=g.getAtoms();
      boolean caInMain=false;
      for (      Atom a : atoms) {
        assertNotNull(a.getGroup());
        assertNotNull(a.getGroup().getChain());
        if (a.getName().equals(StructureTools.CA_ATOM_NAME)) {
          caList.add(a);
          caInMain=true;
          break;
        }
      }
      if (!caInMain && g.hasAtom(StructureTools.CA_ATOM_NAME)) {
        fail("String_Node_Str");
      }
    }
  }
  assertEquals(ca.length,caList.size());
}
Program: 16859
Project: 16859
Buggy source:
@Test public void test3PIUpdb() throws IOException, StructureException {
  AtomCache cache=new AtomCache();
  StructureIO.setAtomCache(cache);
  cache.setUseMmCif(false);
  Structure structure=StructureIO.getStructure("String_Node_Str");
  assertNotNull(structure);
  Atom[] ca=StructureTools.getAtomCAArray(structure);
  List<Atom> caList=new ArrayList<Atom>();
  for (  Chain c : structure.getChains()) {
    for (    Group g : c.getAtomGroups()) {
      for (      Group altLocGroup : g.getAltLocs()) {
        ensureAllAtomsSameAltCode(altLocGroup);
      }
      List<Atom> atoms=g.getAtoms();
      boolean caInMain=false;
      for (      Atom a : atoms) {
        if (a.getName().equals(StructureTools.CA_ATOM_NAME)) {
          caList.add(a);
          caInMain=true;
          break;
        }
      }
      if (!caInMain && g.hasAtom(StructureTools.CA_ATOM_NAME)) {
        fail("String_Node_Str");
      }
    }
  }
  assertTrue(ca.length == caList.size());
}

Fixed version (ground truth):
@Test public void test3PIUpdb() throws IOException, StructureException {
  AtomCache cache=new AtomCache();
  FileParsingParameters params=new FileParsingParameters();
  params.setAlignSeqRes(true);
  cache.setFileParsingParams(params);
  StructureIO.setAtomCache(cache);
  cache.setUseMmCif(false);
  Structure structure=StructureIO.getStructure("String_Node_Str");
  assertNotNull(structure);
  Atom[] ca=StructureTools.getAtomCAArray(structure);
  List<Atom> caList=new ArrayList<Atom>();
  for (  Chain c : structure.getChains()) {
    for (    Group g : c.getAtomGroups()) {
      for (      Group altLocGroup : g.getAltLocs()) {
        ensureAllAtomsSameAltCode(altLocGroup);
        for (        Atom a : altLocGroup.getAtoms()) {
          assertNotNull(a.getGroup());
          assertNotNull(a.getGroup().getChain());
        }
      }
      List<Atom> atoms=g.getAtoms();
      boolean caInMain=false;
      for (      Atom a : atoms) {
        assertNotNull(a.getGroup());
        assertNotNull(a.getGroup().getChain());
        if (a.getName().equals(StructureTools.CA_ATOM_NAME)) {
          caList.add(a);
          caInMain=true;
          break;
        }
      }
      if (!caInMain && g.hasAtom(StructureTools.CA_ATOM_NAME)) {
        fail("String_Node_Str");
      }
    }
  }
  assertTrue(ca.length == caList.size());
}
Program: 16860
Project: 16860
Buggy source:
private void doFullTest(Structure structure) throws StructureException {
  System.out.println("String_Node_Str");
  testStructureRefs(structure);
  logger.debug("String_Node_Str",System.identityHashCode(structure));
  Structure structureCopy=structure.clone();
  logger.debug("String_Node_Str",System.identityHashCode(structureCopy));
  assertNotSame(structure,structureCopy);
  System.out.println("String_Node_Str");
  testStructureRefs(structureCopy);
  logger.debug("String_Node_Str",System.identityHashCode(structure));
  System.out.println("String_Node_Str");
  testStructureRefs(structure);
  System.out.println("String_Node_Str");
  for (  Chain c : structure.getChains()) {
    Chain clonedChain=(Chain)c.clone();
    testChainRefs(clonedChain);
  }
  System.out.println("String_Node_Str");
  for (  Chain c : structure.getChains()) {
    Atom[] atomArray=StructureTools.getAllAtomArray(c);
    testAtomArrayRefs(atomArray,c);
  }
  CrystalBuilder cb=new CrystalBuilder(structure);
  StructureInterfaceList interfaces=cb.getUniqueInterfaces();
  for (  StructureInterface interf : interfaces) {
    testInterfaceRefs(structure,interf);
  }
}

Fixed version (ground truth):
private void doFullTest(Structure structure) throws StructureException {
  System.out.println("String_Node_Str");
  testStructureRefs(structure);
  logger.debug("String_Node_Str",System.identityHashCode(structure));
  Structure structureCopy=structure.clone();
  logger.debug("String_Node_Str",System.identityHashCode(structureCopy));
  assertNotSame(structure,structureCopy);
  System.out.println("String_Node_Str");
  testStructureRefs(structureCopy);
  logger.debug("String_Node_Str",System.identityHashCode(structure));
  System.out.println("String_Node_Str");
  testStructureRefs(structure);
  System.out.println("String_Node_Str");
  for (  Chain c : structure.getChains()) {
    Chain clonedChain=(Chain)c.clone();
    testChainRefs(clonedChain);
  }
  System.out.println("String_Node_Str");
  for (  Chain c : structure.getChains()) {
    Atom[] atomArray=StructureTools.getAllAtomArray(c);
    testAtomArrayRefs(atomArray,c);
  }
  CrystalBuilder cb=new CrystalBuilder(structure);
  StructureInterfaceList interfaces=cb.getUniqueInterfaces();
  for (  StructureInterface interf : interfaces) {
    testInterfaceRefs(structure,interf);
  }
  System.out.println("String_Node_Str");
  testStructureRefs(structure);
}
Program: 16861
Project: 16861
Buggy source:
/** 
 * Returns and array of all atoms of the chain (first model), including  Hydrogens (if present) and all HETATOMs
 * @param c input chain
 * @return all atom array
 */
public static final Atom[] getAllAtomArray(Chain c){
  List<Atom> atoms=new ArrayList<Atom>();
  for (  Group g : c.getAtomGroups()) {
    for (    Atom a : g.getAtoms()) {
      atoms.add(a);
    }
  }
  return (Atom[])atoms.toArray(new Atom[atoms.size()]);
}

Fixed version (ground truth):
/** 
 * Returns and array of all atoms of the chain (first model), including  Hydrogens (if present) and all HETATOMs. Waters are not included.
 * @param c input chain
 * @return all atom array
 */
public static final Atom[] getAllAtomArray(Chain c){
  List<Atom> atoms=new ArrayList<Atom>();
  for (  Group g : c.getAtomGroups()) {
    if (g.isWater())     continue;
    for (    Atom a : g.getAtoms()) {
      atoms.add(a);
    }
  }
  return (Atom[])atoms.toArray(new Atom[atoms.size()]);
}
Program: 16862
Project: 16862
Buggy source:
/** 
 * Returns and array of all non-Hydrogen atoms in the given Chain,  optionally including HET atoms or not
 * @param c
 * @param hetAtoms if true HET atoms are included in array, if false they are not
 * @return
 */
public static final Atom[] getAllNonHAtomArray(Chain c,boolean hetAtoms){
  List<Atom> atoms=new ArrayList<Atom>();
  for (  Group g : c.getAtomGroups()) {
    for (    Atom a : g.getAtoms()) {
      if (a.getElement() == Element.H)       continue;
      if (!hetAtoms && g.getType().equals(GroupType.HETATM))       continue;
      atoms.add(a);
    }
  }
  return (Atom[])atoms.toArray(new Atom[atoms.size()]);
}

Fixed version (ground truth):
/** 
 * Returns and array of all non-Hydrogen atoms in the given Chain,  optionally including HET atoms or not Waters are not included. 
 * @param c
 * @param hetAtoms if true HET atoms are included in array, if false they are not
 * @return
 */
public static final Atom[] getAllNonHAtomArray(Chain c,boolean hetAtoms){
  List<Atom> atoms=new ArrayList<Atom>();
  for (  Group g : c.getAtomGroups()) {
    if (g.isWater())     continue;
    for (    Atom a : g.getAtoms()) {
      if (a.getElement() == Element.H)       continue;
      if (!hetAtoms && g.getType().equals(GroupType.HETATM))       continue;
      atoms.add(a);
    }
  }
  return (Atom[])atoms.toArray(new Atom[atoms.size()]);
}
Program: 16865
Project: 16865
Buggy source:
private Structure getCifStructure(String pdbId) throws IOException, StructureException {
  cache.setUseMmCif(true);
  params.setAlignSeqRes(true);
  return cache.getStructure(pdbId);
}

Fixed version (ground truth):
private Structure getCifStructure(String pdbId) throws IOException, StructureException {
  cache.setUseMmCif(true);
  params.setAlignSeqRes(true);
  params.setParseBioAssembly(true);
  return cache.getStructure(pdbId);
}
Program: 16866
Project: 16866
Buggy source:
private Structure getPdbStructure(String pdbId) throws IOException, StructureException {
  cache.setUseMmCif(false);
  params.setAlignSeqRes(true);
  return cache.getStructure(pdbId);
}

Fixed version (ground truth):
private Structure getPdbStructure(String pdbId) throws IOException, StructureException {
  cache.setUseMmCif(false);
  params.setAlignSeqRes(true);
  params.setParseBioAssembly(true);
  return cache.getStructure(pdbId);
}