nus-yam/ex-repair huggingface dataset:
Program: 61210
Project: 61210
Buggy source:
private static List<Path> createDictionaryChunks(Path inputPath,Path dictionaryPathBase,String name,Configuration baseConf,int chunkSizeInMegabytes,int[] maxTermDimension) throws IOException {
  List<Path> chunkPaths=Lists.newArrayList();
  Configuration conf=new Configuration(baseConf);
  FileSystem fs=FileSystem.get(inputPath.toUri(),conf);
  long chunkSizeLimit=chunkSizeInMegabytes * 1024L * 1024L;
  int chunkIndex=0;
  Path chunkPath=new Path(dictionaryPathBase,name + chunkIndex);
  chunkPaths.add(chunkPath);
  SequenceFile.Writer dictWriter=new SequenceFile.Writer(fs,conf,chunkPath,Text.class,IntWritable.class);
  try {
    long currentChunkSize=0;
    Path filesPattern=new Path(inputPath,OUTPUT_FILES_PATTERN);
    int i=0;
    for (    Pair<Writable,Writable> record : new SequenceFileDirIterable<Writable,Writable>(filesPattern,PathType.GLOB,null,null,true,conf)) {
      if (currentChunkSize > chunkSizeLimit) {
        Closeables.closeQuietly(dictWriter);
        chunkIndex++;
        chunkPath=new Path(dictionaryPathBase,name + chunkIndex);
        chunkPaths.add(chunkPath);
        dictWriter=new SequenceFile.Writer(fs,conf,chunkPath,Text.class,IntWritable.class);
        currentChunkSize=0;
      }
      Writable key=record.getFirst();
      int fieldSize=DICTIONARY_BYTE_OVERHEAD + key.toString().length() * 2 + Integer.SIZE / 8;
      currentChunkSize+=fieldSize;
      dictWriter.append(key,new IntWritable(i++));
    }
    maxTermDimension[0]=i;
  }
  finally {
    Closeables.closeQuietly(dictWriter);
  }
  return chunkPaths;
}

Fixed version (ground truth):
private static List<Path> createDictionaryChunks(Path inputPath,Path dictionaryPathBase,String name,Configuration baseConf,int chunkSizeInMegabytes,int[] maxTermDimension) throws IOException {
  List<Path> chunkPaths=Lists.newArrayList();
  Configuration conf=new Configuration(baseConf);
  FileSystem fs=FileSystem.get(inputPath.toUri(),conf);
  long chunkSizeLimit=chunkSizeInMegabytes * 1024L * 1024L;
  int chunkIndex=0;
  Path chunkPath=new Path(dictionaryPathBase,name + chunkIndex);
  chunkPaths.add(chunkPath);
  SequenceFile.Writer dictWriter=new SequenceFile.Writer(fs,conf,chunkPath,Text.class,IntWritable.class);
  try {
    long currentChunkSize=0;
    Path filesPattern=new Path(inputPath,OUTPUT_FILES_PATTERN);
    int i=1;
    for (    Pair<Writable,Writable> record : new SequenceFileDirIterable<Writable,Writable>(filesPattern,PathType.GLOB,null,null,true,conf)) {
      if (currentChunkSize > chunkSizeLimit) {
        Closeables.closeQuietly(dictWriter);
        chunkIndex++;
        chunkPath=new Path(dictionaryPathBase,name + chunkIndex);
        chunkPaths.add(chunkPath);
        dictWriter=new SequenceFile.Writer(fs,conf,chunkPath,Text.class,IntWritable.class);
        currentChunkSize=0;
      }
      Writable key=record.getFirst();
      int fieldSize=DICTIONARY_BYTE_OVERHEAD + key.toString().length() * 2 + Integer.SIZE / 8;
      currentChunkSize+=fieldSize;
      dictWriter.append(key,new IntWritable(i++));
    }
    maxTermDimension[0]=i;
  }
  finally {
    Closeables.closeQuietly(dictWriter);
  }
  return chunkPaths;
}
Program: 61212
Project: 61212
Buggy source:
@Override protected void map(Text key,Text value,Context context) throws IOException, InterruptedException {
  int msgIdKey=Integer.MIN_VALUE;
  int fromKey=Integer.MIN_VALUE;
  String valStr=value.toString();
  String[] splits=StringUtils.splitByWholeSeparatorPreserveAllTokens(valStr,separator);
  if (splits != null && splits.length > 0) {
    if (splits.length > refsIdx) {
      String from=EmailUtility.cleanUpEmailAddress(splits[fromIdx]);
      fromKey=fromDictionary.get(from);
    }
    if (splits.length > refsIdx) {
      String[] theRefs=EmailUtility.parseReferences(splits[refsIdx]);
      if (theRefs != null && theRefs.length > 0) {
        msgIdKey=msgIdDictionary.get(theRefs[0]);
        context.getCounter(Counters.REFERENCE).increment(1);
      }
    }
  }
  if (msgIdKey == Integer.MIN_VALUE) {
    String keyStr=key.toString();
    int idx=keyStr.lastIndexOf('/');
    if (idx != -1) {
      String msgId=keyStr.substring(idx + 1);
      msgIdKey=msgIdDictionary.get(msgId);
      context.getCounter(Counters.ORIGINAL).increment(1);
    }
  }
  if (msgIdKey != Integer.MIN_VALUE && fromKey != Integer.MIN_VALUE) {
    context.write(null,new Text(fromKey + "String_Node_Str" + msgIdKey+ "String_Node_Str"));
  }
}

Fixed version (ground truth):
@Override protected void map(Text key,Text value,Context context) throws IOException, InterruptedException {
  int msgIdKey=Integer.MIN_VALUE;
  int fromKey=Integer.MIN_VALUE;
  String valStr=value.toString();
  String[] splits=StringUtils.splitByWholeSeparatorPreserveAllTokens(valStr,separator);
  if (splits != null && splits.length > 0) {
    if (splits.length > refsIdx) {
      String from=EmailUtility.cleanUpEmailAddress(splits[fromIdx]);
      fromKey=fromDictionary.get(from);
    }
    if (splits.length > refsIdx) {
      String[] theRefs=EmailUtility.parseReferences(splits[refsIdx]);
      if (theRefs != null && theRefs.length > 0) {
        msgIdKey=msgIdDictionary.get(theRefs[0]);
        context.getCounter(Counters.REFERENCE).increment(1);
      }
    }
  }
  if (msgIdKey == Integer.MIN_VALUE) {
    String keyStr=key.toString();
    int idx=keyStr.lastIndexOf('/');
    if (idx != -1) {
      String msgId=keyStr.substring(idx + 1);
      msgIdKey=msgIdDictionary.get(msgId);
      context.getCounter(Counters.ORIGINAL).increment(1);
    }
  }
  if (msgIdKey != Integer.MIN_VALUE && fromKey != Integer.MIN_VALUE) {
    context.write(new Text(fromKey + "String_Node_Str" + msgIdKey),new LongWritable(1));
  }
}
Program: 61213
Project: 61213
Buggy source:
private static void writeContent(String separator,StringBuilder contents,CharSequence body,String[] matches){
  for (  String match : matches) {
    contents.append(match).append(separator);
  }
  contents.append('\n').append(body);
}

