nus-yam/ex-repair huggingface dataset:
Program: 16196
Project: 16196
Buggy source:
private void unlockAll() throws SQLException {
  if (SysProperties.CHECK) {
    if (undoLog.size() > 0) {
      Message.throwInternalError();
    }
  }
  database.afterWriting();
  if (locks.size() > 0) {
synchronized (database) {
      for (int i=0; i < locks.size(); i++) {
        Table t=(Table)locks.get(i);
        t.unlock(this);
      }
      locks.clear();
    }
  }
  savepoints=null;
  if (modificationIdState != modificationId) {
    sessionStateChanged=true;
  }
}

Fixed version (ground truth):
private void unlockAll() throws SQLException {
  if (SysProperties.CHECK) {
    if (undoLog.size() > 0) {
      Message.throwInternalError();
    }
  }
  if (locks.size() > 0) {
synchronized (database) {
      for (int i=0; i < locks.size(); i++) {
        Table t=(Table)locks.get(i);
        t.unlock(this);
      }
      locks.clear();
    }
  }
  savepoints=null;
  if (modificationIdState != modificationId) {
    sessionStateChanged=true;
  }
}
Program: 16197
Project: 16197
Buggy source:
public boolean isReconnectNeeded(){
  return database.isReconnectNeeded();
}

Fixed version (ground truth):
public boolean isReconnectNeeded(boolean write){
  while (true) {
    boolean reconnect=database.isReconnectNeeded();
    if (reconnect) {
      return true;
    }
    if (write) {
      if (database.beforeWriting()) {
        return false;
      }
    }
 else {
      return false;
    }
  }
}
Program: 16198
Project: 16198
Buggy source:
/** 
 * Check if the database changed and therefore reconnecting is required.
 * @return true if reconnecting is required
 */
boolean isReconnectNeeded();

Fixed version (ground truth):
/** 
 * Check if the database changed and therefore reconnecting is required.
 * @param write if the next operation may be writing
 * @return true if reconnecting is required
 */
boolean isReconnectNeeded(boolean write);
Program: 16199
Project: 16199
Buggy source:
public boolean isReconnectNeeded(){
  return false;
}

Fixed version (ground truth):
public boolean isReconnectNeeded(boolean write){
  return false;
}
Program: 16200
Project: 16200
Buggy source:
private void mapAndAddFilter(Expression on) throws SQLException {
  on.mapColumns(this,0);
  addFilterCondition(on,true);
  on.createIndexConditions(session,this);
  if (join != null) {
    join.mapAndAddFilter(on);
  }
}

Fixed version (ground truth):
/** 
 * Map the columns and add the join condition.
 * @param on the condition
 */
public void mapAndAddFilter(Expression on) throws SQLException {
  on.mapColumns(this,0);
  addFilterCondition(on,true);
  on.createIndexConditions(session,this);
  if (join != null) {
    join.mapAndAddFilter(on);
  }
}
Program: 16201
Project: 16201
Buggy source:
private void reconnectModified(boolean pending){
  if (readOnly || pending == reconnectChangePending || lock == null) {
    return;
  }
  try {
    if (pending) {
      getTrace().debug("String_Node_Str");
      Thread.sleep((int)(SysProperties.RECONNECT_CHECK_DELAY * 1.1));
    }
    lock.setProperty("String_Node_Str",Long.toString(modificationDataId));
    lock.setProperty("String_Node_Str",Long.toString(modificationMetaId));
    lock.setProperty("String_Node_Str",pending ? "String_Node_Str" : null);
    lock.save();
    reconnectChangePending=pending;
  }
 catch (  Exception e) {
    getTrace().error("String_Node_Str" + pending,e);
  }
}

Fixed version (ground truth):
private void reconnectModified(boolean pending){
  if (readOnly || pending == reconnectChangePending || lock == null) {
    return;
  }
  try {
    if (pending) {
      getTrace().debug("String_Node_Str");
      Thread.sleep((int)(SysProperties.RECONNECT_CHECK_DELAY * 1.1));
    }
    lock.setProperty("String_Node_Str",Long.toString(modificationDataId));
    lock.setProperty("String_Node_Str",Long.toString(modificationMetaId));
    lock.setProperty("String_Node_Str",pending ? "String_Node_Str" : null);
    lock.save();
    reconnectLastLock=lock.load();
    reconnectChangePending=pending;
  }
 catch (  Exception e) {
    getTrace().error("String_Node_Str" + pending,e);
  }
}
Program: 16202
Project: 16202
Buggy source:
public SessionInterface reconnect() throws SQLException {
  readSessionState();
  Session newSession=Engine.getInstance().getSession(connectionInfo);
  newSession.sessionState=sessionState;
  newSession.recreateSessionState();
  return newSession;
}

Fixed version (ground truth):
public SessionInterface reconnect() throws SQLException {
  readSessionState();
  close();
  Session newSession=Engine.getInstance().getSession(connectionInfo);
  newSession.sessionState=sessionState;
  newSession.recreateSessionState();
  return newSession;
}
Program: 16203
Project: 16203
Buggy source:
/** 
 * Close the log file.
 * @param delete if the file should be deleted shortly afterwards
 */
void close(boolean delete) throws SQLException {
  SQLException closeException=null;
  try {
    flush();
  }
 catch (  SQLException e) {
    closeException=e;
  }
  if (file != null) {
    try {
      file.close();
      file=null;
      if (delete) {
        database.deleteLogFileLater(fileName);
      }
    }
 catch (    IOException e) {
      if (closeException == null) {
        closeException=Message.convertIOException(e,fileName);
      }
    }
    file=null;
    fileNamePrefix=null;
  }
  if (closeException != null) {
    throw closeException;
  }
}

Fixed version (ground truth):
/** 
 * Close the log file.
 * @param delete if the file should be deleted shortly afterwards
 */
void close(boolean delete) throws SQLException {
  SQLException closeException=null;
  try {
    flush();
  }
 catch (  SQLException e) {
    closeException=e;
  }
  if (file != null) {
    try {
      file.close();
      file=null;
      if (delete) {
        try {
          database.deleteLogFileLater(fileName);
        }
 catch (        SQLException e) {
        }
      }
    }
 catch (    IOException e) {
      if (closeException == null) {
        closeException=Message.convertIOException(e,fileName);
      }
    }
    file=null;
    fileNamePrefix=null;
  }
  if (closeException != null) {
    throw closeException;
  }
}
Program: 16204
Project: 16204
Buggy source:
/** 
 * Get the index of the next bit that is not set.
 * @param fromIndex where to start searching
 * @return the index of the next disabled bit
 */
