nus-yam/ex-repair huggingface dataset:
Program: 61337
Project: 61337
Buggy source:
private static void getSamples() throws IOException {
  File f=new File("String_Node_Str");
  for (  File g : f.listFiles())   sampleData.addAll(readFile(g.getCanonicalPath()));
}

Fixed version (ground truth):
private static void getSamples() throws IOException {
  File f=new File("String_Node_Str");
  for (  File g : f.listFiles()) {
    sampleData.addAll(readFile(g.getCanonicalPath()));
  }
}
Program: 61338
Project: 61338
Buggy source:
private static void getResults() throws IOException {
  result=new ArrayList<Model<VectorWritable>[]>();
  JobConf conf=new JobConf(KMeansDriver.class);
  conf.set(DirichletDriver.MODEL_FACTORY_KEY,"String_Node_Str");
  conf.set(DirichletDriver.NUM_CLUSTERS_KEY,Integer.toString(20));
  conf.set(DirichletDriver.ALPHA_0_KEY,Double.toString(1.0));
  File f=new File("String_Node_Str");
  for (  File g : f.listFiles()) {
    conf.set(DirichletDriver.STATE_IN_KEY,g.getCanonicalPath());
    DirichletState<VectorWritable> dirichletState=DirichletMapper.getDirichletState(conf);
    result.add(dirichletState.getModels());
  }
}

Fixed version (ground truth):
private static void getResults() throws IOException, InvocationTargetException, NoSuchMethodException {
  result=new ArrayList<Model<VectorWritable>[]>();
  JobConf conf=new JobConf(KMeansDriver.class);
  conf.set(DirichletDriver.MODEL_FACTORY_KEY,"String_Node_Str");
  conf.set(DirichletDriver.NUM_CLUSTERS_KEY,Integer.toString(20));
  conf.set(DirichletDriver.ALPHA_0_KEY,Double.toString(1.0));
  File f=new File("String_Node_Str");
  for (  File g : f.listFiles()) {
    conf.set(DirichletDriver.STATE_IN_KEY,g.getCanonicalPath());
    DirichletState<VectorWritable> dirichletState=DirichletMapper.getDirichletState(conf);
    result.add(dirichletState.getModels());
  }
}
Program: 61339
Project: 61339
Buggy source:
@Override public void paint(Graphics g){
  super.plotSampleData(g);
  Graphics2D g2=(Graphics2D)g;
  Vector dv=new DenseVector(2);
  int i=result.size() - 1;
  for (  Model<VectorWritable>[] models : result) {
    g2.setStroke(new BasicStroke(i == 0 ? 3 : 1));
    g2.setColor(colors[Math.min(colors.length - 1,i--)]);
    for (    Model<VectorWritable> m : models) {
      AsymmetricSampledNormalModel mm=(AsymmetricSampledNormalModel)m;
      dv.set(0,mm.getStdDev().get(0) * 3);
      dv.set(1,mm.getStdDev().get(1) * 3);
      if (isSignificant(mm))       plotEllipse(g2,mm.getMean(),dv);
    }
  }
}

Fixed version (ground truth):
@Override public void paint(Graphics g){
  super.plotSampleData(g);
  Graphics2D g2=(Graphics2D)g;
  Vector dv=new DenseVector(2);
  int i=result.size() - 1;
  for (  Model<VectorWritable>[] models : result) {
    g2.setStroke(new BasicStroke(i == 0 ? 3 : 1));
    g2.setColor(colors[Math.min(colors.length - 1,i--)]);
    for (    Model<VectorWritable> m : models) {
      AsymmetricSampledNormalModel mm=(AsymmetricSampledNormalModel)m;
      dv.set(0,mm.getStdDev().get(0) * 3);
      dv.set(1,mm.getStdDev().get(1) * 3);
      if (isSignificant(mm)) {
        plotEllipse(g2,mm.getMean(),dv);
      }
    }
  }
}
Program: 61340
Project: 61340
Buggy source:
public static void main(String[] args) throws IOException {
  RandomUtils.useTestSeed();
  getSamples();
  getResults();
  new DisplayASNOutputState();
}

Fixed version (ground truth):
public static void main(String[] args) throws IOException, InvocationTargetException, NoSuchMethodException {
  RandomUtils.useTestSeed();
  getSamples();
  getResults();
  new DisplayASNOutputState();
}
Program: 61343
Project: 61343
Buggy source:
public static void main(String[] args) throws IOException {
  RandomUtils.useTestSeed();
  generateSamples();
  new DisplayDirichlet();
}

Fixed version (ground truth):
public static void main(String[] args) throws IOException, InvocationTargetException, NoSuchMethodException {
  RandomUtils.useTestSeed();
  generateSamples();
  new DisplayDirichlet();
}
Program: 61344
Project: 61344
Buggy source:
private static void getResults() throws IOException {
  result=new ArrayList<Model<VectorWritable>[]>();
  JobConf conf=new JobConf(KMeansDriver.class);
  conf.set(DirichletDriver.MODEL_FACTORY_KEY,"String_Node_Str");
  conf.set(DirichletDriver.NUM_CLUSTERS_KEY,Integer.toString(20));
  conf.set(DirichletDriver.ALPHA_0_KEY,Double.toString(1.0));
  File f=new File("String_Node_Str");
  for (  File g : f.listFiles()) {
    conf.set(DirichletDriver.STATE_IN_KEY,g.getCanonicalPath());
    DirichletState<VectorWritable> dirichletState=DirichletMapper.getDirichletState(conf);
    result.add(dirichletState.getModels());
  }
}

Fixed version (ground truth):
private static void getResults() throws IOException, InvocationTargetException, NoSuchMethodException {
  result=new ArrayList<Model<VectorWritable>[]>();
  JobConf conf=new JobConf(KMeansDriver.class);
  conf.set(DirichletDriver.MODEL_FACTORY_KEY,"String_Node_Str");
  conf.set(DirichletDriver.NUM_CLUSTERS_KEY,Integer.toString(20));
  conf.set(DirichletDriver.ALPHA_0_KEY,Double.toString(1.0));
  File f=new File("String_Node_Str");
  for (  File g : f.listFiles()) {
    conf.set(DirichletDriver.STATE_IN_KEY,g.getCanonicalPath());
    DirichletState<VectorWritable> dirichletState=DirichletMapper.getDirichletState(conf);
    result.add(dirichletState.getModels());
  }
}
Program: 61345
Project: 61345
Buggy source:
public static void main(String[] args) throws IOException {
  RandomUtils.useTestSeed();
  getSamples();
  getResults();
  new DisplayOutputState();
}