Fixed version (ground truth):
private static void writeContent(String separator,StringBuilder contents,CharSequence body,String[] matches){
  for (  String match : matches) {
    if (match != null) {
      contents.append(match).append(separator);
    }
 else {
      contents.append("String_Node_Str").append(separator);
    }
  }
  contents.append('\n').append(body);
}
Program: 61214
Project: 61214
Buggy source:
/** 
 * Creates a new character-stream reader whose critical sections will synchronize on the reader itself.
 */
private CharSequenceReader(CharSequence input){
  int n=input.length();
  buf=CharBuffer.allocate(n);
  for (int i=0; i < n; i++) {
    buf.put(input.charAt(i));
  }
}

Fixed version (ground truth):
/** 
 * Creates a new character-stream reader whose critical sections will synchronize on the reader itself.
 */
private CharSequenceReader(CharSequence input){
  int n=input.length();
  buf=CharBuffer.allocate(n);
  for (int i=0; i < n; i++) {
    buf.put(input.charAt(i));
  }
  buf.rewind();
}
Program: 61215
Project: 61215
Buggy source:
/** 
 * Reads characters into a portion of an array.  This method will block until some input is available, an I/O error occurs, or the end of the stream is reached.
 * @param cbuf Destination buffer
 * @param off  Offset at which to start storing characters
 * @param len  Maximum number of characters to read
 * @return The number of characters read, or -1 if the end of the stream has been reached
 */
@Override public int read(char[] cbuf,int off,int len){
  buf.get(cbuf,off,len);
  return len;
}

Fixed version (ground truth):
/** 
 * Reads characters into a portion of an array.  This method will block until some input is available, an I/O error occurs, or the end of the stream is reached.
 * @param cbuf Destination buffer
 * @param off  Offset at which to start storing characters
 * @param len  Maximum number of characters to read
 * @return The number of characters read, or -1 if the end of the stream has been reached
 */
@Override public int read(char[] cbuf,int off,int len){
  int toRead=Math.min(len,buf.remaining());
  if (toRead > 0) {
    buf.get(cbuf,off,toRead);
    return toRead;
  }
 else {
    return -1;
  }
}
Program: 61216
Project: 61216
Buggy source:
/** 
 * Builds one tree
 * @param treeId tree identifier
 */
public Node build(int treeId,Random rng,PredictionCallback callback){
  log.debug("String_Node_Str");
  Arrays.fill(sampled,false);
  Data bag=data.bagging(rng,sampled);
  log.debug("String_Node_Str");
  Node tree=treeBuilder.build(rng,bag);
  if (callback != null) {
    log.debug("String_Node_Str");
    for (int index=0; index < data.size(); index++) {
      if (!sampled[index]) {
        int prediction=tree.classify(data.get(index));
        callback.prediction(treeId,index,prediction);
      }
    }
  }
  return tree;
}

Fixed version (ground truth):
/** 
 * Builds one tree
 * @param treeId tree identifier
 */
public Node build(int treeId,Random rng,PredictionCallback callback){
  log.debug("String_Node_Str");
  Arrays.fill(sampled,false);
  Data bag=data.bagging(rng,sampled);
  log.debug("String_Node_Str");
  Node tree=treeBuilder.build(rng,bag);
  if (callback != null) {
    log.debug("String_Node_Str");
    for (int index=0; index < data.size(); index++) {
      if (!sampled[index]) {
        Instance instance=data.get(index);
        int prediction=tree.classify(instance);
        callback.prediction(treeId,instance.getId(),prediction);
      }
    }
  }
  return tree;
}
Program: 61217
Project: 61217
Buggy source:
@Override protected void map(LongWritable key,Text value,Context context) throws IOException, InterruptedException {
  instances.add(converter.convert((int)key.get(),value.toString()));
}

Fixed version (ground truth):
@Override protected void map(LongWritable key,Text value,Context context) throws IOException, InterruptedException {
  instances.add(converter.convert(id++,value.toString()));
}
Program: 61218
Project: 61218
Buggy source:
/** 
 * Lists all files in the output   {@code Path}
 * @param fs {@code FileSystem} to use
 * @param outpath output {@code Path}
 * @return {@code Path} array
 */
public static Path[] listOutputFiles(FileSystem fs,Path outpath) throws IOException {
  Collection<Path> outpaths=Lists.newArrayList();
  for (  FileStatus s : fs.listStatus(outpath,PathFilters.logsCRCFilter())) {
    if (!s.isDir()) {
      outpaths.add(s.getPath());
    }
  }
  return outpaths.toArray(new Path[outpaths.size()]);
}

Fixed version (ground truth):
/** 
 * Lists all files in the output   {@code Path}
 * @param fs {@code FileSystem} to use
 * @param outpath output {@code Path}
 * @return {@code Path} array
 */
public static Path[] listOutputFiles(FileSystem fs,Path outpath) throws IOException {
  Collection<Path> outpaths=Lists.newArrayList();
  for (  FileStatus s : fs.listStatus(outpath,PathFilters.logsCRCFilter())) {
    if (!s.isDir() && !s.getPath().getName().startsWith("String_Node_Str")) {
      outpaths.add(s.getPath());
    }
  }
  return outpaths.toArray(new Path[outpaths.size()]);
}
Program: 61220
Project: 61220
Buggy source:
public AbstractMatrix(int rows,int columns){
  this.rows=rows;
  this.columns=columns;
}

Fixed version (ground truth):
protected AbstractMatrix(int rows,int columns){
  this.rows=rows;
  this.columns=columns;
}
Program: 61221
Project: 61221
Buggy source:
@Override public void setQuick(int index,double value){
  Vector v=rowToColumn ? matrix.viewRow(index) : matrix.viewRow(index);
  if (v == null) {
    v=newVector(numCols);
    matrix.assignRow(index,v);
  }
  v.setQuick(transposeOffset,value);
}

Fixed version (ground truth):
@Override public void setQuick(int index,double value){
  Vector v=rowToColumn ? matrix.viewColumn(index) : matrix.viewRow(index);
  if (v == null) {
    v=newVector(numCols);
    if (rowToColumn) {
      matrix.assignColumn(index,v);
    }
 else {
      matrix.assignRow(index,v);
    }
  }
  v.setQuick(transposeOffset,value);
}
Program: 61222
Project: 61222
Buggy source:
@Override public double getQuick(int index){
  Vector v=rowToColumn ? matrix.viewRow(index) : matrix.viewRow(index);
  return v == null ? 0 : v.getQuick(transposeOffset);
}