public int nextClearBit(int fromIndex){
  int i=fromIndex >> ADDRESS_BITS;
  int max=data.length;
  for (; i < max; i++) {
    if (data[i] == -1) {
      continue;
    }
    int j=Math.max(fromIndex,i << ADDRESS_BITS);
    for (int end=j + 64; j < end; j++) {
      if (!get(j)) {
        return j;
      }
    }
  }
  return fromIndex;
}

Fixed version (ground truth):
/** 
 * Get the index of the next bit that is not set.
 * @param fromIndex where to start searching
 * @return the index of the next disabled bit
 */
public int nextClearBit(int fromIndex){
  int i=fromIndex >> ADDRESS_BITS;
  int max=data.length;
  for (; i < max; i++) {
    if (data[i] == -1) {
      continue;
    }
    int j=Math.max(fromIndex,i << ADDRESS_BITS);
    for (int end=j + 64; j < end; j++) {
      if (!get(j)) {
        return j;
      }
    }
  }
  return max << ADDRESS_BITS;
}
Program: 16205
Project: 16205
Buggy source:
/** 
 * Get the index of the last bit that is set.
 * @return the index of the last enabled bit
 */
public int getLastSetBit(){
  int i=(data.length << ADDRESS_BITS) - 1;
  while (i >= 0) {
    if (get(i)) {
      return i;
    }
    i--;
  }
  return -1;
}

Fixed version (ground truth):
/** 
 * Get the index of the last bit that is set.
 * @return the index of the last enabled bit, or -1
 */
public int getLastSetBit(){
  int i=(data.length << ADDRESS_BITS) - 1;
  while (i >= 0) {
    if (get(i)) {
      return i;
    }
    i--;
  }
  return -1;
}
Program: 16208
Project: 16208
Buggy source:
/** 
 * tests in the Chemical Component Dictionary, if this group is a polymeric group
 * @return true if a polymeric group
 */
public boolean isPolymeric();

Fixed version (ground truth):
/** 
 * Check if this group is a polymeric group, from the definition in Chemical Component Dictionary
 * @return true if a polymeric group
 */
public boolean isPolymeric();
Program: 16209
Project: 16209
Buggy source:
/** 
 * Test if this group has alternate locations.
 * @return boolean flag if there are alternate locations.
 */
public boolean hasAltLoc();

Fixed version (ground truth):
/** 
 * Check if this group has alternate location groups.
 * @return boolean flag if there are alternate locations.
 * @see #getAltLocs()
 */
public boolean hasAltLoc();
Program: 16210
Project: 16210
Buggy source:
/** 
 * get an Atom Iterator.
 * @return an Iterator object
 */
public Iterator<Atom> iterator();

Fixed version (ground truth):
/** 
 * Get an Atom Iterator.
 * @return an Iterator object
 */
public Iterator<Atom> iterator();
Program: 16211
Project: 16211
Buggy source:
/** 
 * returns a dynamically created ResidueNumber for the group - this contains the chainId, resNum and insCode of the group.
 * @see ResidueNumber
 * @return ResidueNumber for the group.
 * @since 3.0
 */
public ResidueNumber getResidueNumber();

Fixed version (ground truth):
/** 
 * Returns a dynamically created ResidueNumber for the group - this contains the chainId, resNum and insCode of the group.
 * @see ResidueNumber
 * @return ResidueNumber for the group.
 * @since 3.0
 */
public ResidueNumber getResidueNumber();
Program: 16212
Project: 16212
Buggy source:
/** 
 * Get the list of alternate locations.
 * @return List of other groups that are on alternate locations
 */
public List<Group> getAltLocs();

Fixed version (ground truth):
/** 
 * Get the list of other alternate location groups. <p> The main group (this group) will contain the first altloc (be it the default '.' or 'A' or a mix of '.' and 'A'). <p> This method will return the altloc groups that are not the main group, e.g.: <li> if '.' (default), 'A' and 'B' altlocs are present in file, the main group will contain the default '.' and this method will return 2 altloc groups </li> <li> if 'A' and 'B' are present in file without a default '.' group, then the main group will contain the 'A' location whilst this method will return only 1 altloc group with the 'B' location </li> <p> Note that all groups (main and altlocs) will contain all atoms, thus atoms from the default group can appear duplicated in main and altloc groups. <p> Thus it can happen that an altloc group duplicate the contents of the main group.
 * @return List of other groups that are on alternate locations
 */
public List<Group> getAltLocs();
Program: 16213
Project: 16213
Buggy source:
/** 
 * get a single property .
 * @param key  a String
 * @return an Object
 * @see #setProperty
 */
public Object getProperty(String key);

Fixed version (ground truth):
/** 
 * Get a single property .
 * @param key  a String
 * @return an Object
 * @see #setProperty
 */
public Object getProperty(String key);
Program: 16214
Project: 16214
Buggy source:
/** 
 * attempts to reduce the memory imprint of this group by trimming all internal Collection objects to the required size.
 */
public void 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();
Program: 16215
Project: 16215
Buggy source:
/** 
 * return properties.
 * @see #setProperties
 * @return a HashMap object representing the properties value
 */
public Map<String,Object> getProperties();

Fixed version (ground truth):
/** 
 * Return properties.
 * @see #setProperties
 * @return a HashMap object representing the properties value
 */
public Map<String,Object> getProperties();
Program: 16216
Project: 16216
Buggy source:
/** 
 * Determines if this group is water.
 * @see {@link GroupType#WATERNAMES}
 * @return true if it's water, false otherwise.
 */
public boolean isWater();

Fixed version (ground truth):
/** 
 * Determines if this group is water.
 * @see GroupType#WATERNAMES
 * @return true if it's water, false otherwise.
 */
public boolean isWater();
Program: 16217
Project: 16217
Buggy source:
/** 
 * set a single property .
 * @param key    a String
 * @param value  an Object
 * @see #getProperty
 */
public void setProperty(String key,Object value);

Fixed version (ground truth):
/** 
 * Set a single property .
 * @param key    a String
 * @param value  an Object
 * @see #getProperty
 */
public void setProperty(String key,Object value);
Program: 16218
Project: 16218
Buggy source:
/** 
 * returns and identical copy of this Group object .
 * @return  and identical copy of this Group object
 */
public Object clone();

Fixed version (ground truth):
/** 
 * Returns and identical copy of this Group object .
 * @return  and identical copy of this Group object
 */