Fixed version (ground truth):
public static void main(String[] args) throws IOException, InvocationTargetException, NoSuchMethodException {
  RandomUtils.useTestSeed();
  getSamples();
  getResults();
  new DisplayOutputState();
}
Program: 61346
Project: 61346
Buggy source:
@Override public long toLongID(String stringID) throws TasteException {
  return hash(stringID);
}

Fixed version (ground truth):
@Override public long toLongID(String stringID){
  return hash(stringID);
}
Program: 61347
Project: 61347
Buggy source:
@Override public boolean equals(Object obj){
  if (this == obj)   return true;
  if (obj == null || !(obj instanceof CDFitness))   return false;
  CDFitness f=(CDFitness)obj;
  return tp == f.getFp() && fp == f.getFp() && tn == f.getTn() && fn == f.getTn();
}

Fixed version (ground truth):
@Override public boolean equals(Object obj){
  if (this == obj)   return true;
  if (obj == null || !(obj instanceof CDFitness))   return false;
  CDFitness f=(CDFitness)obj;
  return tp == f.getTp() && fp == f.getFp() && tn == f.getTn() && fn == f.getFn();
}
Program: 61348
Project: 61348
Buggy source:
@Override public FastIDSet getItemIDsFromUser(long userID) throws TasteException {
  return delegate.getItemIDsFromUser(userID);
}

Fixed version (ground truth):
@Override public FastIDSet getItemIDsFromUser(long userID) throws TasteException {
  checkLoaded();
  return delegate.getItemIDsFromUser(userID);
}
Program: 61349
Project: 61349
Buggy source:
private static void processOtherUser(long id,FastIDSet relevantItemIDs,FastByIDMap<PreferenceArray> trainingUsers,long userID2,DataModel dataModel) throws TasteException {
  PreferenceArray prefs2Array=dataModel.getPreferencesFromUser(userID2);
  if (id == userID2) {
    List<Preference> prefs2=new ArrayList<Preference>(prefs2Array.length());
    for (    Preference pref : prefs2Array) {
      prefs2.add(pref);
    }
    for (Iterator<Preference> iterator=prefs2.iterator(); iterator.hasNext(); ) {
      Preference pref=iterator.next();
      if (relevantItemIDs.contains(pref.getItemID())) {
        iterator.remove();
      }
    }
    prefs2Array=new GenericUserPreferenceArray(prefs2);
  }
  trainingUsers.put(userID2,prefs2Array);
}

Fixed version (ground truth):
private static void processOtherUser(long id,FastIDSet relevantItemIDs,FastByIDMap<PreferenceArray> trainingUsers,long userID2,DataModel dataModel) throws TasteException {
  PreferenceArray prefs2Array=dataModel.getPreferencesFromUser(userID2);
  if (id == userID2) {
    List<Preference> prefs2=new ArrayList<Preference>(prefs2Array.length());
    for (    Preference pref : prefs2Array) {
      prefs2.add(pref);
    }
    for (Iterator<Preference> iterator=prefs2.iterator(); iterator.hasNext(); ) {
      Preference pref=iterator.next();
      if (relevantItemIDs.contains(pref.getItemID())) {
        iterator.remove();
      }
    }
    if (!prefs2.isEmpty()) {
      trainingUsers.put(userID2,new GenericUserPreferenceArray(prefs2));
    }
  }
 else {
    trainingUsers.put(userID2,prefs2Array);
  }
}
Program: 61350
Project: 61350
Buggy source:
@Override public OrderedIntDoubleMapping clone(){
  return new OrderedIntDoubleMapping(indices,values,numMappings);
}