Fixed version (ground truth):
@Override public double getQuick(int index){
  Vector v=rowToColumn ? matrix.viewColumn(index) : matrix.viewRow(index);
  return v == null ? 0.0 : v.getQuick(transposeOffset);
}
Program: 61223
Project: 61223
Buggy source:
/** 
 * Story: User can set T3 and T4 values to be used by the reducer for its T1 and T2 thresholds
 */
@Test public void testCanopyReducerT3T4Configuration() throws Exception {
  CanopyReducer reducer=new CanopyReducer();
  Configuration conf=new Configuration();
  conf.set(CanopyConfigKeys.DISTANCE_MEASURE_KEY,"String_Node_Str");
  conf.set(CanopyConfigKeys.T1_KEY,String.valueOf(3.1));
  conf.set(CanopyConfigKeys.T2_KEY,String.valueOf(2.1));
  conf.set(CanopyConfigKeys.T3_KEY,String.valueOf(1.1));
  conf.set(CanopyConfigKeys.T4_KEY,String.valueOf(0.1));
  DummyRecordWriter<Text,Canopy> writer=new DummyRecordWriter<Text,Canopy>();
  Reducer<Text,VectorWritable,Text,Canopy>.Context context=DummyRecordWriter.build(reducer,conf,writer,Text.class,VectorWritable.class);
  reducer.setup(context);
  assertEquals(1.1,reducer.canopyClusterer.getT1(),EPSILON);
  assertEquals(0.1,reducer.canopyClusterer.getT2(),EPSILON);
}

Fixed version (ground truth):
/** 
 * Story: User can set T3 and T4 values to be used by the reducer for its T1 and T2 thresholds
 */
@Test public void testCanopyReducerT3T4Configuration() throws Exception {
  CanopyReducer reducer=new CanopyReducer();
  Configuration conf=new Configuration();
  conf.set(CanopyConfigKeys.DISTANCE_MEASURE_KEY,"String_Node_Str");
  conf.set(CanopyConfigKeys.T1_KEY,String.valueOf(3.1));
  conf.set(CanopyConfigKeys.T2_KEY,String.valueOf(2.1));
  conf.set(CanopyConfigKeys.T3_KEY,String.valueOf(1.1));
  conf.set(CanopyConfigKeys.T4_KEY,String.valueOf(0.1));
  DummyRecordWriter<Text,Canopy> writer=new DummyRecordWriter<Text,Canopy>();
  Reducer<Text,VectorWritable,Text,Canopy>.Context context=DummyRecordWriter.build(reducer,conf,writer,Text.class,VectorWritable.class);
  reducer.setup(context);
  assertEquals(1.1,reducer.getCanopyClusterer().getT1(),EPSILON);
  assertEquals(0.1,reducer.getCanopyClusterer().getT2(),EPSILON);
}
Program: 61224
Project: 61224
Buggy source:
protected Integer userIndex(long userID){
  Integer userIndex=userIDMapping.get(userID);
  if (userIndex == null) {
    userIndex=userIDMapping.put(userID,userIDMapping.size());
  }
  return userIndex;
}

Fixed version (ground truth):
protected Integer userIndex(long userID){
  Integer userIndex=userIDMapping.get(userID);
  if (userIndex == null) {
    userIndex=userIDMapping.size();
    userIDMapping.put(userID,userIndex);
  }
  return userIndex;
}
Program: 61225
Project: 61225
Buggy source:
protected Integer itemIndex(long itemID){
  Integer itemIndex=itemIDMapping.get(itemID);
  if (itemIndex == null) {
    itemIndex=itemIDMapping.put(itemID,itemIDMapping.size());
  }
  return itemIndex;
}

Fixed version (ground truth):
protected Integer itemIndex(long itemID){
  Integer itemIndex=itemIDMapping.get(itemID);
  if (itemIndex == null) {
    itemIndex=itemIDMapping.size();
    itemIDMapping.put(itemID,itemIndex);
  }
  return itemIndex;
}
Program: 61226
Project: 61226
Buggy source:
/** 
 * Initializes a dataset using an info file.
 * @param fs file system
 * @param inpath info file
 * @return Initialized Dataset
 */
public static DataSet parseFile(FileSystem fs,Path inpath) throws IOException {
  Path info=getInfoFile(fs,inpath);
  FSDataInputStream input=fs.open(info);
  Scanner reader=new Scanner(input);
  List<Integer> ignored=new ArrayList<Integer>();
  List<Attribute> attributes=new ArrayList<Attribute>();
  int labelIndex=-1;
  int index=0;
  while (reader.hasNextLine()) {
    String line=reader.nextLine();
    Iterator<String> tokens=Arrays.asList(COMMA_SPACE.split(line)).iterator();
    String token=tokens.next();
    if (IGNORED_TOKEN.equals(token)) {
      ignored.add(index);
    }
 else     if (LABEL_TOKEN.equals(token)) {
      labelIndex=index;
      attributes.add(parseNominal(tokens));
    }
 else     if (NOMINAL_TOKEN.equals(token)) {
      attributes.add(parseNominal(tokens));
    }
 else     if (NUMERICAL_TOKEN.equals(token)) {
      attributes.add(parseNumerical(tokens));
    }
 else {
      throw new IllegalArgumentException("String_Node_Str" + token + "String_Node_Str");
    }
  }
  reader.close();
  if (labelIndex == -1) {
    throw new IllegalStateException("String_Node_Str");
  }
  return new DataSet(attributes,ignored,labelIndex);
}

Fixed version (ground truth):
/** 
 * Initializes a dataset using an info file.
 * @param fs file system
 * @param inpath info file
 * @return Initialized Dataset
 */
public static DataSet parseFile(FileSystem fs,Path inpath) throws IOException {
  Path info=getInfoFile(fs,inpath);
  FSDataInputStream input=fs.open(info);
  Scanner reader=new Scanner(input);
  List<Integer> ignored=new ArrayList<Integer>();
  List<Attribute> attributes=new ArrayList<Attribute>();
  int labelIndex=-1;
  int index=0;
  while (reader.hasNextLine()) {
    String line=reader.nextLine();
    Iterator<String> tokens=COMMA.split(line).iterator();
    String token=tokens.next();
    if (IGNORED_TOKEN.equals(token)) {
      ignored.add(index);
    }
 else     if (LABEL_TOKEN.equals(token)) {
      labelIndex=index;
      attributes.add(parseNominal(tokens));
    }
 else     if (NOMINAL_TOKEN.equals(token)) {
      attributes.add(parseNominal(tokens));
    }
 else     if (NUMERICAL_TOKEN.equals(token)) {
      attributes.add(parseNumerical(tokens));
    }
 else {
      throw new IllegalArgumentException("String_Node_Str" + token + "String_Node_Str");
    }
  }
  reader.close();
  if (labelIndex == -1) {
    throw new IllegalStateException("String_Node_Str");
  }
  return new DataSet(attributes,ignored,labelIndex);
}
Program: 61227
Project: 61227
Buggy source:
/** 
 * Extracts the output and processes it
 * @return info for each partition in Hadoop's order
 */