public Object clone();
Program: 16219
Project: 16219
Buggy source:
/** 
 * Tests in the Chemical Component Dictionary, if this group is an amino acid
 * @return true if an amino acid
 */
public boolean isAminoAcid();

Fixed version (ground truth):
/** 
 * Check if this group is an aminoacid group, from the definition in Chemical Component Dictionary
 * @return true if an amino acid
 */
public boolean isAminoAcid();
Program: 16220
Project: 16220
Buggy source:
/** 
 * Tests in the Chemical Component Dictionary, if this group is a nucleotide
 * @return true if a nucleotide
 */
public boolean isNucleotide();

Fixed version (ground truth):
/** 
 * Check if this group is a nucleotide group, from the definition in Chemical Component Dictionary
 * @return true if a nucleotide
 */
public boolean isNucleotide();
Program: 16221
Project: 16221
Buggy source:
/** 
 * Add a group that is an alternate location for this group.
 */
public void addAltLoc(Group g);

Fixed version (ground truth):
/** 
 * Add a group that is an alternate location for this group.
 * @param g the altloc group to add
 */
public void addAltLoc(Group g);
Program: 16222
Project: 16222
Buggy source:
/** 
 * Cleans up the structure's alternate location groups. All alternate location groups should have all atoms (except in the case of microheterogenity) or when a deuetuim exiss. Ensure that all the alt loc groups have all the atoms in the main group
 * @param structure The Structure to be cleaned up
 */