Fixed version (ground truth):
@Override public OrderedIntDoubleMapping clone(){
  return new OrderedIntDoubleMapping(indices.clone(),values.clone(),numMappings);
}
Program: 61352
Project: 61352
Buggy source:
@SuppressWarnings("String_Node_Str") public static DirichletState<Vector> getDirichletState(JobConf job){
  String statePath=job.get(DirichletDriver.STATE_IN_KEY);
  String modelFactory=job.get(DirichletDriver.MODEL_FACTORY_KEY);
  String numClusters=job.get(DirichletDriver.NUM_CLUSTERS_KEY);
  String alpha_0=job.get(DirichletDriver.ALPHA_0_KEY);
  try {
    DirichletState<Vector> state=DirichletDriver.createState(modelFactory,Integer.parseInt(numClusters),Double.parseDouble(alpha_0));
    Path path=new Path(statePath);
    FileSystem fs=FileSystem.get(path.toUri(),job);
    FileStatus[] status=fs.listStatus(path);
    for (    FileStatus s : status) {
      SequenceFile.Reader reader=new SequenceFile.Reader(fs,s.getPath(),job);
      try {
        Text key=new Text();
        DirichletCluster<Vector> cluster=new DirichletCluster();
        while (reader.next(key,cluster)) {
          int index=Integer.parseInt(key.toString());
          state.clusters.set(index,cluster);
          cluster=new DirichletCluster();
        }
      }
  finally {
        reader.close();
      }
    }
    state.mixture=UncommonDistributions.rDirichlet(state.totalCounts());
    return state;
  }
 catch (  Exception e) {
    throw new IllegalStateException(e);
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public static DirichletState<Vector> getDirichletState(JobConf job){
  String statePath=job.get(DirichletDriver.STATE_IN_KEY);
  String modelFactory=job.get(DirichletDriver.MODEL_FACTORY_KEY);
  String numClusters=job.get(DirichletDriver.NUM_CLUSTERS_KEY);
  String alpha_0=job.get(DirichletDriver.ALPHA_0_KEY);
  try {
    DirichletState<Vector> state=DirichletDriver.createState(modelFactory,Integer.parseInt(numClusters),Double.parseDouble(alpha_0));
    Path path=new Path(statePath);
    FileSystem fs=FileSystem.get(path.toUri(),job);
    FileStatus[] status=fs.listStatus(path,new OutputLogFilter());
    for (    FileStatus s : status) {
      SequenceFile.Reader reader=new SequenceFile.Reader(fs,s.getPath(),job);
      try {
        Text key=new Text();
        DirichletCluster<Vector> cluster=new DirichletCluster();
        while (reader.next(key,cluster)) {
          int index=Integer.parseInt(key.toString());
          state.clusters.set(index,cluster);
          cluster=new DirichletCluster();
        }
      }
  finally {
        reader.close();
      }
    }
    state.mixture=UncommonDistributions.rDirichlet(state.totalCounts());
    return state;
  }
 catch (  Exception e) {
    throw new IllegalStateException(e);
  }
}
Program: 61353
Project: 61353
Buggy source:
@Override public ItemItemSimilarity next(){
  if (!hasNext()) {
    throw new NoSuchElementException();
  }
  long itemID2=itemIDs[j];
  double similarity;
  try {
    similarity=otherSimilarity.itemSimilarity(itemID1,itemID2);
  }
 catch (  TasteException te) {
    throw new RuntimeException(te);
  }
  ItemItemSimilarity result=new ItemItemSimilarity(itemID1,itemID2,similarity);
  j++;
  if (j == size) {
    i++;
    itemID1=itemIDs[i];
    j=i + 1;
  }
  return result;
}

Fixed version (ground truth):
@Override public ItemItemSimilarity next(){
  if (next == null) {
    throw new NoSuchElementException();
  }
  ItemItemSimilarity result=next;
  goToNext();
  return result;
}
Program: 61354
Project: 61354
Buggy source:
private DataModelSimilaritiesIterator(ItemSimilarity otherSimilarity,long[] itemIDs){
  this.otherSimilarity=otherSimilarity;
  this.itemIDs=itemIDs;
  this.size=itemIDs.length;
  i=0;
  itemID1=itemIDs[0];
  j=1;
}

Fixed version (ground truth):
private DataModelSimilaritiesIterator(ItemSimilarity otherSimilarity,long[] itemIDs){
  this.otherSimilarity=otherSimilarity;
  this.itemIDs=itemIDs;
  i=0;
  itemID1=itemIDs[0];
  j=1;
  goToNext();
}
Program: 61355
Project: 61355
Buggy source:
@Override public boolean hasNext(){
  return i < size - 1;
}

Fixed version (ground truth):
@Override public boolean hasNext(){
  return next != null;
}
Program: 61356
Project: 61356
Buggy source:
private DataModel buildModel() throws IOException {
  FileLineIterator iterator=new FileLineIterator(dataFile,false);
  String firstLine=iterator.peek();
  char delimiter=determineDelimiter(firstLine);
  boolean hasPrefValues=firstLine.indexOf(delimiter,firstLine.indexOf(delimiter) + 1) >= 0;
  if (hasPrefValues) {
    FastByIDMap<Collection<Preference>> data=new FastByIDMap<Collection<Preference>>();
    processFile(iterator,data,delimiter);
    for (    File updateFile : findUpdateFiles()) {
      processFile(new FileLineIterator(updateFile,false),data,delimiter);
    }
    return new GenericDataModel(GenericDataModel.toDataMap(data,true));
  }
 else {
    FastByIDMap<FastIDSet> data=new FastByIDMap<FastIDSet>();
    processFileWithoutID(iterator,data,delimiter);
    for (    File updateFile : findUpdateFiles()) {
      processFileWithoutID(new FileLineIterator(updateFile,false),data,delimiter);
    }
    return new GenericBooleanPrefDataModel(data);
  }
}

Fixed version (ground truth):
private DataModel buildModel() throws IOException {
  FileLineIterator iterator=new FileLineIterator(dataFile,false);
  String firstLine=iterator.peek();
  while (firstLine.length() == 0 || firstLine.charAt(0) == COMMENT_CHAR) {
    iterator.next();
    firstLine=iterator.peek();
  }
  char delimiter=determineDelimiter(firstLine);
  boolean hasPrefValues=firstLine.indexOf(delimiter,firstLine.indexOf(delimiter) + 1) >= 0;
  if (hasPrefValues) {
    FastByIDMap<Collection<Preference>> data=new FastByIDMap<Collection<Preference>>();
    processFile(iterator,data,delimiter);
    for (    File updateFile : findUpdateFiles()) {
      processFile(new FileLineIterator(updateFile,false),data,delimiter);
    }
    return new GenericDataModel(GenericDataModel.toDataMap(data,true));
  }
 else {
    FastByIDMap<FastIDSet> data=new FastByIDMap<FastIDSet>();
    processFileWithoutID(iterator,data,delimiter);
    for (    File updateFile : findUpdateFiles()) {
      processFileWithoutID(new FileLineIterator(updateFile,false),data,delimiter);
    }
    return new GenericBooleanPrefDataModel(data);
  }
}
Program: 61358
Project: 61358
Buggy source:
protected void processLineWithoutID(String line,FastByIDMap<FastIDSet> data,char delimiter){
  if (line.length() == 0 || line.charAt(0) == '#') {
    return;
  }
  int delimiterOne=line.indexOf((int)delimiter);
  if (delimiterOne < 0) {
    throw new IllegalArgumentException("String_Node_Str" + line);
  }
  long userID=Long.parseLong(line.substring(0,delimiterOne));
  long itemID=Long.parseLong(line.substring(delimiterOne + 1));
  if (transpose) {
    long tmp=userID;
    userID=itemID;
    itemID=tmp;
  }
  FastIDSet itemIDs=data.get(userID);
  if (itemIDs == null) {
    itemIDs=new FastIDSet(2);
    data.put(userID,itemIDs);
  }
  itemIDs.add(itemID);
}

Fixed version (ground truth):
protected void processLineWithoutID(String line,FastByIDMap<FastIDSet> data,char delimiter){
  if (line.length() == 0 || line.charAt(0) == COMMENT_CHAR) {
    return;
  }
  int delimiterOne=line.indexOf((int)delimiter);
  if (delimiterOne < 0) {
    throw new IllegalArgumentException("String_Node_Str" + line);
  }
  long userID=Long.parseLong(line.substring(0,delimiterOne));
  long itemID=Long.parseLong(line.substring(delimiterOne + 1));
  if (transpose) {
    long tmp=userID;
    userID=itemID;
    itemID=tmp;
  }
  FastIDSet itemIDs=data.get(userID);
  if (itemIDs == null) {
    itemIDs=new FastIDSet(2);
    data.put(userID,itemIDs);
  }
  itemIDs.add(itemID);
}
Program: 61359
Project: 61359
Buggy source:
/** 
 * @throws NoSuchUserException if there is no such user 
 */
@Override public FastIDSet getItemIDsFromUser(long id) throws TasteException {
  log.debug("String_Node_Str",id);
  Connection conn=null;
  PreparedStatement stmt=null;
  ResultSet rs=null;
  try {
    conn=dataSource.getConnection();
    stmt=conn.prepareStatement(getUserSQL,ResultSet.TYPE_FORWARD_ONLY,ResultSet.CONCUR_READ_ONLY);
    stmt.setFetchDirection(ResultSet.FETCH_FORWARD);
    stmt.setFetchSize(getFetchSize());
    stmt.setLong(1,id);
    log.debug("String_Node_Str",getUserSQL);
    rs=stmt.executeQuery();
    FastIDSet result=new FastIDSet();
    while (rs.next()) {
      result.add(rs.getLong(1));
    }
    if (result.isEmpty()) {
      throw new NoSuchUserException();
    }
    return result;
  }
 catch (  SQLException sqle) {
    log.warn("String_Node_Str",sqle);
    throw new TasteException(sqle);
  }
 finally {
    IOUtils.quietClose(rs,stmt,conn);
  }
}

Fixed version (ground truth):
/** 
 * @throws NoSuchUserException if there is no such user 
 */
@Override public FastIDSet getItemIDsFromUser(long id) throws TasteException {
  log.debug("String_Node_Str",id);
  Connection conn=null;
  PreparedStatement stmt=null;
  ResultSet rs=null;
  try {
    conn=dataSource.getConnection();
    stmt=conn.prepareStatement(getUserSQL,ResultSet.TYPE_FORWARD_ONLY,ResultSet.CONCUR_READ_ONLY);
    stmt.setFetchDirection(ResultSet.FETCH_FORWARD);
    stmt.setFetchSize(getFetchSize());
    stmt.setLong(1,id);
    log.debug("String_Node_Str",getUserSQL);
    rs=stmt.executeQuery();
    FastIDSet result=new FastIDSet();
    while (rs.next()) {
      result.add(rs.getLong(2));
    }
    if (result.isEmpty()) {
      throw new NoSuchUserException();
    }
    return result;
  }
 catch (  SQLException sqle) {
    log.warn("String_Node_Str",sqle);
    throw new TasteException(sqle);
  }
 finally {
    IOUtils.quietClose(rs,stmt,conn);
  }
}
Program: 61360
Project: 61360
Buggy source:
private static char determineDelimiter(String line){
  char delimiter;
  if (line.indexOf(',') >= 0) {
    delimiter=',';
  }
 else   if (line.indexOf('\t') >= 0) {
    delimiter='\t';
  }
 else {
    throw new IllegalArgumentException("String_Node_Str");
  }
  int delimiterCount=1;
  int lastDelimiter=line.indexOf(delimiter);
  int nextDelimiter;
  while ((nextDelimiter=line.indexOf(delimiter,lastDelimiter + 1)) >= 0) {
    delimiterCount++;
    if (delimiterCount == 3) {
      throw new IllegalArgumentException("String_Node_Str");
    }
    if (nextDelimiter == lastDelimiter + 1) {
      throw new IllegalArgumentException("String_Node_Str");
    }
  }
  return delimiter;
}

Fixed version (ground truth):
private static char determineDelimiter(String line){
  char delimiter;
  if (line.indexOf(',') >= 0) {
    delimiter=',';
  }
 else   if (line.indexOf('\t') >= 0) {
    delimiter='\t';
  }
 else {
    throw new IllegalArgumentException("String_Node_Str");
  }
  int delimiterCount=0;
  int lastDelimiter=line.indexOf(delimiter);
  int nextDelimiter;
  while ((nextDelimiter=line.indexOf(delimiter,lastDelimiter + 1)) >= 0) {
    delimiterCount++;
    if (delimiterCount == 3) {
      throw new IllegalArgumentException("String_Node_Str");
    }
    if (nextDelimiter == lastDelimiter + 1) {
      throw new IllegalArgumentException("String_Node_Str");
    }
    lastDelimiter=nextDelimiter;
  }
  return delimiter;
}
Program: 61361
Project: 61361
Buggy source:
@Override public void removePreference(long userID,long itemID) throws NoSuchUserException {
  throw new UnsupportedOperationException();
}

Fixed version (ground truth):
@Override public void removePreference(long userID,long itemID){
  throw new UnsupportedOperationException();
}
Program: 61362
Project: 61362
Buggy source:
public static FastByIDMap<FastIDSet> toDataMap(FastByIDMap<PreferenceArray> data) throws TasteException {
  for (  Map.Entry<Long,Object> entry : ((FastByIDMap<Object>)(FastByIDMap<?>)data).entrySet()) {
    PreferenceArray prefArray=(PreferenceArray)entry.getValue();
    int size=prefArray.length();
    FastIDSet itemIDs=new FastIDSet(size);
    for (int i=0; i < size; i++) {
      itemIDs.add(prefArray.getItemID(i));
    }
    entry.setValue(itemIDs);
  }
  return (FastByIDMap<FastIDSet>)(FastByIDMap<?>)data;
}

Fixed version (ground truth):
public static FastByIDMap<FastIDSet> toDataMap(FastByIDMap<PreferenceArray> data){
  for (  Map.Entry<Long,Object> entry : ((FastByIDMap<Object>)(FastByIDMap<?>)data).entrySet()) {
    PreferenceArray prefArray=(PreferenceArray)entry.getValue();
    int size=prefArray.length();
    FastIDSet itemIDs=new FastIDSet(size);
    for (int i=0; i < size; i++) {
      itemIDs.add(prefArray.getItemID(i));
    }
    entry.setValue(itemIDs);
  }
  return (FastByIDMap<FastIDSet>)(FastByIDMap<?>)data;
}
Program: 61363
Project: 61363
Buggy source:
@Override public Float getPreferenceValue(long userID,long itemID) throws NoSuchUserException, NoSuchItemException {
  FastIDSet itemIDs=preferenceFromUsers.get(userID);
  if (itemIDs == null) {
    throw new NoSuchUserException();
  }
  if (itemIDs.contains(itemID)) {
    return 1.0f;
  }
  return null;
}

Fixed version (ground truth):
@Override public Float getPreferenceValue(long userID,long itemID) throws NoSuchUserException {
  FastIDSet itemIDs=preferenceFromUsers.get(userID);
  if (itemIDs == null) {
    throw new NoSuchUserException();
  }
  if (itemIDs.contains(itemID)) {
    return 1.0f;
  }
  return null;
}
Program: 61364
Project: 61364
Buggy source:
@Override public int getNumUsersWithPreferenceFor(long... itemIDs) throws NoSuchItemException {
  if (itemIDs.length == 0) {
    return 0;
  }
  FastIDSet userIDs=preferenceForItems.get(itemIDs[0]);
  if (userIDs == null) {
    throw new NoSuchItemException();
  }
  FastIDSet intersection=new FastIDSet(userIDs.size());
  intersection.addAll(userIDs);
  int i=1;
  while (!intersection.isEmpty() && i < itemIDs.length) {
    userIDs=preferenceForItems.get(itemIDs[i]);
    if (userIDs == null) {
      throw new NoSuchItemException();
    }
    intersection.retainAll(userIDs);
  }
  return intersection.size();
}

Fixed version (ground truth):
@Override public int getNumUsersWithPreferenceFor(long... itemIDs) throws NoSuchItemException {
  if (itemIDs.length == 0) {
    return 0;
  }
  FastIDSet userIDs=preferenceForItems.get(itemIDs[0]);
  if (userIDs == null) {
    throw new NoSuchItemException();
  }
  FastIDSet intersection=new FastIDSet(userIDs.size());
  intersection.addAll(userIDs);
  int i=1;
  while (!intersection.isEmpty() && i < itemIDs.length) {
    userIDs=preferenceForItems.get(itemIDs[i]);
    if (userIDs == null) {
      throw new NoSuchItemException();
    }
    intersection.retainAll(userIDs);
    i++;
  }
  return intersection.size();
}
Program: 61365
Project: 61365
Buggy source:
@Override public void setPreference(long userID,long itemID,float value) throws NoSuchUserException {
  throw new UnsupportedOperationException();
}

Fixed version (ground truth):
@Override public void setPreference(long userID,long itemID,float value){
  throw new UnsupportedOperationException();
}
Program: 61367
Project: 61367
Buggy source:
@Override public int getNumItems() throws TasteException {
  return getNumThings("String_Node_Str",getNumItemsSQL);
}

Fixed version (ground truth):
@Override public int getNumItems() throws TasteException {
  if (cachedNumItems < 0) {
    cachedNumItems=getNumThings("String_Node_Str",getNumItemsSQL);
  }
  return cachedNumItems;
}
Program: 61368
Project: 61368
Buggy source:
@Override public int getNumUsers() throws TasteException {
  return getNumThings("String_Node_Str",getNumUsersSQL);
}

Fixed version (ground truth):
@Override public int getNumUsers() throws TasteException {
  if (cachedNumUsers < 0) {
    cachedNumUsers=getNumThings("String_Node_Str",getNumUsersSQL);
  }
  return cachedNumUsers;
}
Program: 61369
Project: 61369
Buggy source:
@Override public void refresh(Collection<Refreshable> alreadyRefreshed){
}

Fixed version (ground truth):
@Override public void refresh(Collection<Refreshable> alreadyRefreshed){
  cachedNumUsers=-1;
  cachedNumItems=-1;
}
Program: 61373
Project: 61373
Buggy source:
@Override public Vector next(){
  Vector result=null;
  int doc=termDocs.doc();
  try {
    indexReader.getTermFreqVector(doc,field,mapper);
    result=mapper.getVector();
    if (idField != null) {
      String id=indexReader.document(doc,idFieldSelector).get(idField);
      result.setName(id);
    }
 else {
      result.setName(String.valueOf(doc));
    }
    if (normPower >= 0) {
      result=result.normalize(normPower);
    }
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
  return result;
}

Fixed version (ground truth):
@Override public Vector next(){
  Vector result=null;
  int doc=termDocs.doc();
  try {
    indexReader.getTermFreqVector(doc,field,mapper);
    result=mapper.getVector();
    if (idField != null) {
      String id=indexReader.document(doc,idFieldSelector).get(idField);
      result.setName(id);
    }
 else {
      result.setName(String.valueOf(doc));
    }
    if (normPower != NO_NORMALIZING) {
      result=result.normalize(normPower);
    }
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
  return result;
}
Program: 61374
Project: 61374
Buggy source:
/** 
 * Produce a LuceneIterable that can create the Vector plus normalize it.
 * @param reader
 * @param idField - The Field containing the id.  May be null
 * @param field The field to use for the Vector
 * @param mapper
 * @param normPower
 */
public LuceneIteratable(IndexReader reader,String idField,String field,VectorMapper mapper,double normPower){
  this.indexReader=reader;
  this.idField=idField;
  this.field=field;
  this.mapper=mapper;
  this.normPower=normPower;
  idFieldSelector=new SetBasedFieldSelector(Collections.singleton(idField),Collections.emptySet());
}

Fixed version (ground truth):
/** 
 * Produce a LuceneIterable that can create the Vector plus normalize it.
 * @param reader The {@link org.apache.lucene.index.IndexReader} to read the documents from.
 * @param idField - The Field containing the id.  May be null
 * @param field The field to use for the Vector
 * @param mapper The {@link org.apache.mahout.utils.vectors.lucene.VectorMapper} for creating {@link org.apache.mahout.matrix.Vector}s from Lucene's TermVectors.
 * @param normPower The normalization value.  Must be greater than or equal to 0 or equal to {@link #NO_NORMALIZING}
 */
public LuceneIteratable(IndexReader reader,String idField,String field,VectorMapper mapper,double normPower){
  if (normPower != NO_NORMALIZING && normPower < 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  idFieldSelector=new SetBasedFieldSelector(Collections.singleton(idField),Collections.emptySet());
  this.indexReader=reader;
  this.idField=idField;
  this.field=field;
  this.mapper=mapper;
  this.normPower=normPower;
}
Program: 61375
Project: 61375
Buggy source:
public static void main(String[] args) throws IOException {
  if (args.length == 7) {
    String input=args[0];
    String output=args[1];
    String measureClass=args[2];
    double t1=Double.parseDouble(args[3]);
    double t2=Double.parseDouble(args[4]);
    double convergenceDelta=Double.parseDouble(args[5]);
    int maxIterations=Integer.parseInt(args[6]);
    runJob(input,output,measureClass,convergenceDelta,t1,t2,maxIterations);
  }
 else   runJob("String_Node_Str","String_Node_Str","String_Node_Str",80,55,0.5,10);
}

Fixed version (ground truth):
public static void main(String[] args) throws IOException {
  if (args.length == 7) {
    String input=args[0];
    String output=args[1];
    String measureClass=args[2];
    double t1=Double.parseDouble(args[3]);
    double t2=Double.parseDouble(args[4]);
    double convergenceDelta=Double.parseDouble(args[5]);
    int maxIterations=Integer.parseInt(args[6]);
    runJob(input,output,measureClass,t1,t2,convergenceDelta,maxIterations);
  }
 else   runJob("String_Node_Str","String_Node_Str","String_Node_Str",80,55,0.5,10);
}
Program: 61376
Project: 61376
Buggy source:
@Override public void map(WritableComparable<?> key,Text values,OutputCollector<Text,Text> output,Reporter reporter) throws IOException {
  Vector v=DenseVector.decodeFormat(values.toString());
  Vector pi=normalizedProbabilities(state,v);
  int k=UncommonDistributions.rMultinom(pi);
  output.collect(new Text(String.valueOf(k)),values);
}

Fixed version (ground truth):
@Override public void map(WritableComparable<?> key,Text values,OutputCollector<Text,Text> output,Reporter reporter) throws IOException {
  Vector v=AbstractVector.decodeVector(values.toString());
  Vector pi=normalizedProbabilities(state,v);
  int k=UncommonDistributions.rMultinom(pi);
  output.collect(new Text(String.valueOf(k)),values);
}
Program: 61377
Project: 61377
Buggy source:
@Override public Collection<User> getUserNeighborhood(Object userID) throws TasteException {
  log.trace("String_Node_Str",userID);
  DataModel dataModel=getDataModel();
  User theUser=dataModel.getUser(userID);
  UserSimilarity userSimilarityImpl=getUserSimilarity();
  TopItems.Estimator<User> estimator=new Estimator(userSimilarityImpl,theUser,minSimilarity);
  List<User> neighborhood=TopItems.getTopUsers(n,dataModel.getUsers(),null,estimator);
  log.trace("String_Node_Str",userID,neighborhood);
  return Collections.unmodifiableList(neighborhood);
}

Fixed version (ground truth):
@Override public Collection<User> getUserNeighborhood(Object userID) throws TasteException {
  log.trace("String_Node_Str",userID);
  DataModel dataModel=getDataModel();
  User theUser=dataModel.getUser(userID);
  UserSimilarity userSimilarityImpl=getUserSimilarity();
  TopItems.Estimator<User> estimator=new Estimator(userSimilarityImpl,theUser,minSimilarity);
  Iterable<? extends User> users=SamplingIterable.maybeWrapIterable(dataModel.getUsers(),getSamplingRate());
  List<User> neighborhood=TopItems.getTopUsers(n,users,null,estimator);
  log.trace("String_Node_Str",userID,neighborhood);
  return Collections.unmodifiableList(neighborhood);
}
Program: 61378
Project: 61378
Buggy source:
@Override public Collection<User> getUserNeighborhood(Object userID) throws TasteException {
  log.trace("String_Node_Str",userID);
  DataModel dataModel=getDataModel();
  User theUser=dataModel.getUser(userID);
  List<User> neighborhood=new ArrayList<User>();
  Iterator<? extends User> users=dataModel.getUsers().iterator();
  UserSimilarity userSimilarityImpl=getUserSimilarity();
  while (users.hasNext()) {
    User user=users.next();
    if (sampleForUser() && !userID.equals(user.getID())) {
      double theSimilarity=userSimilarityImpl.userSimilarity(theUser,user);
      if (!Double.isNaN(theSimilarity) && theSimilarity >= threshold) {
        neighborhood.add(user);
      }
    }
  }
  log.trace("String_Node_Str",userID,neighborhood);
  return Collections.unmodifiableList(neighborhood);
}

Fixed version (ground truth):
@Override public Collection<User> getUserNeighborhood(Object userID) throws TasteException {
  log.trace("String_Node_Str",userID);
  DataModel dataModel=getDataModel();
  User theUser=dataModel.getUser(userID);
  List<User> neighborhood=new ArrayList<User>();
  Iterable<? extends User> usersIterable=SamplingIterable.maybeWrapIterable(dataModel.getUsers(),getSamplingRate());
  Iterator<? extends User> users=usersIterable.iterator();
  UserSimilarity userSimilarityImpl=getUserSimilarity();
  while (users.hasNext()) {
    User user=users.next();
    if (!userID.equals(user.getID())) {
      double theSimilarity=userSimilarityImpl.userSimilarity(theUser,user);
      if (!Double.isNaN(theSimilarity) && theSimilarity >= threshold) {
        neighborhood.add(user);
      }
    }
  }
  log.trace("String_Node_Str",userID,neighborhood);
  return Collections.unmodifiableList(neighborhood);
}
Program: 61379
Project: 61379
Buggy source:
@Override public ModelDistribution<?> deserialize(JsonElement json,Type typeOfT,JsonDeserializationContext context) throws JsonParseException {
  ClassLoader ccl=Thread.currentThread().getContextClassLoader();
  Class<?> cl=null;
  try {
    cl=ccl.loadClass(json.getAsString());
  }
 catch (  ClassNotFoundException e) {
    log.warn("String_Node_Str",e);
  }
  try {
    return (ModelDistribution<?>)cl.newInstance();
  }
 catch (  InstantiationException e) {
    log.warn("String_Node_Str",e);
  }
catch (  IllegalAccessException e) {
    log.warn("String_Node_Str",e);
  }
  return null;
}

Fixed version (ground truth):
@Override public ModelDistribution<?> deserialize(JsonElement json,Type typeOfT,JsonDeserializationContext context) throws JsonParseException {
  ClassLoader ccl=Thread.currentThread().getContextClassLoader();
  Class<?> cl=null;
  try {
    cl=ccl.loadClass(json.getAsString());
  }
 catch (  ClassNotFoundException e) {
    log.warn("String_Node_Str",e);
    return null;
  }
  try {
    return (ModelDistribution<?>)cl.newInstance();
  }
 catch (  InstantiationException e) {
    log.warn("String_Node_Str",e);
  }
catch (  IllegalAccessException e) {
    log.warn("String_Node_Str",e);
  }
  return null;
}
Program: 61380
Project: 61380
Buggy source:
public void test() throws IOException {
  Analyzer analyzer=new WhitespaceAnalyzer();
  File[] files=out.listFiles();
  assertEquals("String_Node_Str" + files.length + "String_Node_Str"+ 0,0,files.length);
  Charset charset=Charset.forName("String_Node_Str");
  BayesFileFormatter.format("String_Node_Str",analyzer,input,charset,out);
  files=out.listFiles();
  assertEquals("String_Node_Str" + files.length + "String_Node_Str"+ words.length,files.length,words.length);
  for (  File file : files) {
    BufferedReader reader=new BufferedReader(new InputStreamReader(new FileInputStream(file),charset));
    String line=reader.readLine().trim();
    String label="String_Node_Str" + '\t' + file.getName();
    assertEquals(line + "String_Node_Str" + label+ "String_Node_Str",line,label);
    reader.close();
  }
}

Fixed version (ground truth):
public void test() throws IOException {
  Analyzer analyzer=new WhitespaceAnalyzer();
  File[] files=out.listFiles();
  assertEquals("String_Node_Str" + files.length + "String_Node_Str"+ 0,0,files.length);
  Charset charset=Charset.forName("String_Node_Str");
  BayesFileFormatter.format("String_Node_Str",analyzer,input,charset,out);
  files=out.listFiles();
  assertEquals("String_Node_Str" + files.length + "String_Node_Str"+ words.length,files.length,words.length);
  for (  File file : files) {
    BufferedReader reader=new BufferedReader(new InputStreamReader(new FileInputStream(file),charset));
    String line=reader.readLine();
    if (line != null) {
      line=line.trim();
    }
    String label="String_Node_Str" + '\t' + file.getName();
    assertEquals(line + "String_Node_Str" + label+ "String_Node_Str",line,label);
    reader.close();
  }
}
Program: 61381
Project: 61381
Buggy source:
private void printResults(List<List<DirichletCluster<Vector>>> clusters,int significant){
  int row=0;
  for (  List<DirichletCluster<Vector>> r : clusters) {
    System.out.print("String_Node_Str" + row++ + "String_Node_Str");
    for (int k=0; k < r.size(); k++) {
      Model<Vector> model=r.get(k).model;
      if (model.count() > significant) {
        int total=new Double(r.get(k).totalCount).intValue();
        System.out.print("String_Node_Str" + k + "String_Node_Str"+ total+ "String_Node_Str"+ model.toString()+ "String_Node_Str");
      }
    }
    System.out.println();
  }
  System.out.println();
}

Fixed version (ground truth):
private static void printResults(List<List<DirichletCluster<Vector>>> clusters,int significant){
  int row=0;
  for (  List<DirichletCluster<Vector>> r : clusters) {
    System.out.print("String_Node_Str" + row++ + "String_Node_Str");
    for (int k=0; k < r.size(); k++) {
      Model<Vector> model=r.get(k).model;
      if (model.count() > significant) {
        int total=(int)r.get(k).totalCount;
        System.out.print("String_Node_Str" + k + '('+ total+ ')'+ model.toString()+ "String_Node_Str");
      }
    }
    System.out.println();
  }
  System.out.println();
}
Program: 61382
Project: 61382
Buggy source:
/** 
 * Actually prints out the clusters
 * @param clusters a List of Lists of DirichletClusters
 * @param significant the minimum number of samples to enable printing a model
 */
private static void printResults(List<List<DirichletCluster<Vector>>> clusters,int significant){
  int row=0;
  for (  List<DirichletCluster<Vector>> r : clusters) {
    System.out.print("String_Node_Str" + row++ + "String_Node_Str");
    for (int k=0; k < r.size(); k++) {
      Model<Vector> model=r.get(k).model;
      if (model.count() > significant) {
        int total=new Double(r.get(k).totalCount).intValue();
        System.out.print("String_Node_Str" + k + "String_Node_Str"+ total+ "String_Node_Str"+ model.toString()+ "String_Node_Str");
      }
    }
    System.out.println();
  }
  System.out.println();
}

Fixed version (ground truth):
/** 
 * Actually prints out the clusters
 * @param clusters a List of Lists of DirichletClusters
 * @param significant the minimum number of samples to enable printing a model
 */
private static void printResults(List<List<DirichletCluster<Vector>>> clusters,int significant){
  int row=0;
  for (  List<DirichletCluster<Vector>> r : clusters) {
    System.out.print("String_Node_Str" + row++ + "String_Node_Str");
    for (int k=0; k < r.size(); k++) {
      Model<Vector> model=r.get(k).model;
      if (model.count() > significant) {
        int total=(int)r.get(k).totalCount;
        System.out.print("String_Node_Str" + k + '('+ total+ ')'+ model.toString()+ "String_Node_Str");
      }
    }
    System.out.println();
  }
  System.out.println();
}
Program: 61383
Project: 61383
Buggy source:
public void testRanges() throws IOException {
  FileSystem fs=FileSystem.get(new Configuration());
  Path inpath=new Path("String_Node_Str");
  DataSet dataset=FileInfoParser.parseFile(fs,inpath);
  DataSet.initialize(dataset);
  String filename="String_Node_Str";
  BufferedReader in=new BufferedReader(new InputStreamReader(new FileInputStream(filename),Charset.forName("String_Node_Str")));
  String line;
  DataLine dl=new DataLine();
  while ((line=in.readLine()) != null) {
    dl.set(line);
    for (int index=0; index < dataset.getNbAttributes(); index++) {
      if (dataset.isNumerical(index)) {
        assertInRange(dl.getAttribut(index),dataset.getMin(index),dataset.getMax(index));
      }
 else {
        assertInRange(dl.getAttribut(index),0,dataset.getNbValues(index));
      }
    }
  }
}

Fixed version (ground truth):
public void testRanges() throws IOException {
  FileSystem fs=FileSystem.get(new Configuration());
  Path inpath=new Path("String_Node_Str");
  DataSet dataset=FileInfoParser.parseFile(fs,inpath);
  DataSet.initialize(dataset);
  String filename="String_Node_Str";
  BufferedReader in=new BufferedReader(new InputStreamReader(new FileInputStream(filename),Charset.forName("String_Node_Str")));
  String line;
  DataLine dl=new DataLine();
  while ((line=in.readLine()) != null) {
    dl.set(line);
    for (int index=0; index < dataset.getNbAttributes(); index++) {
      if (dataset.isNumerical(index)) {
        assertInRange(dl.getAttribut(index),dataset.getMin(index),dataset.getMax(index));
      }
 else {
        assertInRange(dl.getAttribut(index),0,dataset.getNbValues(index));
      }
    }
  }
  in.close();
}
Program: 61384
Project: 61384
Buggy source:
/** 
 * Run the job using supplied arguments
 * @param input the directory pathname for input points
 * @param clustersIn the directory pathname for input clusters
 * @param output the directory pathname for output points
 * @param measureClass the classname of the DistanceMeasure
 * @param convergenceDelta the convergence delta value
 */
private static void runClustering(String input,String clustersIn,String output,String measureClass,String convergenceDelta){
  JobClient client=new JobClient();
  JobConf conf=new JobConf(KMeansDriver.class);
  conf.setOutputKeyClass(Text.class);
  conf.setOutputValueClass(Text.class);
  FileInputFormat.setInputPaths(conf,new Path(input));
  Path outPath=new Path(output);
  FileOutputFormat.setOutputPath(conf,outPath);
  conf.setMapperClass(KMeansClusterMapper.class);
  conf.setNumReduceTasks(0);
  conf.set(Cluster.CLUSTER_PATH_KEY,clustersIn);
  conf.set(Cluster.DISTANCE_MEASURE_KEY,measureClass);
  conf.set(Cluster.CLUSTER_CONVERGENCE_KEY,convergenceDelta);
  client.setConf(conf);
  conf.set("String_Node_Str","String_Node_Str");
  try {
    JobClient.runJob(conf);
  }
 catch (  IOException e) {
    log.warn(e.toString(),e);
  }
}

Fixed version (ground truth):
/** 
 * Run the job using supplied arguments
 * @param input the directory pathname for input points
 * @param clustersIn the directory pathname for input clusters
 * @param output the directory pathname for output points
 * @param measureClass the classname of the DistanceMeasure
 * @param convergenceDelta the convergence delta value
 */
private static void runClustering(String input,String clustersIn,String output,String measureClass,String convergenceDelta){
  JobClient client=new JobClient();
  JobConf conf=new JobConf(KMeansDriver.class);
  conf.setOutputKeyClass(Text.class);
  conf.setOutputValueClass(Text.class);
  FileInputFormat.setInputPaths(conf,new Path(input));
  Path outPath=new Path(output);
  FileOutputFormat.setOutputPath(conf,outPath);
  conf.setMapperClass(KMeansClusterMapper.class);
  conf.setNumReduceTasks(0);
  conf.set(Cluster.CLUSTER_PATH_KEY,clustersIn);
  conf.set(Cluster.DISTANCE_MEASURE_KEY,measureClass);
  conf.set(Cluster.CLUSTER_CONVERGENCE_KEY,convergenceDelta);
  client.setConf(conf);
  try {
    JobClient.runJob(conf);
  }
 catch (  IOException e) {
    log.warn(e.toString(),e);
  }
}
Program: 61385
Project: 61385
Buggy source:
/** 
 * Run the job using supplied arguments
 * @param input the directory pathname for input points
 * @param clustersIn the directory pathname for iniput clusters
 * @param clustersOut the directory pathname for output clusters
 * @param measureClass the classname of the DistanceMeasure
 * @param convergenceDelta the convergence delta value
 * @return true if the iteration successfully runs
 */
private static boolean runIteration(String input,String clustersIn,String clustersOut,String measureClass,String convergenceDelta,int numReduceTasks){
  JobClient client=new JobClient();
  JobConf conf=new JobConf(KMeansDriver.class);
  conf.setInputFormat(TextInputFormat.class);
  conf.setOutputKeyClass(Text.class);
  conf.setOutputValueClass(Text.class);
  FileInputFormat.setInputPaths(conf,new Path(input));
  Path outPath=new Path(clustersOut);
  FileOutputFormat.setOutputPath(conf,outPath);
  conf.setMapperClass(KMeansMapper.class);
  conf.setCombinerClass(KMeansCombiner.class);
  conf.setReducerClass(KMeansReducer.class);
  conf.setNumReduceTasks(numReduceTasks);
  conf.set(Cluster.CLUSTER_PATH_KEY,clustersIn);
  conf.set(Cluster.DISTANCE_MEASURE_KEY,measureClass);
  conf.set(Cluster.CLUSTER_CONVERGENCE_KEY,convergenceDelta);
  conf.set("String_Node_Str","String_Node_Str");
  conf.set("String_Node_Str","String_Node_Str");
  client.setConf(conf);
  try {
    JobClient.runJob(conf);
    FileSystem fs=FileSystem.get(conf);
    return isConverged(clustersOut + "String_Node_Str",conf,fs);
  }
 catch (  IOException e) {
    log.warn(e.toString(),e);
    return true;
  }
}

Fixed version (ground truth):
/** 
 * Run the job using supplied arguments
 * @param input the directory pathname for input points
 * @param clustersIn the directory pathname for iniput clusters
 * @param clustersOut the directory pathname for output clusters
 * @param measureClass the classname of the DistanceMeasure
 * @param convergenceDelta the convergence delta value
 * @return true if the iteration successfully runs
 */
private static boolean runIteration(String input,String clustersIn,String clustersOut,String measureClass,String convergenceDelta,int numReduceTasks){
  JobClient client=new JobClient();
  JobConf conf=new JobConf(KMeansDriver.class);
  conf.setOutputKeyClass(Text.class);
  conf.setOutputValueClass(Text.class);
  FileInputFormat.setInputPaths(conf,new Path(input));
  Path outPath=new Path(clustersOut);
  FileOutputFormat.setOutputPath(conf,outPath);
  conf.setOutputFormat(SequenceFileOutputFormat.class);
  conf.setMapperClass(KMeansMapper.class);
  conf.setCombinerClass(KMeansCombiner.class);
  conf.setReducerClass(KMeansReducer.class);
  conf.setNumReduceTasks(numReduceTasks);
  conf.set(Cluster.CLUSTER_PATH_KEY,clustersIn);
  conf.set(Cluster.DISTANCE_MEASURE_KEY,measureClass);
  conf.set(Cluster.CLUSTER_CONVERGENCE_KEY,convergenceDelta);
  client.setConf(conf);
  try {
    JobClient.runJob(conf);
    FileSystem fs=FileSystem.get(conf);
    return isConverged(clustersOut + "String_Node_Str",conf,fs);
  }
 catch (  IOException e) {
    log.warn(e.toString(),e);
    return true;
  }
}
Program: 61386
Project: 61386
Buggy source:
/** 
 * Return if all of the Clusters in the filePath have converged or not
 * @param filePath the file path to the single file containing the clusters
 * @param conf the JobConf
 * @param fs the FileSystem
 * @return true if all Clusters are converged
 * @throws IOException if there was an IO error
 */
private static boolean isConverged(String filePath,JobConf conf,FileSystem fs) throws IOException {
  Path clusterPath=new Path(filePath);
  List<Path> result=new ArrayList<Path>();
  PathFilter clusterFileFilter=new PathFilter(){
    public boolean accept(    Path path){
      return path.getName().startsWith("String_Node_Str");
    }
  }
;
  FileStatus[] matches=fs.listStatus(FileUtil.stat2Paths(fs.globStatus(clusterPath,clusterFileFilter)),clusterFileFilter);
  for (  FileStatus match : matches) {
    result.add(fs.makeQualified(match.getPath()));
  }
  boolean converged=true;
  for (  Path p : result) {
    KeyValueLineRecordReader reader=null;
    try {
      reader=new KeyValueLineRecordReader(conf,new FileSplit(p,0,fs.getFileStatus(p).getLen(),(String[])null));
      Text key=new Text();
      Text value=new Text();
      while (converged && reader.next(key,value)) {
        converged=value.toString().startsWith("String_Node_Str");
      }
    }
  finally {
      if (reader != null) {
        reader.close();
      }
    }
  }
  return converged;
}

Fixed version (ground truth):
/** 
 * Return if all of the Clusters in the filePath have converged or not
 * @param filePath the file path to the single file containing the clusters
 * @param conf     the JobConf
 * @param fs       the FileSystem
 * @return true if all Clusters are converged
 * @throws IOException if there was an IO error
 */
private static boolean isConverged(String filePath,JobConf conf,FileSystem fs) throws IOException {
  Path outPart=new Path(filePath);
  SequenceFile.Reader reader=new SequenceFile.Reader(fs,outPart,conf);
  Text key=new Text();
  Text value=new Text();
  boolean converged=true;
  while (converged && reader.next(key,value)) {
    converged=value.toString().charAt(0) == 'V';
  }
  return converged;
}