protected Step0Output[] parseOutput(JobContext job) throws IOException {
  Configuration conf=job.getConfiguration();
  log.info("String_Node_Str",conf.getInt("String_Node_Str",-1));
  FileSystem fs=outputPath.getFileSystem(conf);
  Path[] outfiles=DFUtils.listOutputFiles(fs,outputPath);
  List<Integer> keys=new ArrayList<Integer>();
  List<Step0Output> values=new ArrayList<Step0Output>();
  for (  Path path : outfiles) {
    for (    Pair<IntWritable,Step0Output> record : new SequenceFileIterable<IntWritable,Step0Output>(path,conf)) {
      keys.add(record.getFirst().get());
      values.add(record.getSecond());
    }
  }
  return processOutput(keys,values);
}

Fixed version (ground truth):
/** 
 * Extracts the output and processes it
 * @return info for each partition in Hadoop's order
 */
protected Step0Output[] parseOutput(JobContext job) throws IOException {
  Configuration conf=job.getConfiguration();
  log.info("String_Node_Str",conf.getInt("String_Node_Str",-1));
  List<Integer> keys=new ArrayList<Integer>();
  List<Step0Output> values=new ArrayList<Step0Output>();
  for (  Pair<IntWritable,Step0Output> record : new SequenceFileDirIterable<IntWritable,Step0Output>(outputPath,PathType.LIST,PathFilters.logsCRCFilter(),conf)) {
    keys.add(record.getFirst().get());
    values.add(record.getSecond());
  }
  return processOutput(keys,values);
}
Program: 61228
Project: 61228
Buggy source:
/** 
 * Test the main method of the SequenceFilesFromMailArchives command-line application.
 */