public static void cleanUpAltLocs(Structure structure){
  for (int i=0; i < structure.nrModels(); i++) {
    for (    Chain chain : structure.getModel(i)) {
      for (      Group group : chain.getAtomGroups()) {
        for (        Group altLocGroup : group.getAltLocs()) {
          for (          Atom groupAtom : group.getAtoms()) {
            if (!altLocGroup.hasAtom(groupAtom.getName())) {
              if (altLocGroup.getPDBName().equals(group.getPDBName())) {
                if (hasDeuteratedEquiv(groupAtom,altLocGroup)) {
                }
 else {
                  altLocGroup.addAtom(groupAtom);
                }
              }
            }
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Cleans up the structure's alternate location (altloc) groups. All alternate location groups should have all atoms (except in the case of microheterogenity) or when a deuterium exists. Ensure that all the alt loc groups have all the atoms in the main group.
 * @param structure The Structure to be cleaned up
 */
public static void cleanUpAltLocs(Structure structure){
  for (int i=0; i < structure.nrModels(); i++) {
    for (    Chain chain : structure.getModel(i)) {
      for (      Group group : chain.getAtomGroups()) {
        for (        Group altLocGroup : group.getAltLocs()) {
          for (          Atom groupAtom : group.getAtoms()) {
            if (!altLocGroup.hasAtom(groupAtom.getName())) {
              if (altLocGroup.getPDBName().equals(group.getPDBName())) {
                if (!hasDeuteratedEquiv(groupAtom,altLocGroup)) {
                  altLocGroup.addAtom(groupAtom);
                }
              }
            }
          }
        }
      }
    }
  }
}
Program: 16223
Project: 16223
Buggy source:
/** 
 * Check to see if a Hydorgen has a  Deuterated brother in the group.
 * @param atom the input atom that is putatively hydorgen
 * @param currentGroup the group the atom is in
 * @return true if the atom is hydrogen and it's Deuterium equiv exists.
 */
public static boolean hasDeuteratedEquiv(Atom atom,Group currentGroup){
  if (atom.getElement() == Element.H && currentGroup.hasAtom(replaceFirstChar(atom.getName(),'H','D'))) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Check to see if a Hydrogen has a  Deuterated brother in the group.
 * @param atom the input atom that is putatively hydorgen
 * @param currentGroup the group the atom is in
 * @return true if the atom is hydrogen and it's Deuterium equiv exists.
 */
public static boolean hasDeuteratedEquiv(Atom atom,Group currentGroup){
  if (atom.getElement() == Element.H && currentGroup.hasAtom(replaceFirstChar(atom.getName(),'H','D'))) {
    return true;
  }
  return false;
}
Program: 16224
Project: 16224
Buggy source:
/** 
 * Converts a Group into a List of   {@link AtomSite} objects
 * @param g
 * @param model
 * @param chainId
 * @param internalChainId
 * @return
 */
private static List<AtomSite> convertGroupToAtomSites(Group g,int model,String chainId,String internalChainId){
  List<AtomSite> list=new ArrayList<AtomSite>();
  int groupsize=g.size();
  for (int atompos=0; atompos < groupsize; atompos++) {
    Atom a=null;
    a=g.getAtom(atompos);
    if (a == null)     continue;
    list.add(convertAtomToAtomSite(a,model,chainId,internalChainId));
  }
  if (g.hasAltLoc()) {
    for (    Group alt : g.getAltLocs()) {
      list.addAll(convertGroupToAtomSites(alt,model,chainId,internalChainId));
    }
  }
  return list;
}

Fixed version (ground truth):
/** 
 * Converts a Group into a List of   {@link AtomSite} objects
 * @param g
 * @param model
 * @param chainId
 * @param internalChainId
 * @return
 */
private static List<AtomSite> convertGroupToAtomSites(Group g,int model,String chainId,String internalChainId){
  Map<Integer,AtomSite> uniqueAtomSites=new LinkedHashMap<>();
  int groupsize=g.size();
  for (int atompos=0; atompos < groupsize; atompos++) {
    Atom a=g.getAtom(atompos);
    if (a == null)     continue;
    uniqueAtomSites.put(a.getPDBserial(),convertAtomToAtomSite(a,model,chainId,internalChainId));
  }
  if (g.hasAltLoc()) {
    for (    Group alt : g.getAltLocs()) {
      for (      AtomSite atomSite : convertGroupToAtomSites(alt,model,chainId,internalChainId)) {
        uniqueAtomSites.put(Integer.parseInt(atomSite.getId()),atomSite);
      }
    }
  }
  return new ArrayList<>(uniqueAtomSites.values());
}
Program: 16226
Project: 16226
Buggy source:
/** 
 * Get the maximum height of any of the traces. The data is persisted for performance in the event of multiple calls, but it initialized lazily.
 * @return - maximum height of any of the traces
 */
private int getMaximum(){
  if (maximum > 0)   return maximum;
  int max=0;
  for (int x=0; x <= T.length - 1; x++) {
    if (T[x] > max)     max=T[x];
    if (A[x] > max)     max=A[x];
    if (C[x] > max)     max=C[x];
    if (G[x] > max)     max=G[x];
  }
  return max;
}

Fixed version (ground truth):
/** 
 * Get the maximum height of any of the traces. The data is persisted for performance in the event of multiple calls, but it initialized lazily.
 * @return - maximum height of any of the traces
 */
private int getMaximum(){
  int max=0;
  for (int x=0; x <= T.length - 1; x++) {
    if (T[x] > max)     max=T[x];
    if (A[x] > max)     max=A[x];
    if (C[x] > max)     max=C[x];
    if (G[x] > max)     max=G[x];
  }
  return max;
}
Program: 16229
Project: 16229
Buggy source:
public static String getOneLetterCode(ChemComp cc){
  String oneLetter=cc.getOne_letter_code();
  if (oneLetter == null || oneLetter.equals("String_Node_Str") || oneLetter.equals("String_Node_Str")) {
    String parentId=cc.getMon_nstd_parent_comp_id();
    if (parentId == null)     return oneLetter;
    ChemComp parentCC=ChemCompGroupFactory.getChemComp(parentId);
    if (parentCC == null)     return oneLetter;
    oneLetter=parentCC.getOne_letter_code();
  }
  return oneLetter;
}

Fixed version (ground truth):
public static String getOneLetterCode(ChemComp cc){
  String oneLetter=cc.getOne_letter_code();
  if (oneLetter == null || oneLetter.equals("String_Node_Str") || oneLetter.equals("String_Node_Str")) {
    String parentId=cc.getMon_nstd_parent_comp_id();
    if (parentId == null)     return oneLetter;
    if (parentId.length() > 3)     return oneLetter;
    ChemComp parentCC=ChemCompGroupFactory.getChemComp(parentId);
    if (parentCC == null)     return oneLetter;
    oneLetter=parentCC.getOne_letter_code();
  }
  return oneLetter;
}
Program: 16230
Project: 16230
Buggy source:
/** 
 * Get the length of the coding sequence
 * @param exonStarts
 * @param exonEnds
 * @param cdsStart
 * @param cdsEnd
 * @return
 */
public static int getCDSLengthReverse(List<Integer> exonStarts,List<Integer> exonEnds,int cdsStart,int cdsEnd){
  boolean inCoding=false;
  int codingLength=0;
  if (cdsEnd < cdsStart) {
    int tmp=cdsEnd;
    cdsEnd=cdsStart;
    cdsStart=tmp;
  }
  int lengthExons=0;
  for (int i=exonStarts.size() - 1; i >= 0; i--) {
    int end=exonStarts.get(i);
    int start=exonEnds.get(i);
    if (end < start) {
      int tmp=end;
      end=start;
      start=tmp;
    }
    lengthExons+=end - start;
    if (start <= cdsEnd && end >= cdsEnd) {
      inCoding=true;
      int tmpstart=start;
      if (start < cdsStart) {
        tmpstart=cdsStart;
      }
      codingLength+=(cdsEnd - tmpstart);
      boolean debug=logger.isDebugEnabled();
      if (debug) {
        StringBuffer b=new StringBuffer();
        b.append("String_Node_Str" + (cdsEnd + 1) + "String_Node_Str"+ (end)+ newline);
        if (tmpstart == start)         b.append("String_Node_Str");
 else         b.append("String_Node_Str");
        b.append("String_Node_Str" + tmpstart + "String_Node_Str"+ cdsEnd+ "String_Node_Str"+ (cdsEnd - tmpstart)+ "String_Node_Str"+ codingLength+ "String_Node_Str"+ (codingLength % 3)+ newline);
        if (tmpstart != start)         b.append("String_Node_Str" + (cdsStart - 1) + "String_Node_Str"+ start+ newline);
        logger.debug(b.toString());
      }
    }
 else     if (start <= cdsStart && end >= cdsStart) {
      inCoding=false;
      codingLength+=(end - cdsStart);
      logger.debug("String_Node_Str" + (cdsStart + 1) + "String_Node_Str"+ end+ "String_Node_Str"+ (end - cdsStart)+ "String_Node_Str"+ (codingLength - 3)+ "String_Node_Str"+ (codingLength % 3));
      logger.debug("String_Node_Str" + start + "String_Node_Str"+ (cdsStart));
    }
 else     if (inCoding) {
      codingLength+=(end - start);
      logger.debug("String_Node_Str" + start + "String_Node_Str"+ end+ "String_Node_Str"+ (end - start)+ "String_Node_Str"+ codingLength+ "String_Node_Str"+ (codingLength % 3));
    }
 else {
      logger.debug("String_Node_Str");
    }
  }
  logger.debug("String_Node_Str" + lengthExons + "String_Node_Str"+ (codingLength - 3));
  return codingLength - 3;
}

Fixed version (ground truth):
/** 
 * Get the length of the coding sequence
 * @param exonStarts
 * @param exonEnds
 * @param cdsStart
 * @param cdsEnd
 * @return
 */
public static int getCDSLengthReverse(List<Integer> exonStarts,List<Integer> exonEnds,int cdsStart,int cdsEnd){
  int codingLength=0;
  if (cdsEnd < cdsStart) {
    int tmp=cdsEnd;
    cdsEnd=cdsStart;
    cdsStart=tmp;
  }
  for (int i=exonStarts.size() - 1; i >= 0; i--) {
    int end=exonStarts.get(i);
    int start=exonEnds.get(i);
    if (end < start) {
      int tmp=end;
      end=start;
      start=tmp;
    }
    if ((start < cdsStart && end < cdsStart) || (start > cdsEnd && end > cdsEnd))     continue;
    if (start < cdsStart)     start=cdsStart;
    if (end > cdsEnd)     end=cdsEnd;
    codingLength+=(end - start + 1);
  }
  return codingLength;
}
Program: 16231
Project: 16231
Buggy source:
/** 
 * Get the length of the coding sequence
 * @param exonStarts
 * @param exonEnds
 * @param cdsStart
 * @param cdsEnd
 * @return
 */
public static int getCDSLengthForward(List<Integer> exonStarts,List<Integer> exonEnds,int cdsStart,int cdsEnd){
  boolean inCoding=false;
  int codingLength=0;
  int lengthExons=0;
  for (int i=0; i < exonStarts.size(); i++) {
    int start=exonStarts.get(i);
    int end=exonEnds.get(i);
    lengthExons+=end - start;
    logger.debug("String_Node_Str" + (start + 1) + "String_Node_Str"+ end+ "String_Node_Str"+ (end - start));
    if (start + 1 <= cdsStart + 1 && end >= cdsStart + 1) {
      inCoding=true;
      codingLength+=(end - cdsStart);
      logger.debug("String_Node_Str" + start + "String_Node_Str"+ (cdsStart));
      logger.debug("String_Node_Str" + (cdsStart + 1) + "String_Node_Str"+ end+ "String_Node_Str"+ (end - cdsStart + 1)+ "String_Node_Str"+ codingLength+ "String_Node_Str"+ (codingLength % 3));
    }
 else     if (start + 1 <= cdsEnd && end >= cdsEnd) {
      inCoding=false;
      codingLength+=(cdsEnd - start);
      logger.debug("String_Node_Str" + (start + 1) + "String_Node_Str"+ cdsEnd+ "String_Node_Str"+ (cdsEnd - start + 1)+ "String_Node_Str"+ codingLength+ "String_Node_Str"+ (codingLength % 3));
      logger.debug("String_Node_Str" + cdsEnd + 1+ "String_Node_Str"+ end);
    }
 else     if (inCoding) {
      codingLength+=(end - start);
      logger.debug("String_Node_Str" + (start + 1) + "String_Node_Str"+ end+ "String_Node_Str"+ (end - start + 1)+ "String_Node_Str"+ codingLength+ "String_Node_Str"+ (codingLength % 3));
    }
  }
  logger.debug("String_Node_Str" + Integer.toString(lengthExons));
  logger.debug("String_Node_Str" + Integer.toString((codingLength - 3)));
  return codingLength - 3;
}

Fixed version (ground truth):
/** 
 * Get the length of the coding sequence
 * @param exonStarts
 * @param exonEnds
 * @param cdsStart
 * @param cdsEnd
 * @return
 */
public static int getCDSLengthForward(List<Integer> exonStarts,List<Integer> exonEnds,int cdsStart,int cdsEnd){
  int codingLength=0;
  for (int i=0; i < exonStarts.size(); i++) {
    int start=exonStarts.get(i);
    int end=exonEnds.get(i);
    if ((start < cdsStart && end < cdsStart) || (start > cdsEnd && end > cdsEnd))     continue;
    if (start < cdsStart)     start=cdsStart;
    if (end > cdsEnd)     end=cdsEnd;
    codingLength+=(end - start + 1);
  }
  return codingLength;
}
Program: 16233
Project: 16233
Buggy source:
/** 
 * Converts the genetic coordinate to the position of the nucleotide on the mRNA sequence for a gene  living on the reverse DNA strand.
 * @param chromPos The genetic coordinate on a chromosome 
 * @param exonStarts The list holding the genetic coordinates pointing to the start positions of the exons (including UTR regions)  
 * @param exonEnds The list holding the genetic coordinates pointing to the end positions of the exons (including UTR regions)
 * @param cdsStart The start position of a coding region
 * @param cdsEnd The end position of a coding region
 * @return the position of the nucleotide base on the mRNA sequence corresponding to the input genetic coordinate (base 1)
 * @author Yana Valasatava
 */
public static int getCDSPosReverse(int chromPos,List<Integer> exonStarts,List<Integer> exonEnds,int cdsStart,int cdsEnd){
  if ((chromPos < (cdsStart + 1)) || (chromPos > (cdsEnd + 1))) {
    logger.debug("String_Node_Str" + format(chromPos) + "String_Node_Str");
    return -1;
  }
  logger.debug("String_Node_Str" + format(chromPos));
  List<Range<Integer>> cdsRegions=getCDSRegions(exonStarts,exonEnds,cdsStart,cdsEnd);
  int codingLength=0;
  int lengthExon=0;
  for (int i=cdsRegions.size() - 1; i >= 0; i--) {
    int start=cdsRegions.get(i).lowerEndpoint();
    int end=cdsRegions.get(i).upperEndpoint();
    lengthExon=end - start;
    if (start + 1 <= chromPos && end >= chromPos) {
      return codingLength + (end - chromPos + 1);
    }
 else {
      codingLength+=lengthExon;
    }
  }
  return -1;
}

Fixed version (ground truth):
/** 
 * Converts the genetic coordinate to the position of the nucleotide on the mRNA sequence for a gene  living on the reverse DNA strand.
 * @param chromPos The genetic coordinate on a chromosome 
 * @param exonStarts The list holding the genetic coordinates pointing to the start positions of the exons (including UTR regions)  
 * @param exonEnds The list holding the genetic coordinates pointing to the end positions of the exons (including UTR regions)
 * @param cdsStart The start position of a coding region
 * @param cdsEnd The end position of a coding region
 * @return the position of the nucleotide base on the mRNA sequence corresponding to the input genetic coordinate (base 1)
 * @author Yana Valasatava
 */
public static int getCDSPosReverse(int chromPos,List<Integer> exonStarts,List<Integer> exonEnds,int cdsStart,int cdsEnd){
  if ((chromPos < (cdsStart + base)) || (chromPos > (cdsEnd + base))) {
    logger.debug("String_Node_Str" + format(chromPos) + "String_Node_Str");
    return -1;
  }
  logger.debug("String_Node_Str" + format(chromPos));
  List<Range<Integer>> cdsRegions=getCDSRegions(exonStarts,exonEnds,cdsStart,cdsEnd);
  int codingLength=0;
  int lengthExon=0;
  for (int i=cdsRegions.size() - 1; i >= 0; i--) {
    int start=cdsRegions.get(i).lowerEndpoint();
    int end=cdsRegions.get(i).upperEndpoint();
    lengthExon=end - start;
    if (start + base <= chromPos && end >= chromPos) {
      return codingLength + (end - chromPos + 1);
    }
 else {
      codingLength+=lengthExon;
    }
  }
  return -1;
}
Program: 16234
Project: 16234
Buggy source:
/** 
 * Get the length of the CDS in nucleotides.
 * @param chromPos
 * @return length of the CDS in nucleotides.
 */
public static int getCDSLength(GeneChromosomePosition chromPos){
  logger.debug(chromPos.toString());
  logger.debug("String_Node_Str");
  logger.debug("String_Node_Str" + chromPos.getGeneName());
  logger.debug("String_Node_Str" + chromPos.getTranscriptionStart() + "String_Node_Str"+ chromPos.getTranscriptionEnd()+ "String_Node_Str"+ (chromPos.getTranscriptionEnd() - chromPos.getTranscriptionStart())+ "String_Node_Str");
  logger.debug("String_Node_Str" + chromPos.getOrientation());
  logger.debug("String_Node_Str" + (chromPos.getCdsStart()) + "String_Node_Str"+ chromPos.getCdsEnd()+ "String_Node_Str"+ (chromPos.getCdsEnd() - chromPos.getCdsStart())+ "String_Node_Str");
  List<Integer> exonStarts=chromPos.getExonStarts();
  List<Integer> exonEnds=chromPos.getExonEnds();
  logger.debug("String_Node_Str" + exonStarts.size());
  int cdsStart=chromPos.getCdsStart();
  int cdsEnd=chromPos.getCdsEnd();
  int codingLength;
  if (chromPos.getOrientation().equals('+'))   codingLength=ChromosomeMappingTools.getCDSLengthForward(exonStarts,exonEnds,cdsStart,cdsEnd);
 else   codingLength=ChromosomeMappingTools.getCDSLengthReverse(exonStarts,exonEnds,cdsStart,cdsEnd);
  return codingLength;
}

Fixed version (ground truth):
/** 
 * Get the length of the CDS in nucleotides.
 * @param chromPos
 * @return length of the CDS in nucleotides.
 */
public static int getCDSLength(GeneChromosomePosition chromPos){
  List<Integer> exonStarts=chromPos.getExonStarts();
  List<Integer> exonEnds=chromPos.getExonEnds();
  int cdsStart=chromPos.getCdsStart();
  int cdsEnd=chromPos.getCdsEnd();
  int codingLength;
  if (chromPos.getOrientation().equals('+'))   codingLength=ChromosomeMappingTools.getCDSLengthForward(exonStarts,exonEnds,cdsStart,cdsEnd);
 else   codingLength=ChromosomeMappingTools.getCDSLengthReverse(exonStarts,exonEnds,cdsStart,cdsEnd);
  return codingLength;
}
Program: 16235
Project: 16235
Buggy source:
/** 
 * Converts the genetic coordinate to the position of the nucleotide on the mRNA sequence for a gene  living on the forward DNA strand.
 * @param chromPos The genetic coordinate on a chromosome 
 * @param exonStarts The list holding the genetic coordinates pointing to the start positions of the exons (including UTR regions)  
 * @param exonEnds The list holding the genetic coordinates pointing to the end positions of the exons (including UTR regions)
 * @param cdsStart The start position of a coding region
 * @param cdsEnd The end position of a coding region
 * @return the position of the nucleotide base on the mRNA sequence corresponding to the input genetic coordinate (base 1)
 * @author Yana Valasatava
 */
public static int getCDSPosForward(int chromPos,List<Integer> exonStarts,List<Integer> exonEnds,int cdsStart,int cdsEnd){
  if ((chromPos < (cdsStart + 1)) || (chromPos > (cdsEnd + 1))) {
    logger.debug("String_Node_Str" + format(chromPos) + "String_Node_Str");
    return -1;
  }
  logger.debug("String_Node_Str" + format(chromPos));
  List<Range<Integer>> cdsRegions=getCDSRegions(exonStarts,exonEnds,cdsStart,cdsEnd);
  int codingLength=0;
  int lengthExon=0;
  for (  Range<Integer> range : cdsRegions) {
    int start=range.lowerEndpoint();
    int end=range.upperEndpoint();
    lengthExon=end - start;
    if (start + 1 <= chromPos && end >= chromPos) {
      return codingLength + (chromPos - start);
    }
 else {
      codingLength+=lengthExon;
    }
  }
  return -1;
}

Fixed version (ground truth):
/** 
 * Converts the genetic coordinate to the position of the nucleotide on the mRNA sequence for a gene  living on the forward DNA strand.
 * @param chromPos The genetic coordinate on a chromosome 
 * @param exonStarts The list holding the genetic coordinates pointing to the start positions of the exons (including UTR regions)  
 * @param exonEnds The list holding the genetic coordinates pointing to the end positions of the exons (including UTR regions)
 * @param cdsStart The start position of a coding region
 * @param cdsEnd The end position of a coding region
 * @return the position of the nucleotide base on the mRNA sequence corresponding to the input genetic coordinate (base 1)
 * @author Yana Valasatava
 */
public static int getCDSPosForward(int chromPos,List<Integer> exonStarts,List<Integer> exonEnds,int cdsStart,int cdsEnd){
  if ((chromPos < (cdsStart + base)) || (chromPos > (cdsEnd + base))) {
    logger.debug("String_Node_Str" + format(chromPos) + "String_Node_Str");
    return -1;
  }
  logger.debug("String_Node_Str" + format(chromPos));
  List<Range<Integer>> cdsRegions=getCDSRegions(exonStarts,exonEnds,cdsStart,cdsEnd);
  int codingLength=0;
  int lengthExon=0;
  for (  Range<Integer> range : cdsRegions) {
    int start=range.lowerEndpoint();
    int end=range.upperEndpoint();
    lengthExon=end - start;
    if (start + base <= chromPos && end >= chromPos) {
      return codingLength + (chromPos - start);
    }
 else {
      codingLength+=lengthExon;
    }
  }
  return -1;
}
Program: 16236
Project: 16236
Buggy source:
/** 
 * Get the length of the coding sequence
 * @param exonStarts
 * @param exonEnds
 * @param cdsStart
 * @param cdsEnd
 * @return
 */
public static int getCDSLengthForward(List<Integer> exonStarts,List<Integer> exonEnds,int cdsStart,int cdsEnd){
  boolean inCoding=false;
  int codingLength=0;
  int lengthExons=0;
  for (int i=0; i < exonStarts.size(); i++) {
    int start=exonStarts.get(i);
    int end=exonEnds.get(i);
    lengthExons+=end - start;
    logger.debug("String_Node_Str" + (start + 1) + "String_Node_Str"+ end+ "String_Node_Str"+ (end - start));
    if (start + 1 <= cdsStart + 1 && end >= cdsStart + 1) {
      inCoding=true;
      codingLength+=(end - cdsStart);
      logger.debug("String_Node_Str" + start + "String_Node_Str"+ (cdsStart));
      logger.debug("String_Node_Str" + (cdsStart + 1) + "String_Node_Str"+ end+ "String_Node_Str"+ (end - cdsStart + 1)+ "String_Node_Str"+ codingLength+ "String_Node_Str"+ (codingLength % 3));
    }
 else     if (start + 1 <= cdsEnd && end >= cdsEnd) {
      inCoding=false;
      codingLength+=(cdsEnd - start);
      logger.debug("String_Node_Str" + (start + 1) + "String_Node_Str"+ cdsEnd+ "String_Node_Str"+ (cdsEnd - start + 1)+ "String_Node_Str"+ codingLength+ "String_Node_Str"+ (codingLength % 3));
      logger.debug("String_Node_Str" + cdsEnd + 1+ "String_Node_Str"+ end);
    }
 else     if (inCoding) {
      codingLength+=(end - start);
      logger.debug("String_Node_Str" + (start + 1) + "String_Node_Str"+ end+ "String_Node_Str"+ (end - start + 1)+ "String_Node_Str"+ codingLength+ "String_Node_Str"+ (codingLength % 3));
    }
  }
  logger.debug("String_Node_Str" + Integer.toString(lengthExons));
  logger.debug("String_Node_Str" + Integer.toString((codingLength - 3)));
  return codingLength - 3;
}

Fixed version (ground truth):
/** 
 * Get the length of the coding sequence
 * @param exonStarts
 * @param exonEnds
 * @param cdsStart
 * @param cdsEnd
 * @return
 */
public static int getCDSLengthForward(List<Integer> exonStarts,List<Integer> exonEnds,int cdsStart,int cdsEnd){
  int codingLength=0;
  for (int i=0; i < exonStarts.size(); i++) {
    int start=exonStarts.get(i) + base;
    int end=exonEnds.get(i);
    if ((start < cdsStart + base && end < cdsStart) || (start > cdsEnd && end > cdsEnd))     continue;
    if (start < cdsStart + base)     start=cdsStart + base;
    if (end > cdsEnd)     end=cdsEnd;
    codingLength+=(end - start + 1);
  }
  return codingLength - 3;
}
Program: 16237
Project: 16237
Buggy source:
/** 
 * This method sets the maximum stretch allowed for a base pair, prior to analyze() call.
 * @param maxStretch The maximum stretch (in Å) allowed to consider two bases paired
 */
public static void setMaxStretch(double maxStretch){
  maxStretch=maxStretch;
}

Fixed version (ground truth):
/** 
 * This method sets the maximum stretch allowed for a base pair, prior to analyze() call.
 * @param maxStretch The maximum stretch (in Å) allowed to consider two bases paired
 */
public void setMaxStretch(double maxStretch){
  this.maxStretch=maxStretch;
}
Program: 16238
Project: 16238
Buggy source:
/** 
 * This method sets the maximum stagger allowed for a base pair, prior to analyze() call
 * @param maxStagger The maximum propeller (in Å) allowed to consider two bases paired
 */
public void setMaxStagger(double maxStagger){
  maxStagger=maxStagger;
}

Fixed version (ground truth):
/** 
 * This method sets the maximum stagger allowed for a base pair, prior to analyze() call
 * @param maxStagger The maximum propeller (in Å) allowed to consider two bases paired
 */
public void setMaxStagger(double maxStagger){
  this.maxStagger=maxStagger;
}
Program: 16239
Project: 16239
Buggy source:
/** 
 * This method sets the maximum shear allowed for a base pair, prior to analyze() call
 * @param maxShear The maximum shear (in Å) allowed to consider two bases paired
 */
public void setMaxShear(double maxShear){
  maxShear=maxShear;
}

Fixed version (ground truth):
/** 
 * This method sets the maximum shear allowed for a base pair, prior to analyze() call
 * @param maxShear The maximum shear (in Å) allowed to consider two bases paired
 */
public void setMaxShear(double maxShear){
  this.maxShear=maxShear;
}
Program: 16240
Project: 16240
Buggy source:
/** 
 * This method sets the maximum propeller allowed for a base pair, prior to analyze() call
 * @param maxPropeller The maximum propeller ("propeller-twist", in degrees) allowed to consider two bases paired
 */
public void setMaxPropeller(double maxPropeller){
  maxPropeller=maxPropeller;
}

Fixed version (ground truth):
/** 
 * This method sets the maximum propeller allowed for a base pair, prior to analyze() call
 * @param maxPropeller The maximum propeller ("propeller-twist", in degrees) allowed to consider two bases paired
 */
public void setMaxPropeller(double maxPropeller){
  this.maxPropeller=maxPropeller;
}
Program: 16241
Project: 16241
Buggy source:
/** 
 * This method sets the maximum stagger allowed for a base pair, prior to analyze() call
 * @param maxStagger The maximum stagger (in Å) allowed to consider two bases paired
 */
public void setMaxStagger(double maxStagger){
  maxStagger=maxStagger;
}

Fixed version (ground truth):
/** 
 * This method sets the maximum stagger allowed for a base pair, prior to analyze() call
 * @param maxStagger The maximum stagger (in Å) allowed to consider two bases paired
 */
public void setMaxStagger(double maxStagger){
  this.maxStagger=maxStagger;
}
Program: 16242
Project: 16242
Buggy source:
/** 
 * This method sets the maximum propeller allowed for a base pair, prior to analyze() call
 * @param maxPropeller The maximum propeller ("propeller-twist", in degrees) allowed to consider two bases paired
 */
public void setMaxPropeller(double maxPropeller){
  maxPropeller=maxPropeller;
}

Fixed version (ground truth):
/** 
 * This method sets the maximum propeller allowed for a base pair, prior to analyze() call
 * @param maxPropeller The maximum propeller ("propeller-twist", in degrees) allowed to consider two bases paired
 */
public void setMaxPropeller(double maxPropeller){
  this.maxPropeller=maxPropeller;
}
Program: 16244
Project: 16244
Buggy source:
@Override public void setHeaderInfo(float rFree,float rWork,float resolution,String title,String depositionDate,String releaseDate,String[] experimentalMethods){
  SimpleDateFormat formatter=new SimpleDateFormat("String_Node_Str");
  PDBHeader pdbHeader=structure.getPDBHeader();
  pdbHeader.setTitle(title);
  pdbHeader.setResolution(resolution);
  pdbHeader.setRfree(rFree);
  pdbHeader.setRwork(rWork);
  for (  String techniqueStr : experimentalMethods) {
    pdbHeader.setExperimentalTechnique(techniqueStr);
  }
  if (depositionDate != null) {
    try {
      Date depDate=formatter.parse(depositionDate);
      pdbHeader.setDepDate(depDate);
    }
 catch (    ParseException e) {
      logger.warn("String_Node_Str",depositionDate);
    }
  }
 else {
    pdbHeader.setDepDate(new Date(0));
  }
  if (releaseDate != null) {
    try {
      Date relDate=formatter.parse(releaseDate);
      pdbHeader.setModDate(relDate);
    }
 catch (    ParseException e) {
      logger.warn("String_Node_Str",releaseDate);
    }
  }
 else {
    pdbHeader.setModDate(new Date(0));
  }
}

Fixed version (ground truth):
@Override public void setHeaderInfo(float rFree,float rWork,float resolution,String title,String depositionDate,String releaseDate,String[] experimentalMethods){
  SimpleDateFormat formatter=new SimpleDateFormat("String_Node_Str");
  PDBHeader pdbHeader=structure.getPDBHeader();
  pdbHeader.setTitle(title);
  pdbHeader.setResolution(resolution);
  pdbHeader.setRfree(rFree);
  pdbHeader.setRwork(rWork);
  if (experimentalMethods != null) {
    for (    String techniqueStr : experimentalMethods) {
      pdbHeader.setExperimentalTechnique(techniqueStr);
    }
  }
  if (depositionDate != null) {
    try {
      Date depDate=formatter.parse(depositionDate);
      pdbHeader.setDepDate(depDate);
    }
 catch (    ParseException e) {
      logger.warn("String_Node_Str",depositionDate);
    }
  }
 else {
    pdbHeader.setDepDate(new Date(0));
  }
  if (releaseDate != null) {
    try {
      Date relDate=formatter.parse(releaseDate);
      pdbHeader.setModDate(relDate);
    }
 catch (    ParseException e) {
      logger.warn("String_Node_Str",releaseDate);
    }
  }
 else {
    pdbHeader.setModDate(new Date(0));
  }
}
Program: 16245
Project: 16245
Buggy source:
/** 
 * Fetch and parse the DSSP file of the specified pdb code from the PDB web server and return the secondary structure annotation as a List of   {@link SecStrucState} objects.
 * @param pdb path to the DSSP file to parse
 * @param structure Structure object associated to the dssp
 * @param assign assigns the SS to the structure if true
 * @return a List of SS annotation objects
 * @throws StructureException
 * @throws IOException
 */
public static List<SecStrucState> fetch(String pdb,Structure structure,boolean assign) throws IOException, StructureException {
  URL url=new URL("String_Node_Str" + pdb.toLowerCase().substring(1,3) + "String_Node_Str"+ pdb.toLowerCase()+ "String_Node_Str"+ pdb+ "String_Node_Str");
  InputStream in=new GZIPInputStream(url.openStream());
  Reader read=new InputStreamReader(in);
  BufferedReader reader=new BufferedReader(read);
  return generalParse(reader,structure,assign);
}

Fixed version (ground truth):
/** 
 * Fetch and parse the DSSP file of the specified pdb code from the PDB web server and return the secondary structure annotation as a List of   {@link SecStrucState} objects.
 * @param pdb path to the DSSP file to parse
 * @param structure Structure object associated to the dssp
 * @param assign assigns the SS to the structure if true
 * @return a List of SS annotation objects
 * @throws StructureException
 * @throws IOException
 */
public static List<SecStrucState> fetch(String pdb,Structure structure,boolean assign) throws IOException, StructureException {
  URL url=new URL("String_Node_Str" + pdb.toLowerCase().substring(1,3) + "String_Node_Str"+ pdb.toLowerCase()+ "String_Node_Str"+ pdb.toLowerCase()+ "String_Node_Str");
  InputStream in=new GZIPInputStream(url.openStream());
  Reader read=new InputStreamReader(in);
  BufferedReader reader=new BufferedReader(read);
  return generalParse(reader,structure,assign);
}
Program: 16247
Project: 16247
Buggy source:
private List<Integer> getPermutation(){
  List<Integer> permutation=new ArrayList<Integer>(transformedCoords.length);
  double sum=0.0f;
  for (  Point3d t : transformedCoords) {
    List<Integer> neighbors=box.getNeighborsWithCache(t);
    int closest=-1;
    double minDist=Double.MAX_VALUE;
    for (    int j : neighbors) {
      double dist=t.distanceSquared(originalCoords[j]);
      if (dist < minDist) {
        closest=j;
        minDist=dist;
      }
    }
    sum+=minDist;
    if (closest == -1) {
      break;
    }
    permutation.add(closest);
  }
  double rmsd=Math.sqrt(sum / transformedCoords.length);
  if (rmsd > distanceThreshold || permutation.size() != transformedCoords.length) {
    permutation.clear();
    return permutation;
  }
  Set<Integer> set=new HashSet<Integer>(permutation);
  if (set.size() != originalCoords.length) {
    permutation.clear();
  }
  return permutation;
}

Fixed version (ground truth):
/** 
 * Compare this.transformedCoords with the original coords. For each subunit, return the transformed subunit with the closest position.
 * @return A list mapping each subunit to the closest transformed subunit
 */
private List<Integer> getPermutation(){
  List<Integer> permutation=new ArrayList<Integer>(transformedCoords.length);
  double sum=0.0f;
  for (  Point3d t : transformedCoords) {
    List<Integer> neighbors=box.getNeighborsWithCache(t);
    int closest=-1;
    double minDist=Double.MAX_VALUE;
    for (    int j : neighbors) {
      double dist=t.distanceSquared(originalCoords[j]);
      if (dist < minDist) {
        closest=j;
        minDist=dist;
      }
    }
    sum+=minDist;
    if (closest == -1) {
      break;
    }
    permutation.add(closest);
  }
  double rmsd=Math.sqrt(sum / transformedCoords.length);
  if (rmsd > distanceThreshold || permutation.size() != transformedCoords.length) {
    permutation.clear();
    return permutation;
  }
  Set<Integer> set=new HashSet<Integer>(permutation);
  if (set.size() != originalCoords.length) {
    permutation.clear();
  }
  return permutation;
}
Program: 16248
Project: 16248
Buggy source:
private void completeRotationGroup(){
  PermutationGroup g=new PermutationGroup();
  for (int i=0; i < rotations.getOrder(); i++) {
    Rotation s=rotations.getRotation(i);
    g.addPermutation(s.getPermutation());
  }
  g.completeGroup();
  if (g.getOrder() == rotations.getOrder()) {
    return;
  }
  for (int i=0; i < g.getOrder(); i++) {
    List<Integer> permutation=g.getPermutation(i);
    boolean isValidPermutation=isValidPermutation(permutation);
    if (isValidPermutation) {
      evaluatePermutation(permutation);
    }
  }
}

Fixed version (ground truth):
/** 
 * Combine current rotations to make all possible permutations. If these are all valid, add them to the rotations
 * @param additionalRots Additional rotations we are considering adding to this.rotations
 * @return whether the rotations were valid and added
 */
private boolean completeRotationGroup(Rotation... additionalRots){
}