@Test public void testMain() throws Exception {
  String[] args={"String_Node_Str",inputDir.getAbsolutePath(),"String_Node_Str",outputDir.getAbsolutePath(),"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  SequenceFilesFromMailArchives.main(args);
  File expectedChunkFile=new File(outputDir,"String_Node_Str");
  String expectedChunkPath=expectedChunkFile.getAbsolutePath();
  Assert.assertTrue("String_Node_Str" + expectedChunkPath + "String_Node_Str",expectedChunkFile.isFile());
  Configuration conf=new Configuration();
  SequenceFileIterator<Text,Text> iterator=new SequenceFileIterator<Text,Text>(new Path(expectedChunkPath),true,conf);
  Assert.assertTrue("String_Node_Str",iterator.hasNext());
  Pair<Text,Text> record=iterator.next();
  Assert.assertEquals("String_Node_Str" + testVars[0][0],record.getFirst().toString());
  Assert.assertEquals(testVars[0][1] + testVars[0][2],record.getSecond().toString());
  Assert.assertTrue("String_Node_Str",iterator.hasNext());
  record=iterator.next();
  Assert.assertEquals("String_Node_Str" + testVars[1][0],record.getFirst().toString());
  Assert.assertEquals(testVars[1][1] + testVars[1][2],record.getSecond().toString());
  Assert.assertFalse("String_Node_Str",iterator.hasNext());
}

Fixed version (ground truth):
/** 
 * Test the main method of the SequenceFilesFromMailArchives command-line application.
 */
@Test public void testMain() throws Exception {
  String[] args={"String_Node_Str",inputDir.getAbsolutePath(),"String_Node_Str",outputDir.getAbsolutePath(),"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  SequenceFilesFromMailArchives.main(args);
  File expectedChunkFile=new File(outputDir,"String_Node_Str");
  String expectedChunkPath=expectedChunkFile.getAbsolutePath();
  Assert.assertTrue("String_Node_Str" + expectedChunkPath + "String_Node_Str",expectedChunkFile.isFile());
  Configuration conf=new Configuration();
  SequenceFileIterator<Text,Text> iterator=new SequenceFileIterator<Text,Text>(new Path(expectedChunkPath),true,conf);
  Assert.assertTrue("String_Node_Str",iterator.hasNext());
  Pair<Text,Text> record=iterator.next();
  File parentFile=new File(new File(new File("String_Node_Str"),"String_Node_Str"),"String_Node_Str");
  Assert.assertEquals(new File(parentFile,testVars[0][0]).toString(),record.getFirst().toString());
  Assert.assertEquals(testVars[0][1] + testVars[0][2],record.getSecond().toString());
  Assert.assertTrue("String_Node_Str",iterator.hasNext());
  record=iterator.next();
  Assert.assertEquals(new File(parentFile,testVars[1][0]).toString(),record.getFirst().toString());
  Assert.assertEquals(testVars[1][1] + testVars[1][2],record.getSecond().toString());
  Assert.assertFalse("String_Node_Str",iterator.hasNext());
}
Program: 61229
Project: 61229
Buggy source:
public double[][] getUHat(){
  return m_uHat;
}

Fixed version (ground truth):
public double[][] getUHat(){
  return uHat;
}
Program: 61230
Project: 61230
Buggy source:
public EigenSolverWrapper(double[][] bbt){
  super();
  int dim=bbt.length;
  EigenDecompositionImpl evd2=new EigenDecompositionImpl(new Array2DRowRealMatrix(bbt),0);
  m_eigenvalues=evd2.getRealEigenvalues();
  RealMatrix uHatrm=evd2.getV();
  m_uHat=new double[dim][];
  for (int i=0; i < dim; i++)   m_uHat[i]=uHatrm.getRow(i);
}

Fixed version (ground truth):
public EigenSolverWrapper(double[][] bbt){
  super();
  int dim=bbt.length;
  EigenDecompositionImpl evd2=new EigenDecompositionImpl(new Array2DRowRealMatrix(bbt),0);
  eigenvalues=evd2.getRealEigenvalues();
  RealMatrix uHatrm=evd2.getV();
  uHat=new double[dim][];
  for (int i=0; i < dim; i++)   uHat[i]=uHatrm.getRow(i);
}
Program: 61231
Project: 61231
Buggy source:
public double[] getEigenValues(){
  return m_eigenvalues;
}

Fixed version (ground truth):
public double[] getEigenValues(){
  return eigenvalues;
}
Program: 61234
Project: 61234
Buggy source:
/** 
 * Computes the AUC of points seen so far.  This can be moderately expensive since it requires that all points that have been retained be sorted.
 * @return The value of the Area Under the receiver operating Curve.
 */
public double auc(){
  Preconditions.checkArgument(hasScore,"String_Node_Str");
  scores[0].sort();
  scores[1].sort();
  double n0=scores[0].size();
  double n1=scores[1].size();
  if (n0 == 0 || n1 == 0) {
    return 0.5;
  }
  int i0=0;
  int i1=0;
  int rank=1;
  double rankSum=0;
  while (i0 < n0 && i1 < n1) {
    double v0=scores[0].get(i0);
    double v1=scores[1].get(i1);
    if (v0 < v1) {
      i0++;
      rank++;
    }
 else     if (v1 < v0) {
      i1++;
      rankSum+=rank;
      rank++;
    }
 else {
      double tieScore=v0;
      int k0=0;
      while (i0 < n0 && v0 == tieScore) {
        k0++;
        i0++;
        v0=scores[0].get(i0);
      }
      int k1=0;
      while (i1 < n1 && v1 == tieScore) {
        k1++;
        i1++;
        v1=scores[1].get(i1);
      }
      rankSum+=(rank + (k0 + k1 - 1) / 2.0) * k1;
      rank+=k0 + k1;
    }
  }
  if (i1 < n1) {
    rankSum+=(rank + (n1 - i1 - 1) / 2.0) * (n1 - i1);
    rank+=n1 - i1;
  }
  return (rankSum / n1 - (n1 + 1) / 2) / n0;
}

Fixed version (ground truth):
/** 
 * Computes the AUC of points seen so far.  This can be moderately expensive since it requires that all points that have been retained be sorted.
 * @return The value of the Area Under the receiver operating Curve.
 */
public double auc(){
  Preconditions.checkArgument(hasScore,"String_Node_Str");
  scores[0].sort();
  scores[1].sort();
  double n0=scores[0].size();
  double n1=scores[1].size();
  if (n0 == 0 || n1 == 0) {
    return 0.5;
  }
  int i0=0;
  int i1=0;
  int rank=1;
  double rankSum=0;
  while (i0 < n0 && i1 < n1) {
    double v0=scores[0].get(i0);
    double v1=scores[1].get(i1);
    if (v0 < v1) {
      i0++;
      rank++;
    }
 else     if (v1 < v0) {
      i1++;
      rankSum+=rank;
      rank++;
    }
 else {
      double tieScore=v0;
      int k0=0;
      while (i0 < n0 && scores[0].get(i0) == tieScore) {
        k0++;
        i0++;
      }
      int k1=0;
      while (i1 < n1 && scores[1].get(i1) == tieScore) {
        k1++;
        i1++;
      }
      rankSum+=(rank + (k0 + k1 - 1) / 2.0) * k1;
      rank+=k0 + k1;
    }
  }
  if (i1 < n1) {
    rankSum+=(rank + (n1 - i1 - 1) / 2.0) * (n1 - i1);
    rank+=n1 - i1;
  }
  return (rankSum / n1 - (n1 + 1) / 2) / n0;
}
Program: 61235
Project: 61235
Buggy source:
/** 
 * Sets the number of locations in the feature vector that a value should be in. This causes the cached probe locations to be recomputed.
 * @param probes Number of locations to increment.
 */
@Override public void setProbes(int probes){
  super.setProbes(probes);
  cacheProbeLocations(CONTINUOUS_VALUE_HASH_SEED);
}

Fixed version (ground truth):
/** 
 * Sets the number of locations in the feature vector that a value should be in. This causes the cached probe locations to be recomputed.
 * @param probes Number of locations to increment.
 */
@Override public void setProbes(int probes){
  super.setProbes(probes);
  cacheProbeLocations(getSeed());
}
Program: 61236
Project: 61236
Buggy source:
@Override protected double getWeight(byte[] originalForm,double w){
  return w * Double.parseDouble(new String(originalForm));
}

Fixed version (ground truth):
@Override protected double getWeight(byte[] originalForm,double w){
  if (originalForm != null) {
    return w * Double.parseDouble(new String(originalForm));
  }
 else {
    return w;
  }
}
Program: 61237
Project: 61237
Buggy source:
@Test public void testAddToVector(){
  FeatureVectorEncoder enc=new ContinuousValueEncoder("String_Node_Str");
  Vector v1=new DenseVector(20);
  enc.addToVector("String_Node_Str",v1);
  assertEquals(-123,v1.minValue(),0);
  assertEquals(0,v1.maxValue(),0);
  assertEquals(123,v1.norm(1),0);
  v1=new DenseVector(20);
  enc.addToVector("String_Node_Str",v1);
  assertEquals(123,v1.maxValue(),0);
  assertEquals(0,v1.minValue(),0);
  assertEquals(123,v1.norm(1),0);
  Vector v2=new DenseVector(20);
  enc.setProbes(2);
  enc.addToVector("String_Node_Str",v2);
  assertEquals(123,v2.maxValue(),0);
  assertEquals(2 * 123,v2.norm(1),0);
  v1=v2.minus(v1);
  assertEquals(123,v1.maxValue(),0);
  assertEquals(123,v1.norm(1),0);
  Vector v3=new DenseVector(20);
  enc.setProbes(2);
  enc.addToVector("String_Node_Str",v3);
  v1=v2.minus(v3);
  assertEquals(23,v1.maxValue(),0);
  assertEquals(2 * 23,v1.norm(1),0);
  enc.addToVector("String_Node_Str",v1);
  assertEquals(30,v1.maxValue(),0);
  assertEquals(2 * 30,v1.norm(1),0);
  assertEquals(30,v1.get(10),0);
  assertEquals(30,v1.get(18),0);
  try {
    enc.addToVector("String_Node_Str",v1);
    fail("String_Node_Str");
  }
 catch (  NumberFormatException e) {
    assertEquals("String_Node_Str",e.getMessage());
  }
}

Fixed version (ground truth):
@Test public void testAddToVector(){
  FeatureVectorEncoder enc=new ContinuousValueEncoder("String_Node_Str");
  Vector v1=new DenseVector(20);
  enc.addToVector("String_Node_Str",v1);
  assertEquals(-123,v1.minValue(),0);
  assertEquals(0,v1.maxValue(),0);
  assertEquals(123,v1.norm(1),0);
  v1=new DenseVector(20);
  enc.addToVector("String_Node_Str",v1);
  assertEquals(123,v1.maxValue(),0);
  assertEquals(0,v1.minValue(),0);
  assertEquals(123,v1.norm(1),0);
  Vector v2=new DenseVector(20);
  enc.setProbes(2);
  enc.addToVector("String_Node_Str",v2);
  assertEquals(123,v2.maxValue(),0);
  assertEquals(2 * 123,v2.norm(1),0);
  v1=v2.minus(v1);
  assertEquals(123,v1.maxValue(),0);
  assertEquals(123,v1.norm(1),0);
  Vector v3=new DenseVector(20);
  enc.setProbes(2);
  enc.addToVector("String_Node_Str",v3);
  v1=v2.minus(v3);
  assertEquals(23,v1.maxValue(),0);
  assertEquals(2 * 23,v1.norm(1),0);
  enc.addToVector("String_Node_Str",v1);
  assertEquals(30,v1.maxValue(),0);
  assertEquals(2 * 30,v1.norm(1),0);
  assertEquals(30,v1.get(10),0);
  assertEquals(30,v1.get(18),0);
  v2=new DenseVector(20);
  v3=new DenseVector(20);
  enc.setProbes(6);
  enc.addToVector("String_Node_Str",v2);
  enc.addToVector((byte[])null,145,v3);
  assertEquals(0,v2.minus(v3).norm(1),0);
  try {
    enc.addToVector("String_Node_Str",v1);
    fail("String_Node_Str");
  }
 catch (  NumberFormatException e) {
    assertEquals("String_Node_Str",e.getMessage());
  }
}
Program: 61238
Project: 61238
Buggy source:
public void setGramSize(int gramSize){
  set("String_Node_Str",Integer.toBinaryString(gramSize));
}

Fixed version (ground truth):
public void setGramSize(int gramSize){
  set("String_Node_Str",Integer.toString(gramSize));
}
Program: 61239
Project: 61239
Buggy source:
@Override protected void map(Text key,VectorWritable value,Context context) throws IOException, InterruptedException {
  if (!labelMap.containsKey(key.toString())) {
    context.getCounter("String_Node_Str","String_Node_Str");
    return;
  }
  int label=labelMap.get(key.toString());
  context.write(new IntWritable(label),value);
}

Fixed version (ground truth):
@Override protected void map(Text key,VectorWritable value,Context context) throws IOException, InterruptedException {
  if (!labelMap.containsKey(key.toString())) {
    context.getCounter("String_Node_Str","String_Node_Str").increment(1);
    return;
  }
  int label=labelMap.get(key.toString());
  context.write(new IntWritable(label),value);
}
Program: 61240
Project: 61240
Buggy source:
/** 
 * Write the list of labels into a map file
 * @param wordCountPath
 * @param dictionaryPathBase
 * @throws IOException
 */
public static Path createLabelMapFile(List<String> labels,Configuration conf,Path labelMapPathBase) throws IOException {
  FileSystem fs=FileSystem.get(labelMapPathBase.toUri(),conf);
  Path labelMapPath=new Path(labelMapPathBase,LABEL_MAP);
  SequenceFile.Writer dictWriter=new SequenceFile.Writer(fs,conf,labelMapPath,Text.class,IntWritable.class);
  int i=0;
  for (  String label : labels) {
    Writable key=new Text(label);
    dictWriter.append(key,new IntWritable(i++));
  }
  return labelMapPath;
}

Fixed version (ground truth):
/** 
 * Write the list of labels into a map file
 * @param wordCountPath
 * @param dictionaryPathBase
 * @throws IOException
 */
public static Path createLabelMapFile(List<String> labels,Configuration conf,Path labelMapPathBase) throws IOException {
  FileSystem fs=FileSystem.get(labelMapPathBase.toUri(),conf);
  Path labelMapPath=new Path(labelMapPathBase,LABEL_MAP);
  SequenceFile.Writer dictWriter=new SequenceFile.Writer(fs,conf,labelMapPath,Text.class,IntWritable.class);
  int i=0;
  for (  String label : labels) {
    Writable key=new Text(label);
    dictWriter.append(key,new IntWritable(i++));
  }
  dictWriter.close();
  return labelMapPath;
}
Program: 61241
Project: 61241
Buggy source:
@Override protected void cleanup(Context context) throws IOException, InterruptedException {
  context.write(new Text(BayesConstants.FEATURE_SUM),new VectorWritable(featureSum));
  context.write(new Text(BayesConstants.LABEL_SUM),new VectorWritable(labelSum));
  super.cleanup(context);
}

Fixed version (ground truth):
@Override protected void cleanup(Context context) throws IOException, InterruptedException {
  if (featureSum != null) {
    context.write(new Text(BayesConstants.FEATURE_SUM),new VectorWritable(featureSum));
    context.write(new Text(BayesConstants.LABEL_SUM),new VectorWritable(labelSum));
  }
  super.cleanup(context);
}
Program: 61244
Project: 61244
Buggy source:
public double addSample(int category,double score){
  int n=(int)samples.get(category);
  if (n < HISTORY) {
    scores.set(category,n,score);
  }
 else {
switch (policy) {
case FIFO:
      scores.set(category,n % HISTORY,score);
    break;
case FAIR:
  int j1=random.nextInt(n + 1);
if (j1 < HISTORY) {
  scores.set(category,j1,score);
}
break;
case RANDOM:
int j2=random.nextInt(HISTORY);
scores.set(category,j2,score);
break;
}
}
samples.set(category,n + 1);
if (samples.minValue() >= 1) {
Vector row=scores.viewRow(1 - category);
double m=0.0;
double count=0.0;
for (Vector.Element element : row) {
double v=element.get();
if (Double.isNaN(v)) {
continue;
}
count++;
if (score > v) {
m++;
}
 else if (score < v) {
}
 else if (score == v) {
m+=0.5;
}
}
averages.set(category,averages.get(category) + (m / count - averages.get(category)) / samples.get(category));
}
return auc();
}

Fixed version (ground truth):
public double addSample(int category,double score){
  int n=(int)samples.get(category);
  if (n < HISTORY) {
    scores.set(category,n,score);
  }
 else {
switch (policy) {
case FIFO:
      scores.set(category,n % HISTORY,score);
    break;
case FAIR:
  int j1=random.nextInt(n + 1);
if (j1 < HISTORY) {
  scores.set(category,j1,score);
}
break;
case RANDOM:
int j2=random.nextInt(HISTORY);
scores.set(category,j2,score);
break;
}
}
samples.set(category,n + 1);
if (samples.minValue() >= 1) {
Vector row=scores.viewRow(1 - category);
double m=0.0;
double count=0.0;
for (Vector.Element element : row) {
double v=element.get();
if (Double.isNaN(v)) {
continue;
}
count++;
if (score > v) {
m++;
}
 else if (score < v) {
}
 else if (score == v) {
m+=0.5;
}
}
averages.set(category,averages.get(category) + (m / count - averages.get(category)) / Math.min(windowSize,samples.get(category)));
}
return auc();
}
Program: 61246
Project: 61246
Buggy source:
private void setStDev(int cI){
  List<VectorWritable> repPts=representativePoints.get(cI);
  int s0=0;
  Vector s1=null;
  Vector s2=null;
  for (  VectorWritable vw : repPts) {
    s0++;
    Vector v=vw.get();
    s1=s1 == null ? v.clone() : s1.plus(v);
    s2=s2 == null ? v.times(v) : s2.plus(v.times(v));
  }
  Vector std=s2.times(s0).minus(s1.times(s1)).assign(new SquareRootFunction()).divide(s0);
  double d=std.zSum() / std.size();
  stDevs.put(cI,d);
}

Fixed version (ground truth):
private void setStDev(int cI){
  List<VectorWritable> repPts=representativePoints.get(cI);
  int s0=0;
  Vector s1=null;
  Vector s2=null;
  for (  VectorWritable vw : repPts) {
    s0++;
    Vector v=vw.get();
    s1=s1 == null ? v.clone() : s1.plus(v);
    s2=s2 == null ? v.times(v) : s2.plus(v.times(v));
  }
  if (s0 > 1) {
    Vector std=s2.times(s0).minus(s1.times(s1)).assign(new SquareRootFunction()).divide(s0);
    double d=std.zSum() / std.size();
    stDevs.put(cI,d);
  }
}
Program: 61247
Project: 61247
Buggy source:
public double interClusterDensity(){
  double sum=0.0;
  for (  Map.Entry<Integer,List<VectorWritable>> entry1 : representativePoints.entrySet()) {
    Integer cI=entry1.getKey();
    List<VectorWritable> repI=entry1.getValue();
    double stDevI=stDevs.get(cI);
    for (    Map.Entry<Integer,List<VectorWritable>> entry2 : representativePoints.entrySet()) {
      Integer cJ=entry2.getKey();
      if (cI.equals(cJ)) {
        continue;
      }
      List<VectorWritable> repJ=entry2.getValue();
      double minDistance=Double.MAX_VALUE;
      Vector uIJ=null;
      for (      VectorWritable aRepI : repI) {
        for (        VectorWritable aRepJ : repJ) {
          Vector vI=aRepI.get();
          Vector vJ=aRepJ.get();
          double distance=measure.distance(vI,vJ);
          if (distance < minDistance) {
            minDistance=distance;
            uIJ=vI.plus(vJ).divide(2);
          }
        }
      }
      double stDevJ=stDevs.get(cJ);
      double interDensity=interDensity(uIJ,cI,cJ);
      double stdSum=stDevI + stDevJ;
      double density=0.0;
      if (stdSum > 0.0) {
        density=minDistance * interDensity / stdSum;
      }
      sum+=density;
    }
  }
  return sum;
}

Fixed version (ground truth):
public double interClusterDensity(){
  double sum=0.0;
  for (  Map.Entry<Integer,List<VectorWritable>> entry1 : representativePoints.entrySet()) {
    Integer cI=entry1.getKey();
    List<VectorWritable> repI=entry1.getValue();
    double stDevI=getStdev(cI);
    for (    Map.Entry<Integer,List<VectorWritable>> entry2 : representativePoints.entrySet()) {
      Integer cJ=entry2.getKey();
      if (cI.equals(cJ)) {
        continue;
      }
      List<VectorWritable> repJ=entry2.getValue();
      double minDistance=Double.MAX_VALUE;
      Vector uIJ=null;
      for (      VectorWritable aRepI : repI) {
        for (        VectorWritable aRepJ : repJ) {
          Vector vI=aRepI.get();
          Vector vJ=aRepJ.get();
          double distance=measure.distance(vI,vJ);
          if (distance < minDistance) {
            minDistance=distance;
            uIJ=vI.plus(vJ).divide(2);
          }
        }
      }
      double stDevJ=getStdev(cJ);
      double interDensity=uIJ == null ? 0 : interDensity(uIJ,cI,cJ);
      double stdSum=stDevI + stDevJ;
      double density=0.0;
      if (stdSum > 0.0) {
        density=minDistance * interDensity / stdSum;
      }
      log.debug("String_Node_Str" + cI + "String_Node_Str"+ cJ+ "String_Node_Str"+ minDistance);
      log.debug("String_Node_Str" + cI + "String_Node_Str"+ stDevI);
      log.debug("String_Node_Str" + cJ + "String_Node_Str"+ stDevJ);
      log.debug("String_Node_Str" + cI + "String_Node_Str"+ cJ+ "String_Node_Str"+ interDensity);
      log.debug("String_Node_Str" + cI + "String_Node_Str"+ cJ+ "String_Node_Str"+ density);
      sum+=density;
    }
  }
  return sum;
}
Program: 61248
Project: 61248
Buggy source:
public double intraClusterDensity(){
  double avgStd=0.0;
  for (  Integer cId : representativePoints.keySet()) {
    avgStd+=stDevs.get(cId);
  }
  avgStd/=representativePoints.size();
  double sum=0.0;
  for (  Map.Entry<Integer,List<VectorWritable>> entry : representativePoints.entrySet()) {
    Integer cId=entry.getKey();
    List<VectorWritable> repI=entry.getValue();
    double cSum=0.0;
    for (    VectorWritable aRepI : repI) {
      double inDensity=intraDensity(clusters.get(cId).getCenter(),aRepI.get(),avgStd);
      double std=stDevs.get(cId);
      if (std > 0.0) {
        cSum+=inDensity / std;
      }
    }
    sum+=cSum / repI.size();
  }
  return sum / representativePoints.size();
}

Fixed version (ground truth):
public double intraClusterDensity(){
  double avgStd=0.0;
  for (  Integer cId : representativePoints.keySet()) {
    avgStd+=getStdev(cId);
  }
  avgStd/=representativePoints.size();
  double sum=0.0;
  for (  Map.Entry<Integer,List<VectorWritable>> entry : representativePoints.entrySet()) {
    Integer cId=entry.getKey();
    List<VectorWritable> repI=entry.getValue();
    double cSum=0.0;
    for (    VectorWritable aRepI : repI) {
      double inDensity=intraDensity(clusters.get(cId).getCenter(),aRepI.get(),avgStd);
      double std=getStdev(cId);
      if (std > 0.0) {
        cSum+=inDensity / std;
      }
    }
    if (repI.size() > 0) {
      sum+=cSum / repI.size();
    }
  }
  return sum / representativePoints.size();
}
Program: 61249
Project: 61249
Buggy source:
double interDensity(Vector uIJ,int cI,int cJ){
  List<VectorWritable> repI=representativePoints.get(cI);
  List<VectorWritable> repJ=representativePoints.get(cJ);
  double density=0.0;
  double std=(stDevs.get(cI) + stDevs.get(cJ)) / 2.0;
  for (  VectorWritable vwI : repI) {
    if (measure.distance(uIJ,vwI.get()) <= std) {
      density++;
    }
  }
  for (  VectorWritable vwJ : repJ) {
    if (measure.distance(uIJ,vwJ.get()) <= std) {
      density++;
    }
  }
  return density / (repI.size() + repJ.size());
}

Fixed version (ground truth):
double interDensity(Vector uIJ,int cI,int cJ){
  List<VectorWritable> repI=representativePoints.get(cI);
  List<VectorWritable> repJ=representativePoints.get(cJ);
  double density=0.0;
  double std=(getStdev(cI) + getStdev(cJ)) / 2.0;
  for (  VectorWritable vwI : repI) {
    if (measure.distance(uIJ,vwI.get()) <= std) {
      density++;
    }
  }
  for (  VectorWritable vwJ : repJ) {
    if (measure.distance(uIJ,vwJ.get()) <= std) {
      density++;
    }
  }
  return density / (repI.size() + repJ.size());
}
Program: 61250
Project: 61250
Buggy source:
@Override protected void cleanup(Context context) throws IOException, InterruptedException {
  for (  Map.Entry<Integer,List<VectorWritable>> entry : referencePoints.entrySet()) {
    IntWritable iw=new IntWritable(entry.getKey());
    for (    VectorWritable vw : entry.getValue()) {
      context.write(iw,vw);
    }
  }
  super.cleanup(context);
}

Fixed version (ground truth):
@Override protected void cleanup(Context context) throws IOException, InterruptedException {
  for (  Map.Entry<Integer,List<VectorWritable>> entry : representativePoints.entrySet()) {
    IntWritable iw=new IntWritable(entry.getKey());
    for (    VectorWritable vw : entry.getValue()) {
      context.write(iw,vw);
    }
  }
  super.cleanup(context);
}
Program: 61251
Project: 61251
Buggy source:
@Override protected void setup(Context context) throws IOException, InterruptedException {
  super.setup(context);
  Configuration conf=context.getConfiguration();
  try {
    referencePoints=CDbwMapper.getRepresentativePoints(conf);
  }
 catch (  NumberFormatException e) {
    throw new IllegalStateException(e);
  }
catch (  SecurityException e) {
    throw new IllegalStateException(e);
  }
catch (  IllegalArgumentException e) {
    throw new IllegalStateException(e);
  }
}

Fixed version (ground truth):
@Override protected void setup(Context context) throws IOException, InterruptedException {
  super.setup(context);
  Configuration conf=context.getConfiguration();
  try {
    representativePoints=CDbwMapper.getRepresentativePoints(conf);
  }
 catch (  NumberFormatException e) {
    throw new IllegalStateException(e);
  }
catch (  SecurityException e) {
    throw new IllegalStateException(e);
  }
catch (  IllegalArgumentException e) {
    throw new IllegalStateException(e);
  }
}
Program: 61252
Project: 61252
Buggy source:
public void configure(Map<Integer,List<VectorWritable>> referencePoints){
  this.referencePoints=referencePoints;
}

Fixed version (ground truth):
public void configure(Map<Integer,List<VectorWritable>> representativePoints){
  this.representativePoints=representativePoints;
}
Program: 61253
Project: 61253
Buggy source:
/** 
 * Initialize synthetic data using 4 clusters dC units from origin having 4 representative points dP from each center
 * @param dC a double cluster center offset
 * @param dP a double representative point offset
 * @param measure TODO
 */
private void initData(double dC,double dP,DistanceMeasure measure){
  clusters=new HashMap<Integer,Cluster>();
  clusters.put(1,new Canopy(new DenseVector(new double[]{-dC,-dC}),1,measure));
  clusters.put(3,new Canopy(new DenseVector(new double[]{-dC,dC}),3,measure));
  clusters.put(5,new Canopy(new DenseVector(new double[]{dC,dC}),5,measure));
  clusters.put(7,new Canopy(new DenseVector(new double[]{dC,-dC}),7,measure));
  representativePoints=new HashMap<Integer,List<VectorWritable>>();
  for (  Cluster cluster : clusters.values()) {
    List<VectorWritable> points=new ArrayList<VectorWritable>();
    representativePoints.put(cluster.getId(),points);
    points.add(new VectorWritable(cluster.getCenter().clone()));
    points.add(new VectorWritable(cluster.getCenter().plus(new DenseVector(new double[]{dP,dP}))));
    points.add(new VectorWritable(cluster.getCenter().plus(new DenseVector(new double[]{dP,-dP}))));
    points.add(new VectorWritable(cluster.getCenter().plus(new DenseVector(new double[]{-dP,-dP}))));
    points.add(new VectorWritable(cluster.getCenter().plus(new DenseVector(new double[]{-dP,dP}))));
  }
}

Fixed version (ground truth):
/** 
 * Initialize synthetic data using 4 clusters dC units from origin having 4 representative points dP from each center
 * @param dC a double cluster center offset
 * @param dP a double representative point offset
 * @param measure the DistanceMeasure
 */
private void initData(double dC,double dP,DistanceMeasure measure){
  clusters=new HashMap<Integer,Cluster>();
  clusters.put(1,new Canopy(new DenseVector(new double[]{-dC,-dC}),1,measure));
  clusters.put(3,new Canopy(new DenseVector(new double[]{-dC,dC}),3,measure));
  clusters.put(5,new Canopy(new DenseVector(new double[]{dC,dC}),5,measure));
  clusters.put(7,new Canopy(new DenseVector(new double[]{dC,-dC}),7,measure));
  representativePoints=new HashMap<Integer,List<VectorWritable>>();
  for (  Cluster cluster : clusters.values()) {
    List<VectorWritable> points=new ArrayList<VectorWritable>();
    representativePoints.put(cluster.getId(),points);
    points.add(new VectorWritable(cluster.getCenter().clone()));
    points.add(new VectorWritable(cluster.getCenter().plus(new DenseVector(new double[]{dP,dP}))));
    points.add(new VectorWritable(cluster.getCenter().plus(new DenseVector(new double[]{dP,-dP}))));
    points.add(new VectorWritable(cluster.getCenter().plus(new DenseVector(new double[]{-dP,-dP}))));
    points.add(new VectorWritable(cluster.getCenter().plus(new DenseVector(new double[]{-dP,dP}))));
  }
}
Program: 61254
Project: 61254
Buggy source:
public static void runLoad(Recommender recommender) throws TasteException {
  DataModel dataModel=recommender.getDataModel();
  int numUsers=dataModel.getNumUsers();
  double sampleRate=1000.0 / numUsers;
  LongPrimitiveIterator userSampler=SamplingLongPrimitiveIterator.maybeWrapIterator(dataModel.getUserIDs(),sampleRate);
  recommender.recommend(userSampler.next(),10);
  Collection<Callable<Void>> callables=new ArrayList<Callable<Void>>();
  while (userSampler.hasNext()) {
    callables.add(new LoadCallable(recommender,userSampler.next()));
  }
  AbstractDifferenceRecommenderEvaluator.execute(callables);
}

Fixed version (ground truth):
public static void runLoad(Recommender recommender) throws TasteException {
  DataModel dataModel=recommender.getDataModel();
  int numUsers=dataModel.getNumUsers();
  double sampleRate=1000.0 / numUsers;
  LongPrimitiveIterator userSampler=SamplingLongPrimitiveIterator.maybeWrapIterator(dataModel.getUserIDs(),sampleRate);
  recommender.recommend(userSampler.next(),10);
  Collection<Callable<Void>> callables=new ArrayList<Callable<Void>>();
  while (userSampler.hasNext()) {
    callables.add(new LoadCallable(recommender,userSampler.next()));
  }
  AbstractDifferenceRecommenderEvaluator.execute(callables,new AtomicInteger());
}
Program: 61255
Project: 61255
Buggy source:
private NonZeroIterator(){
  it=vector.iterator();
  buffer();
}

Fixed version (ground truth):
private NonZeroIterator(){
  it=vector.iterateNonZero();
  buffer();
}