nus-yam/ex-repair huggingface dataset:
Program: 8581
Project: 8581
Buggy source:
@Override public void map(final NullWritable key,final FaunusVertex value,final Mapper<NullWritable,FaunusVertex,NullWritable,FaunusVertex>.Context context) throws IOException, InterruptedException {
  if (this.isVertex) {
    if (value.hasPaths()) {
      for (int i=0; i < value.pathCount(); i++) {
        this.closure.call(value);
      }
      context.getCounter(Counters.VERTICES_PROCESSED).increment(1);
    }
  }
 else {
    long edgesProcessed=0;
    for (    final Edge e : value.getEdges(Direction.OUT)) {
      final FaunusEdge edge=(FaunusEdge)e;
      if (edge.hasPaths()) {
        edgesProcessed++;
        for (int i=0; i < edge.pathCount(); i++) {
          this.closure.call(edge);
        }
      }
    }
    context.getCounter(Counters.OUT_EDGES_PROCESSED).increment(edgesProcessed);
  }
  context.write(NullWritable.get(),value);
}

Fixed version (ground truth):
@Override public void map(final NullWritable key,final FaunusVertex value,final Mapper<NullWritable,FaunusVertex,NullWritable,FaunusVertex>.Context context) throws IOException, InterruptedException {
  if (this.isVertex) {
    if (value.hasPaths()) {
      this.closure.call(value);
      context.getCounter(Counters.VERTICES_PROCESSED).increment(1);
    }
  }
 else {
    long edgesProcessed=0;
    for (    final Edge e : value.getEdges(Direction.OUT)) {
      final FaunusEdge edge=(FaunusEdge)e;
      if (edge.hasPaths()) {
        edgesProcessed++;
        this.closure.call(edge);
      }
    }
    context.getCounter(Counters.OUT_EDGES_PROCESSED).increment(edgesProcessed);
  }
  context.write(NullWritable.get(),value);
}
Program: 8582
Project: 8582
Buggy source:
public void setInputLocation(final Path path){
  this.configuration.set(INPUT_LOCATION,path.toString());
}

Fixed version (ground truth):
public void setInputLocation(final String path){
  this.setInputLocation(new Path(path));
}
Program: 8583
Project: 8583
Buggy source:
public void setOutputLocation(final Path path){
  this.configuration.set(OUTPUT_LOCATION,path.toString());
}

Fixed version (ground truth):
public void setOutputLocation(final String path){
  this.setOutputLocation(new Path(path));
}
Program: 8585
Project: 8585
Buggy source:
@Override public void map(final NullWritable key,final FaunusVertex value,final Mapper<NullWritable,FaunusVertex,Text,LongWritable>.Context context) throws IOException, InterruptedException {
  if (this.isVertex) {
    if (value.hasPaths()) {
      final Object object=(null == this.keyClosure) ? value : this.keyClosure.call(value);
      final Number number=(null == this.valueClosure) ? 1 : (Number)this.valueClosure.call(value);
      this.map.incr(object,number.longValue() * value.pathCount());
      context.getCounter(Counters.VERTICES_PROCESSED).increment(1l);
    }
  }
 else {
    long edgesProcessed=0;
    for (    final Edge e : value.getEdges(Direction.OUT)) {
      final FaunusEdge edge=(FaunusEdge)e;
      if (edge.hasPaths()) {
        final Object object=(null == this.keyClosure) ? edge : this.keyClosure.call(edge);
        final Number number=(null == this.valueClosure) ? 1 : (Number)this.valueClosure.call(edge);
        this.map.incr(object,number.longValue() * edge.pathCount());
        edgesProcessed++;
      }
    }
    context.getCounter(Counters.OUT_EDGES_PROCESSED).increment(edgesProcessed);
  }
  if (this.map.size() > 1000) {
    this.cleanup(context);
  }
  this.outputs.write(Tokens.GRAPH,NullWritable.get(),value);
}

Fixed version (ground truth):
@Override public void map(final NullWritable key,final FaunusVertex value,final Mapper<NullWritable,FaunusVertex,Text,LongWritable>.Context context) throws IOException, InterruptedException {
  if (this.isVertex) {
    if (value.hasPaths()) {
      final Object object=(null == this.keyClosure) ? new MicroVertex(value.getIdAsLong()) : this.keyClosure.call(value);
      final Number number=(null == this.valueClosure) ? 1 : (Number)this.valueClosure.call(value);
      this.map.incr(object,number.longValue() * value.pathCount());
      context.getCounter(Counters.VERTICES_PROCESSED).increment(1l);
    }
  }
 else {
    long edgesProcessed=0;
    for (    final Edge e : value.getEdges(Direction.OUT)) {
      final FaunusEdge edge=(FaunusEdge)e;
      if (edge.hasPaths()) {
        final Object object=(null == this.keyClosure) ? new MicroEdge(edge.getIdAsLong()) : this.keyClosure.call(edge);
        final Number number=(null == this.valueClosure) ? 1 : (Number)this.valueClosure.call(edge);
        this.map.incr(object,number.longValue() * edge.pathCount());
        edgesProcessed++;
      }
    }
    context.getCounter(Counters.OUT_EDGES_PROCESSED).increment(edgesProcessed);
  }
  if (this.map.size() > 1000) {
    this.cleanup(context);
  }
  this.outputs.write(Tokens.GRAPH,NullWritable.get(),value);
}
Program: 8586
Project: 8586
Buggy source:
/** 
 * Restart from survivable exceptions by creating a new scanner.
 * @param firstRow  The first row to start at.
 * @throws IOException When restarting fails.
 */
public void restart(byte[] firstRow) throws IOException {
  Scan newScan=new Scan(scan);
  newScan.setStartRow(firstRow);
  this.scanner=this.htable.getScanner(newScan);
}

Fixed version (ground truth):
/** 
 * Restart from survivable exceptions by creating a new scanner.
 * @param firstRow The first row to start at.
 * @throws IOException When restarting fails.
 */
public void restart(byte[] firstRow) throws IOException {
  Scan newScan=new Scan(scan);
  newScan.setStartRow(firstRow);
  this.scanner=this.htable.getScanner(newScan);
}
Program: 8587
Project: 8587
Buggy source:
/** 
 * Positions the record reader to the next record.
 * @return <code>true</code> if there was another record.
 * @throws IOException When reading the record failed.
 * @throws InterruptedException When the job was aborted.
 */
public boolean nextKeyValue() throws IOException, InterruptedException {
  Result result=null;
  while (true) {
    try {
      result=this.scanner.next();
    }
 catch (    IOException e) {
      logger.debug("String_Node_Str" + StringUtils.stringifyException(e));
      if (lastRow == null) {
        logger.warn("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
        lastRow=scan.getStartRow();
      }
      restart(lastRow);
      scanner.next();
      result=scanner.next();
    }
    if (result != null && result.size() > 0) {
      lastRow=result.getRow();
      final NavigableMap<byte[],NavigableMap<Long,byte[]>> rowMap=result.getMap().get(TitanHBaseInputFormat.EDGE_STORE_FAMILY);
      if (rowMap != null) {
        currentVertex=graph.readFaunusVertex(lastRow,rowMap);
        if (this.pathEnabled)         currentVertex.enablePath(true);
        if (null != currentVertex)         return true;
      }
    }
 else {
      return false;
    }
  }
}

Fixed version (ground truth):
/** 
 * Positions the record reader to the next record.
 * @return <code>true</code> if there was another record.
 * @throws IOException          When reading the record failed.
 * @throws InterruptedException When the job was aborted.
 */
public boolean nextKeyValue() throws IOException, InterruptedException {
  Result result=null;
  while (true) {
    try {
      result=this.scanner.next();
    }
 catch (    IOException e) {
      logger.debug("String_Node_Str" + StringUtils.stringifyException(e));
      if (lastRow == null) {
        logger.warn("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
        lastRow=scan.getStartRow();
      }
      restart(lastRow);
      scanner.next();
      result=scanner.next();
    }
    if (result != null && result.size() > 0) {
      lastRow=result.getRow();
      final NavigableMap<byte[],NavigableMap<Long,byte[]>> rowMap=result.getMap().get(TitanHBaseInputFormat.EDGE_STORE_FAMILY);
      if (rowMap != null) {
        currentVertex=graph.readFaunusVertex(lastRow,rowMap);
        if (null != currentVertex) {
          if (this.pathEnabled)           currentVertex.enablePath(true);
          return true;
        }
      }
    }
 else {
      return false;
    }
  }
}
Program: 8588
Project: 8588
Buggy source:
/** 
 * Returns the current value.
 * @return The current value.
 * @throws IOException When the value is faulty.
 * @throws InterruptedException When the job is aborted.
 */
public FaunusVertex getCurrentValue() throws IOException, InterruptedException {
  return currentVertex;
}

Fixed version (ground truth):
/** 
 * Returns the current value.
 * @return The current value.
 * @throws IOException          When the value is faulty.
 * @throws InterruptedException When the job is aborted.
 */
public FaunusVertex getCurrentValue() throws IOException, InterruptedException {
  return currentVertex;
}
Program: 8589
Project: 8589
Buggy source:
@Override public void reduce(final LongWritable key,final Iterable<Holder> values,final Reducer<LongWritable,Holder,NullWritable,FaunusVertex>.Context context) throws IOException, InterruptedException {
  final FaunusVertex vertex=new FaunusVertex(key.get());
  for (  final Holder holder : values) {
    if (holder.getTag() == 'v') {
      vertex.addAll((FaunusVertex)holder.get());
    }
 else {
      vertex.getPaths(holder.get(),true);
    }
  }
  context.write(NullWritable.get(),vertex);
}

Fixed version (ground truth):
@Override public void reduce(final LongWritable key,final Iterable<Holder> values,final Reducer<LongWritable,Holder,NullWritable,FaunusVertex>.Context context) throws IOException, InterruptedException {
  final FaunusVertex vertex=new FaunusVertex(key.get());
  vertex.enablePath(true);
  for (  final Holder holder : values) {
    if (holder.getTag() == 'v') {
      vertex.addAll((FaunusVertex)holder.get());
    }
 else {
      vertex.getPaths(holder.get(),true);
    }
  }
  context.write(NullWritable.get(),vertex);
}
Program: 8590
Project: 8590
Buggy source:
private static void writeEdges(final Vertex vertex,final Direction direction,final DataOutput out) throws IOException {
  final CounterMap<String> map=new CounterMap<String>();
  for (  final Edge edge : vertex.getEdges(direction)) {
    map.incr(edge.getLabel(),1);
  }
  out.writeShort(map.size());
  for (  final Map.Entry<String,Long> entry : map.entrySet()) {
    out.writeUTF(entry.getKey());
    out.writeInt(entry.getValue().intValue());
    for (    final Edge edge : vertex.getEdges(direction,entry.getKey())) {
      writeId(edge.getId(),out);
      out.writeBoolean(false);
      out.writeLong(0);
      writeId(edge.getVertex(direction.opposite()).getId(),out);
      writeProperties(edge,out);
    }
  }
}

Fixed version (ground truth):
private static void writeEdges(final Vertex vertex,final Direction direction,final DataOutput out) throws IOException {
  final CounterMap<String> map=new CounterMap<String>();
  for (  final Edge edge : vertex.getEdges(direction)) {
    map.incr(edge.getLabel(),1);
  }
  out.writeShort(map.size());
  for (  final Map.Entry<String,Long> entry : map.entrySet()) {
    out.writeUTF(entry.getKey());
    out.writeInt(entry.getValue().intValue());
    for (    final Edge edge : vertex.getEdges(direction,entry.getKey())) {
      writeId(edge.getId(),out);
      out.writeBoolean(false);
      out.writeLong(0);
      writeProperties(edge,out);
      writeId(edge.getVertex(direction.opposite()).getId(),out);
    }
  }
}
Program: 8591
Project: 8591
Buggy source:
public static void write(final Vertex vertex,final DataOutput out) throws IOException {
  writeId(vertex.getId(),out);
  out.writeBoolean(false);
  out.writeLong(0);
  writeEdges(vertex,Direction.IN,out);
  writeEdges(vertex,Direction.OUT,out);
  writeProperties(vertex,out);
}

Fixed version (ground truth):
public static void write(final Vertex vertex,final DataOutput out) throws IOException {
  writeId(vertex.getId(),out);
  out.writeBoolean(false);
  out.writeLong(0);
  writeProperties(vertex,out);
  writeEdges(vertex,Direction.IN,out);
  writeEdges(vertex,Direction.OUT,out);
}
Program: 8593
Project: 8593
Buggy source:
public void testVerticesFullStart() throws IOException {
  Configuration config=new Configuration();
  config.setClass(BackFilterMapReduce.CLASS,Vertex.class,Element.class);
  config.setInt(BackFilterMapReduce.STEP,0);
  mapReduceDriver.withConfiguration(config);
  Map<Long,FaunusVertex> results=runWithGraph(startPath(generateGraph(BaseTest.ExampleGraph.TINKERGRAPH),Vertex.class,true),mapReduceDriver);
  assertEquals(results.size(),6);
  assertEquals(results.get(1l).pathCount(),1);
  assertEquals(results.get(2l).pathCount(),1);
  assertEquals(results.get(3l).pathCount(),1);
  assertEquals(results.get(4l).pathCount(),1);
  assertEquals(results.get(5l).pathCount(),1);
  assertEquals(results.get(6l).pathCount(),1);
  assertEquals(mapReduceDriver.getCounters().findCounter(FilterMap.Counters.VERTICES_FILTERED).getValue(),0);
  assertEquals(mapReduceDriver.getCounters().findCounter(FilterMap.Counters.EDGES_FILTERED).getValue(),0);
  identicalStructure(results,ExampleGraph.TINKERGRAPH);
}

Fixed version (ground truth):
public void testVerticesFullStart() throws IOException {
  Configuration config=new Configuration();
  config.setClass(BackFilterMapReduce.CLASS,Vertex.class,Element.class);
  config.setInt(BackFilterMapReduce.STEP,0);
  config.setBoolean(FaunusCompiler.PATH_ENABLED,true);
  mapReduceDriver.withConfiguration(config);
  Map<Long,FaunusVertex> results=runWithGraph(startPath(generateGraph(BaseTest.ExampleGraph.TINKERGRAPH),Vertex.class,true),mapReduceDriver);
  assertEquals(results.size(),6);
  assertEquals(results.get(1l).pathCount(),1);
  assertEquals(results.get(2l).pathCount(),1);
  assertEquals(results.get(3l).pathCount(),1);
  assertEquals(results.get(4l).pathCount(),1);
  assertEquals(results.get(5l).pathCount(),1);
  assertEquals(results.get(6l).pathCount(),1);
  assertEquals(mapReduceDriver.getCounters().findCounter(FilterMap.Counters.VERTICES_FILTERED).getValue(),0);
  assertEquals(mapReduceDriver.getCounters().findCounter(FilterMap.Counters.EDGES_FILTERED).getValue(),0);
  identicalStructure(results,ExampleGraph.TINKERGRAPH);
}
Program: 8594
Project: 8594
Buggy source:
public void testKnowsCreatedTraversal2() throws IOException {
  Configuration config=new Configuration();
  config.set(VerticesVerticesMapReduce.DIRECTION,Direction.OUT.name());
  config.setStrings(VerticesVerticesMapReduce.LABELS,"String_Node_Str");
  mapReduceDriver.withConfiguration(config);
  Map<Long,FaunusVertex> results=runWithGraph(startPath(generateGraph(ExampleGraph.TINKERGRAPH),Vertex.class,true),mapReduceDriver);
  assertEquals(results.size(),6);
  assertEquals(results.get(1l).pathCount(),0);
  assertEquals(results.get(2l).pathCount(),0);
  assertEquals(results.get(3l).pathCount(),3);
  assertEquals(results.get(4l).pathCount(),0);
  assertEquals(results.get(5l).pathCount(),1);
  assertEquals(results.get(6l).pathCount(),0);
}

Fixed version (ground truth):
public void testKnowsCreatedTraversal2() throws IOException {
  Configuration config=new Configuration();
  config.set(VerticesVerticesMapReduce.DIRECTION,Direction.OUT.name());
  config.setStrings(VerticesVerticesMapReduce.LABELS,"String_Node_Str");
  config.setBoolean(FaunusCompiler.PATH_ENABLED,false);
  mapReduceDriver.withConfiguration(config);
  Map<Long,FaunusVertex> results=runWithGraph(startPath(generateGraph(ExampleGraph.TINKERGRAPH),Vertex.class),mapReduceDriver);
  assertEquals(results.size(),6);
  assertEquals(results.get(1l).pathCount(),0);
  assertEquals(results.get(2l).pathCount(),0);
  assertEquals(results.get(3l).pathCount(),3);
  assertEquals(results.get(4l).pathCount(),0);
  assertEquals(results.get(5l).pathCount(),1);
  assertEquals(results.get(6l).pathCount(),0);
}
Program: 8596
Project: 8596
Buggy source:
public void completeSequence() throws IOException {
  if (this.mapSequenceClasses.size() > 0) {
    this.mapSequenceConfiguration.setStrings(MapSequence.MAP_CLASSES,toStringMapSequenceClasses());
    final Job job=new Job(this.mapSequenceConfiguration,this.toStringOfJob(MapSequence.class));
    job.setJarByClass(FaunusCompiler.class);
    job.setMapperClass(MapSequence.Map.class);
    if (this.reduceClass != null)     job.setReducerClass(this.reduceClass);
    if (this.combinerClass != null)     job.setCombinerClass(this.combinerClass);
    job.setMapOutputKeyClass(this.mapOutputKey);
    job.setMapOutputValueClass(this.mapOutputValue);
    job.setOutputKeyClass(this.outputKey);
    job.setOutputValueClass(this.outputValue);
    if (null != this.comparator)     job.setSortComparatorClass(this.comparator);
    if (!(this.outputKey.equals(NullWritable.class) && this.outputValue.equals(FaunusVertex.class)))     this.derivationJob=false;
    this.jobs.add(job);
    this.mapSequenceConfiguration.clear();
    this.mapSequenceClasses.clear();
    this.combinerClass=null;
    this.reduceClass=null;
    this.comparator=null;
  }
}

Fixed version (ground truth):
public void completeSequence() throws IOException {
  if (this.mapSequenceClasses.size() > 0) {
    this.mapSequenceConfiguration.setStrings(MapSequence.MAP_CLASSES,toStringMapSequenceClasses());
    final Job job=new Job(this.mapSequenceConfiguration,this.toStringOfJob(MapSequence.class));
    job.setJarByClass(FaunusCompiler.class);
    job.setMapperClass(MapSequence.Map.class);
    if (this.reduceClass != null) {
      job.setReducerClass(this.reduceClass);
      if (this.combinerClass != null)       job.setCombinerClass(this.combinerClass);
    }
 else {
      job.setNumReduceTasks(0);
    }
    job.setMapOutputKeyClass(this.mapOutputKey);
    job.setMapOutputValueClass(this.mapOutputValue);
    job.setOutputKeyClass(this.outputKey);
    job.setOutputValueClass(this.outputValue);
    if (null != this.comparator)     job.setSortComparatorClass(this.comparator);
    if (!(this.outputKey.equals(NullWritable.class) && this.outputValue.equals(FaunusVertex.class)))     this.derivationJob=false;
    this.jobs.add(job);
    this.mapSequenceConfiguration.clear();
    this.mapSequenceClasses.clear();
    this.combinerClass=null;
    this.reduceClass=null;
    this.comparator=null;
  }
}
Program: 8597
Project: 8597
Buggy source:
public void verticesEdgesMapReduce(final Direction direction,final String... labels) throws IOException {
  this.mapSequenceConfiguration.set(VerticesEdgesMapReduce.DIRECTION + "String_Node_Str" + this.mapSequenceClasses.size(),direction.name());
  this.mapSequenceConfiguration.setStrings(VerticesEdgesMapReduce.LABELS + "String_Node_Str" + this.mapSequenceClasses.size(),labels);
  this.mapSequenceClasses.add(VerticesEdgesMapReduce.Map.class);
  this.reduceClass=VerticesEdgesMapReduce.Reduce.class;
  this.setKeyValueClasses(LongWritable.class,Holder.class,NullWritable.class,FaunusVertex.class);
  this.completeSequence();
}

Fixed version (ground truth):
public void verticesEdgesMapReduce(final Direction direction,final String... labels) throws IOException {
  this.mapSequenceConfiguration.set(VerticesEdgesMapReduce.DIRECTION + "String_Node_Str" + this.mapSequenceClasses.size(),direction.name());
  this.mapSequenceConfiguration.setStrings(VerticesEdgesMapReduce.LABELS + "String_Node_Str" + this.mapSequenceClasses.size(),labels);
  this.mapSequenceClasses.add(VerticesEdgesMapReduce.Map.class);
  this.mapSequenceConfiguration.set(VerticesEdgesMapReduce.DIRECTION,direction.name());
  this.mapSequenceConfiguration.setStrings(VerticesEdgesMapReduce.LABELS,labels);
  this.reduceClass=VerticesEdgesMapReduce.Reduce.class;
  this.setKeyValueClasses(LongWritable.class,Holder.class,NullWritable.class,FaunusVertex.class);
  this.completeSequence();
}
Program: 8598
Project: 8598
Buggy source:
public void linkMapReduce(final int step,final Direction direction,final String label,final String mergeWeightKey) throws IOException {
  this.mapSequenceConfiguration.setInt(LinkMapReduce.STEP + "String_Node_Str" + this.mapSequenceClasses.size(),step);
  this.mapSequenceConfiguration.set(LinkMapReduce.DIRECTION + "String_Node_Str" + this.mapSequenceClasses.size(),direction.name());
  this.mapSequenceConfiguration.set(LinkMapReduce.LABEL + "String_Node_Str" + this.mapSequenceClasses.size(),label);
  if (null == mergeWeightKey) {
    this.mapSequenceConfiguration.setBoolean(LinkMapReduce.MERGE_DUPLICATES + "String_Node_Str" + this.mapSequenceClasses.size(),false);
    this.mapSequenceConfiguration.set(LinkMapReduce.MERGE_WEIGHT_KEY + "String_Node_Str" + this.mapSequenceClasses.size(),LinkMapReduce.NO_WEIGHT_KEY);
  }
 else {
    this.mapSequenceConfiguration.setBoolean(LinkMapReduce.MERGE_DUPLICATES + "String_Node_Str" + this.mapSequenceClasses.size(),true);
    this.mapSequenceConfiguration.set(LinkMapReduce.MERGE_WEIGHT_KEY + "String_Node_Str" + this.mapSequenceClasses.size(),mergeWeightKey);
  }
  this.mapSequenceClasses.add(LinkMapReduce.Map.class);
  this.reduceClass=LinkMapReduce.Reduce.class;
  this.setKeyValueClasses(LongWritable.class,Holder.class,NullWritable.class,FaunusVertex.class);
  this.completeSequence();
}

Fixed version (ground truth):
public void linkMapReduce(final int step,final Direction direction,final String label,final String mergeWeightKey) throws IOException {
  this.mapSequenceConfiguration.setInt(LinkMapReduce.STEP + "String_Node_Str" + this.mapSequenceClasses.size(),step);
  this.mapSequenceConfiguration.set(LinkMapReduce.DIRECTION + "String_Node_Str" + this.mapSequenceClasses.size(),direction.name());
  this.mapSequenceConfiguration.set(LinkMapReduce.LABEL + "String_Node_Str" + this.mapSequenceClasses.size(),label);
  if (null == mergeWeightKey) {
    this.mapSequenceConfiguration.setBoolean(LinkMapReduce.MERGE_DUPLICATES + "String_Node_Str" + this.mapSequenceClasses.size(),false);
    this.mapSequenceConfiguration.set(LinkMapReduce.MERGE_WEIGHT_KEY + "String_Node_Str" + this.mapSequenceClasses.size(),LinkMapReduce.NO_WEIGHT_KEY);
  }
 else {
    this.mapSequenceConfiguration.setBoolean(LinkMapReduce.MERGE_DUPLICATES + "String_Node_Str" + this.mapSequenceClasses.size(),true);
    this.mapSequenceConfiguration.set(LinkMapReduce.MERGE_WEIGHT_KEY + "String_Node_Str" + this.mapSequenceClasses.size(),mergeWeightKey);
  }
  this.mapSequenceClasses.add(LinkMapReduce.Map.class);
  this.mapSequenceConfiguration.set(LinkMapReduce.DIRECTION,direction.name());
  this.reduceClass=LinkMapReduce.Reduce.class;
  this.setKeyValueClasses(LongWritable.class,Holder.class,NullWritable.class,FaunusVertex.class);
  this.completeSequence();
}
Program: 8599
Project: 8599
Buggy source:
@Override public void reduce(final LongWritable key,final Iterable<Holder> values,final Reducer<LongWritable,Holder,NullWritable,FaunusVertex>.Context context) throws IOException, InterruptedException {
  final FaunusVertex vertex=new FaunusVertex(key.get());
  for (  final Holder holder : values) {
    final char tag=holder.getTag();
    final FaunusVertex temp=(FaunusVertex)holder.get();
    if (tag == 'v') {
      vertex.setProperties(temp.getProperties());
      vertex.addEdges(Direction.BOTH,temp);
    }
 else {
      vertex.addPaths(temp.getPaths(),true);
    }
  }
  context.write(NullWritable.get(),vertex);
}

Fixed version (ground truth):
@Override public void reduce(final LongWritable key,final Iterable<Holder> values,final Reducer<LongWritable,Holder,NullWritable,FaunusVertex>.Context context) throws IOException, InterruptedException {
  this.vertex.reuse(key.get());
  for (  final Holder holder : values) {
    final char tag=holder.getTag();
    final FaunusVertex temp=(FaunusVertex)holder.get();
    if (tag == 'v') {
      vertex.setProperties(temp.getProperties());
      vertex.addEdges(Direction.BOTH,temp);
    }
 else {
      vertex.addPaths(temp.getPaths(),true);
    }
  }
  context.write(NullWritable.get(),vertex);
}
Program: 8601
Project: 8601
Buggy source:
public FaunusVertex readFaunusVertex(final Pair<ByteBuffer,SortedMap<ByteBuffer,IColumn>> row){
  FaunusVertexRelationLoader loader=new FaunusVertexRelationLoader(row.left.duplicate());
  loadRelations(new CassandraMapIterable(row.right),loader,tx);
  return loader.getVertex();
}

Fixed version (ground truth):
public FaunusVertex readFaunusVertex(final Pair<ByteBuffer,SortedMap<ByteBuffer,IColumn>> row){
  FaunusVertexRelationLoader loader=new FaunusVertexRelationLoader(IDHandler.getKeyID(row.left.duplicate()));
  loadRelations(new CassandraMapIterable(row.right),loader,tx);
  return loader.getVertex();
}
Program: 8602
Project: 8602
Buggy source:
@Override public void reduce(final IntWritable key,final Iterable<IntWritable> values,final Reducer<IntWritable,IntWritable,IntWritable,IntWritable>.Context context) throws IOException, InterruptedException {
  int totalDegree=0;
  for (  final IntWritable token : values) {
    totalDegree++;
  }
  context.write(key,new IntWritable(totalDegree));
}

Fixed version (ground truth):
@Override public void reduce(final IntWritable key,final Iterable<IntWritable> values,final Reducer<IntWritable,IntWritable,IntWritable,IntWritable>.Context context) throws IOException, InterruptedException {
  int totalDegree=0;
  for (  final IntWritable token : values) {
    totalDegree=totalDegree + token.get();
  }
  context.write(key,new IntWritable(totalDegree));
}
Program: 8603
Project: 8603
Buggy source:
@Override public void reduce(final Text key,final Iterable<IntWritable> values,final Reducer<Text,IntWritable,Text,IntWritable>.Context context) throws IOException, InterruptedException {
  int totalNumberOfEdges=0;
  for (  final IntWritable token : values) {
    totalNumberOfEdges++;
  }
  context.write(key,new IntWritable(totalNumberOfEdges));
}

Fixed version (ground truth):
@Override public void reduce(final Text key,final Iterable<IntWritable> values,final Reducer<Text,IntWritable,Text,IntWritable>.Context context) throws IOException, InterruptedException {
  int totalNumberOfEdges=0;
  for (  final IntWritable token : values) {
    totalNumberOfEdges=totalNumberOfEdges + token.get();
  }
  context.write(key,new IntWritable(totalNumberOfEdges));
}
Program: 8604
Project: 8604
Buggy source:
public void removeEdges(final Tokens.Action action,final Direction direction,final String... labels){
  if (action.equals(Tokens.Action.KEEP)) {
    final Set<String> keep=new HashSet<String>(Arrays.asList(labels));
    if (direction.equals(OUT) || direction.equals(BOTH)) {
      if (labels.length == 0) {
        this.outEdges.clear();
      }
 else {
        for (        final String label : this.outEdges.keySet()) {
          if (!keep.contains(label))           this.outEdges.remove(label);
        }
      }
    }
 else     if (direction.equals(IN) || direction.equals(BOTH)) {
      if (labels.length == 0) {
        this.inEdges.clear();
      }
 else {
        for (        final String label : this.inEdges.keySet()) {
          if (!keep.contains(label))           this.inEdges.remove(label);
        }
      }
    }
  }
 else {
    if (direction.equals(OUT) || direction.equals(BOTH)) {
      if (labels.length == 0) {
        this.outEdges.clear();
      }
 else {
        for (        final String label : labels) {
          this.outEdges.remove(label);
        }
      }
    }
 else     if (direction.equals(IN) || direction.equals(BOTH)) {
      if (labels.length == 0) {
        this.inEdges.clear();
      }
 else {
        for (        final String label : labels) {
          this.inEdges.remove(label);
        }
      }
    }
  }
}

Fixed version (ground truth):
public void removeEdges(final Tokens.Action action,final Direction direction,final String... labels){
  if (action.equals(Tokens.Action.KEEP)) {
    final Set<String> keep=new HashSet<String>(Arrays.asList(labels));
    if (direction.equals(BOTH) || direction.equals(OUT)) {
      if (labels.length > 0) {
        for (        final String label : new ArrayList<String>(this.outEdges.keySet())) {
          if (!keep.contains(label))           this.outEdges.remove(label);
        }
      }
    }
    if (direction.equals(BOTH) || direction.equals(IN)) {
      if (labels.length > 0) {
        for (        final String label : new ArrayList<String>(this.inEdges.keySet())) {
          if (!keep.contains(label))           this.inEdges.remove(label);
        }
      }
    }
  }
 else {
    if (direction.equals(BOTH) || direction.equals(OUT)) {
      if (labels.length == 0) {
        this.outEdges.clear();
      }
 else {
        for (        final String label : labels) {
          this.outEdges.remove(label);
        }
      }
    }
    if (direction.equals(BOTH) || direction.equals(IN)) {
      if (labels.length == 0) {
        this.inEdges.clear();
      }
 else {
        for (        final String label : labels) {
          this.inEdges.remove(label);
        }
      }
    }
  }
}
Program: 8605
Project: 8605
Buggy source:
public FaunusGraph edgeLabelDistribution(final Direction direction) throws IOException {
  this.completeSequence();
  Configuration conf=new Configuration();
  conf.set(EdgeLabelDistribution.DIRECTION,direction.name());
  final Job job=new Job(conf,EdgeLabelDistribution.class.getCanonicalName());
  job.setMapperClass(EdgeLabelDistribution.Map.class);
  job.setReducerClass(EdgeLabelDistribution.Reduce.class);
  job.setCombinerClass(EdgeLabelDistribution.Reduce.class);
  job.setJarByClass(FaunusGraph.class);
  job.setMapOutputKeyClass(Text.class);
  job.setMapOutputValueClass(IntWritable.class);
  job.setOutputKeyClass(Text.class);
  job.setOutputKeyClass(IntWritable.class);
  this.outputFormat=this.statisticsOutputFormat;
  this.jobs.add(job);
  return this;
}

Fixed version (ground truth):
public FaunusGraph edgeLabelDistribution(final Direction direction) throws IOException {
  this.completeSequence();
  Configuration conf=new Configuration();
  conf.set(EdgeLabelDistribution.DIRECTION,direction.name());
  final Job job=new Job(conf,EdgeLabelDistribution.class.getCanonicalName());
  job.setMapperClass(EdgeLabelDistribution.Map.class);
  job.setReducerClass(EdgeLabelDistribution.Reduce.class);
  job.setCombinerClass(EdgeLabelDistribution.Reduce.class);
  job.setJarByClass(FaunusGraph.class);
  job.setMapOutputKeyClass(Text.class);
  job.setMapOutputValueClass(LongWritable.class);
  job.setOutputKeyClass(Text.class);
  job.setOutputKeyClass(LongWritable.class);
  this.outputFormat=this.statisticsOutputFormat;
  this.jobs.add(job);
  return this;
}
Program: 8606
Project: 8606
Buggy source:
@Override public void map(final NullWritable key,final FaunusVertex value,final Mapper<NullWritable,FaunusVertex,Text,LongWritable>.Context context) throws IOException, InterruptedException {
  long counter=0;
  for (  final Edge edge : value.getEdges(this.direction)) {
    counter++;
    final String label=edge.getLabel();
    final Long count=this.map.get(label);
    if (null == count)     this.map.put(label,1l);
 else     this.map.put(label,count + 1l);
  }
  context.getCounter(Counters.VERTICES_COUNTED).increment(1);
  context.getCounter(Counters.EDGES_COUNTED).increment(counter);
}

Fixed version (ground truth):
@Override public void map(final NullWritable key,final FaunusVertex value,final Mapper<NullWritable,FaunusVertex,Text,LongWritable>.Context context) throws IOException, InterruptedException {
  long counter=0;
  for (  final Edge edge : value.getEdges(this.direction)) {
    counter++;
    final String label=edge.getLabel();
    final Long count=this.map.get(label);
    if (null == count)     this.map.put(label,1l);
 else     this.map.put(label,count + 1l);
  }
  context.getCounter(Counters.VERTICES_COUNTED).increment(1);
  context.getCounter(Counters.EDGES_COUNTED).increment(counter);
  if (this.map.size() > 10000) {
    this.cleanup(context);
    this.map.clear();
  }
}
Program: 8607
Project: 8607
Buggy source:
public Iterable<Edge> getEdges(final Direction direction,final String... labels){
  final List<List<Edge>> edges=new ArrayList<List<Edge>>();
  if (direction.equals(OUT) || direction.equals(BOTH)) {
    if (labels.length == 0) {
      for (      final List<Edge> temp : this.outEdges.values()) {
        edges.add(temp);
      }
    }
 else {
      for (      final String label : labels) {
        final List<Edge> temp=this.outEdges.get(label);
        if (null != temp)         edges.add(temp);
      }
    }
  }
  if (direction.equals(IN) || direction.equals(BOTH)) {
    if (labels.length == 0) {
      for (      final List<Edge> temp : this.inEdges.values()) {
        edges.add(temp);
      }
    }
 else {
      for (      final String label : labels) {
        final List<Edge> temp=this.inEdges.get(label);
        if (null != temp)         edges.add(temp);
      }
    }
  }
  return new EdgeList(edges);
}

Fixed version (ground truth):
public Iterable<Edge> getEdges(final Direction direction,final String... labels){
  final List<List<Edge>> edges=new ArrayList<List<Edge>>();
  if (direction.equals(OUT) || direction.equals(BOTH)) {
    if (null == labels || labels.length == 0) {
      for (      final List<Edge> temp : this.outEdges.values()) {
        edges.add(temp);
      }
    }
 else {
      for (      final String label : labels) {
        final List<Edge> temp=this.outEdges.get(label);
        if (null != temp)         edges.add(temp);
      }
    }
  }
  if (direction.equals(IN) || direction.equals(BOTH)) {
    if (null == labels || labels.length == 0) {
      for (      final List<Edge> temp : this.inEdges.values()) {
        edges.add(temp);
      }
    }
 else {
      for (      final String label : labels) {
        final List<Edge> temp=this.inEdges.get(label);
        if (null != temp)         edges.add(temp);
      }
    }
  }
  return new EdgeList(edges);
}
Program: 8608
Project: 8608
Buggy source:
@Override public void setup(final Mapper.Context context) throws IOException, InterruptedException {
  this.direction=Direction.valueOf(context.getConfiguration().get(DIRECTION));
  this.labels=context.getConfiguration().getStrings(LABELS);
}

Fixed version (ground truth):
@Override public void setup(final Mapper.Context context) throws IOException, InterruptedException {
  this.direction=Direction.valueOf(context.getConfiguration().get(DIRECTION));
  this.labels=context.getConfiguration().getStrings(LABELS,new String[0]);
}
Program: 8609
Project: 8609
Buggy source:
@Override public void map(final NullWritable key,final FaunusVertex value,final Mapper<NullWritable,FaunusVertex,Text,LongWritable>.Context context) throws IOException, InterruptedException {
  long counter=0;
  for (  final Edge edge : value.getEdges(this.direction)) {
    counter++;
    final String label=edge.getLabel();
    final Long count=map.get(label);
    if (null == count)     map.put(label,1l);
 else     map.put(label,count + 1l);
  }
  context.getCounter(Counters.VERTICES_COUNTED).increment(1);
  context.getCounter(Counters.EDGES_COUNTED).increment(counter);
}

Fixed version (ground truth):
@Override public void map(final NullWritable key,final FaunusVertex value,final Mapper<NullWritable,FaunusVertex,Text,LongWritable>.Context context) throws IOException, InterruptedException {
  long counter=0;
  for (  final Edge edge : value.getEdges(this.direction)) {
    counter++;
    final String label=edge.getLabel();
    final Long count=this.map.get(label);
    if (null == count)     this.map.put(label,1l);
 else     this.map.put(label,count + 1l);
  }
  context.getCounter(Counters.VERTICES_COUNTED).increment(1);
  context.getCounter(Counters.EDGES_COUNTED).increment(counter);
}
Program: 8610
Project: 8610
Buggy source:
public void testMapReduce1() throws IOException {
  Configuration config=new Configuration();
  config.setStrings(EdgeLabelDistribution.DIRECTION,"String_Node_Str");
  this.mapReduceDriver.withConfiguration(config);
  final List<Pair<Text,LongWritable>> results=runWithToyGraphNoFormatting(ExampleGraph.GRAPH_OF_THE_GODS,this.mapReduceDriver);
  assertEquals(results.size(),6);
  for (  final Pair<Text,LongWritable> result : results) {
    if (result.getFirst().toString().equals("String_Node_Str")) {
      assertEquals(result.getSecond().get(),4l);
    }
 else     if (result.getFirst().toString().equals("String_Node_Str")) {
      assertEquals(result.getSecond().get(),3l);
    }
 else     if (result.getFirst().toString().equals("String_Node_Str")) {
      assertEquals(result.getSecond().get(),6l);
    }
 else     if (result.getFirst().toString().equals("String_Node_Str")) {
      assertEquals(result.getSecond().get(),1l);
    }
 else     if (result.getFirst().toString().equals("String_Node_Str")) {
      assertEquals(result.getSecond().get(),1l);
    }
 else     if (result.getFirst().toString().equals("String_Node_Str")) {
      assertEquals(result.getSecond().get(),2l);
    }
 else {
      assertTrue(false);
    }
    assertEquals(17,this.mapReduceDriver.getCounters().findCounter(EdgeLabelDistribution.Counters.EDGES_COUNTED).getValue());
    assertEquals(12,this.mapReduceDriver.getCounters().findCounter(EdgeLabelDistribution.Counters.VERTICES_COUNTED).getValue());
  }
}

Fixed version (ground truth):
public void testMapReduce1() throws IOException {
  Configuration config=new Configuration();
  config.setStrings(EdgeLabelDistribution.DIRECTION,"String_Node_Str");
  this.mapReduceDriver.withConfiguration(config);
  final List<Pair<Text,LongWritable>> results=runWithToyGraphNoFormatting(ExampleGraph.GRAPH_OF_THE_GODS,this.mapReduceDriver);
  assertEquals(results.size(),6);
  for (  final Pair<Text,LongWritable> result : results) {
    if (result.getFirst().toString().equals("String_Node_Str")) {
      assertEquals(result.getSecond().get(),4l);
    }
 else     if (result.getFirst().toString().equals("String_Node_Str")) {
      assertEquals(result.getSecond().get(),3l);
    }
 else     if (result.getFirst().toString().equals("String_Node_Str")) {
      assertEquals(result.getSecond().get(),6l);
    }
 else     if (result.getFirst().toString().equals("String_Node_Str")) {
      assertEquals(result.getSecond().get(),1l);
    }
 else     if (result.getFirst().toString().equals("String_Node_Str")) {
      assertEquals(result.getSecond().get(),1l);
    }
 else     if (result.getFirst().toString().equals("String_Node_Str")) {
      assertEquals(result.getSecond().get(),2l);
    }
 else {
      assertTrue(false);
    }
  }
  assertEquals(17,this.mapReduceDriver.getCounters().findCounter(EdgeLabelDistribution.Counters.EDGES_COUNTED).getValue());
  assertEquals(12,this.mapReduceDriver.getCounters().findCounter(EdgeLabelDistribution.Counters.VERTICES_COUNTED).getValue());
}
Program: 8611
Project: 8611
Buggy source:
public static void main(String[] args) throws Exception {
  if (args.length != 4) {
    System.out.println("String_Node_Str");
    System.out.println("String_Node_Str");
    System.out.println("String_Node_Str");
    System.out.println("String_Node_Str");
    System.out.println("String_Node_Str");
    System.out.println("String_Node_Str");
    System.out.println("String_Node_Str");
    System.exit(-1);
  }
  final FaunusGraph faunusGraph=new FaunusGraph(JSONInputFormat.class,new Path(args[0]),JSONOutputFormat.class,new Path(args[1]),args[3]);
  final GroovyScriptEngineImpl scriptEngine=new GroovyScriptEngineImpl();
  scriptEngine.eval("String_Node_Str" + com.tinkerpop.blueprints.Direction.class.getName() + "String_Node_Str");
  scriptEngine.eval("String_Node_Str" + com.tinkerpop.blueprints.Direction.class.getName() + "String_Node_Str");
  scriptEngine.put("String_Node_Str",faunusGraph);
  ((FaunusGraph)scriptEngine.eval(args[3])).completeMapSequence();
  int result=ToolRunner.run(faunusGraph,args);
  System.exit(result);
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  if (args.length != 4) {
    System.out.println("String_Node_Str");
    System.out.println("String_Node_Str");
    System.out.println("String_Node_Str");
    System.out.println("String_Node_Str");
    System.out.println("String_Node_Str");
    System.out.println("String_Node_Str");
    System.out.println("String_Node_Str");
    System.exit(-1);
  }
  final FaunusGraph faunusGraph=new FaunusGraph(JSONInputFormat.class,new Path(args[0]),JSONOutputFormat.class,new Path(args[1]),args[3]);
  final GroovyScriptEngineImpl scriptEngine=new GroovyScriptEngineImpl();
  scriptEngine.eval("String_Node_Str" + com.tinkerpop.blueprints.Direction.class.getName() + "String_Node_Str");
  scriptEngine.eval("String_Node_Str" + com.tinkerpop.blueprints.Direction.class.getName() + "String_Node_Str");
  scriptEngine.put("String_Node_Str",faunusGraph);
  ((FaunusGraph)scriptEngine.eval(args[3])).completeSequence();
  int result=ToolRunner.run(faunusGraph,args);
  System.exit(result);
}
Program: 8612
Project: 8612
Buggy source:
public FaunusGraph traverse(final Direction firstDirection,final String firstLabel,final Direction secondDirection,final String secondLabel,final String newLabel) throws IOException {
  this.completeMapSequence();
  final Configuration conf=new Configuration();
  conf.set(Traverse.FIRST_DIRECTION,firstDirection.toString());
  conf.set(Traverse.FIRST_LABEL,firstLabel);
  conf.set(Traverse.SECOND_DIRECTION,secondDirection.toString());
  conf.set(Traverse.SECOND_LABEL,secondLabel);
  conf.set(Traverse.NEW_LABEL,newLabel);
  final Job job=new Job(conf,Traverse.class.getName());
  this.configureMapReduceJob(job);
  job.setMapperClass(Traverse.Map.class);
  job.setReducerClass(Traverse.Reduce.class);
  this.jobs.add(job);
  return this;
}

Fixed version (ground truth):
public FaunusGraph traverse(final Direction firstDirection,final String firstLabel,final Direction secondDirection,final String secondLabel,final String newLabel) throws IOException {
  this.mapSequenceConfiguration.set(Traverse.FIRST_DIRECTION,firstDirection.toString());
  this.mapSequenceConfiguration.set(Traverse.FIRST_LABEL,firstLabel);
  this.mapSequenceConfiguration.set(Traverse.SECOND_DIRECTION,secondDirection.toString());
  this.mapSequenceConfiguration.set(Traverse.SECOND_LABEL,secondLabel);
  this.mapSequenceConfiguration.set(Traverse.NEW_LABEL,newLabel);
  this.mapRClass=Traverse.Map.class;
  this.reduceClass=Traverse.Reduce.class;
  this.completeSequence();
  return this;
}
Program: 8613
Project: 8613
Buggy source:
public FaunusGraph exceptEdgeLabels(final String... labels) throws IOException {
  this.addMapSequenceClass(ExceptEdgeLabels.Map.class.getName());
  this.mapSequenceConfiguration.setStrings(ExceptEdgeLabels.LABELS + "String_Node_Str" + this.currentSequenceStep++,labels);
  return this;
}

Fixed version (ground truth):
public FaunusGraph exceptEdgeLabels(final String... labels) throws IOException {
  this.mapSequenceConfiguration.setStrings(ExceptEdgeLabels.LABELS + "String_Node_Str" + this.mapSequenceClasses.size(),labels);
  this.mapSequenceClasses.add(ExceptEdgeLabels.Map.class);
  return this;
}
Program: 8614
Project: 8614
Buggy source:
public FaunusGraph retainEdgeLabels(final String... labels) throws IOException {
  this.addMapSequenceClass(RetainEdgeLabels.Map.class.getName());
  this.mapSequenceConfiguration.setStrings(RetainEdgeLabels.LABELS + "String_Node_Str" + this.currentSequenceStep++,labels);
  return this;
}

Fixed version (ground truth):
public FaunusGraph retainEdgeLabels(final String... labels) throws IOException {
  this.mapSequenceConfiguration.setStrings(RetainEdgeLabels.LABELS + "String_Node_Str" + this.mapSequenceClasses.size(),labels);
  this.mapSequenceClasses.add(RetainEdgeLabels.Map.class);
  return this;
}
Program: 8615
Project: 8615
Buggy source:
public FaunusGraph self(final boolean allow) throws IOException {
  this.addMapSequenceClass(Self.Map.class.getName());
  this.mapSequenceConfiguration.setBoolean(Self.ALLOW + "String_Node_Str" + this.currentSequenceStep++,allow);
  return this;
}

Fixed version (ground truth):
public FaunusGraph self(final boolean allow) throws IOException {
  this.mapSequenceConfiguration.setBoolean(Self.ALLOW + "String_Node_Str" + this.mapSequenceClasses.size(),allow);
  this.mapSequenceClasses.add(Self.Map.class);
  return this;
}
Program: 8616
Project: 8616
Buggy source:
public FaunusGraph transpose(final String label,final String newLabel) throws IOException {
  this.completeMapSequence();
  final Configuration conf=new Configuration();
  conf.set(Transpose.LABEL,label);
  conf.set(Transpose.NEW_LABEL,newLabel);
  final Job job=new Job(conf,Transpose.class.getName());
  this.configureMapReduceJob(job);
  job.setMapperClass(Transpose.Map.class);
  job.setReducerClass(Transpose.Reduce.class);
  this.jobs.add(job);
  return this;
}

Fixed version (ground truth):
public FaunusGraph transpose(final String label,final String newLabel) throws IOException {
  this.mapSequenceConfiguration.set(Transpose.LABEL,label);
  this.mapSequenceConfiguration.set(Transpose.NEW_LABEL,newLabel);
  this.mapRClass=Transpose.Map.class;
  this.reduceClass=Transpose.Reduce.class;
  this.completeSequence();
  return this;
}
Program: 8617
Project: 8617
Buggy source:
public FaunusGraph _() throws IOException {
  this.addMapSequenceClass(Identity.Map.class.getName());
  this.currentSequenceStep++;
  return this;
}

Fixed version (ground truth):
public FaunusGraph _() throws IOException {
  this.mapSequenceClasses.add(Identity.Map.class);
  return this;
}
Program: 8618
Project: 8618
Buggy source:
public void selectDay(int dayOfMonth){
  clearSelectedDay();
  selectedDay=dayOfMonth + 6 + startingDayOfWeek;
  if (Utils.isWeekOfYearEnabled()) {
    selectedDay=selectedDay + selectedDay / 7 + 1;
  }
  notifyItemChanged(selectedDay);
}

Fixed version (ground truth):
public void selectDay(int dayOfMonth){
  int prevDay=selectedDay;
  selectedDay=-1;
  notifyItemChanged(prevDay);
  if (dayOfMonth == -1) {
    return;
  }
  selectedDay=dayOfMonth + 6 + startingDayOfWeek;
  if (Utils.isWeekOfYearEnabled()) {
    selectedDay=selectedDay + selectedDay / 7 + 1;
  }
  notifyItemChanged(selectedDay);
}
Program: 8619
Project: 8619
Buggy source:
@Override public void onPageSelected(int position){
  Intent intent=new Intent(Constants.BROADCAST_INTENT_TO_MONTH_FRAGMENT);
  intent.putExtra(Constants.BROADCAST_FIELD_TO_MONTH_FRAGMENT,CalendarAdapter.positionToOffset(position));
  intent.putExtra(Constants.BROADCAST_FIELD_SELECT_DAY,-1);
  LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
  today.setVisibility(View.VISIBLE);
  todayIcon.setVisibility(View.VISIBLE);
}

Fixed version (ground truth):
@Override public void onPageSelected(int position){
  Intent intent=new Intent(Constants.BROADCAST_INTENT_TO_MONTH_FRAGMENT);
  intent.putExtra(Constants.BROADCAST_FIELD_TO_MONTH_FRAGMENT,CalendarAdapter.positionToOffset(position));
  intent.putExtra(Constants.BROADCAST_FIELD_SELECT_DAY_JDN,lastSelectedJdn);
  LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
  today.setVisibility(View.VISIBLE);
  todayIcon.setVisibility(View.VISIBLE);
}
Program: 8620
Project: 8620
Buggy source:
public void bringDate(long jdn){
  CalendarType mainCalendar=Utils.getMainCalendar();
  AbstractDate today=Utils.getTodayOfCalendar(mainCalendar);
  AbstractDate date=Utils.getDateFromJdnOfCalendar(mainCalendar,jdn);
  viewPagerPosition=(today.getYear() - date.getYear()) * 12 + today.getMonth() - date.getMonth();
  CalendarAdapter.gotoOffset(monthViewPager,viewPagerPosition);
  Intent intent=new Intent(Constants.BROADCAST_INTENT_TO_MONTH_FRAGMENT);
  intent.putExtra(Constants.BROADCAST_FIELD_TO_MONTH_FRAGMENT,viewPagerPosition);
  intent.putExtra(Constants.BROADCAST_FIELD_SELECT_DAY,date.getDayOfMonth());
  LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
  selectDay(jdn);
}

Fixed version (ground truth):
public void bringDate(long jdn){
  CalendarType mainCalendar=Utils.getMainCalendar();
  AbstractDate today=Utils.getTodayOfCalendar(mainCalendar);
  AbstractDate date=Utils.getDateFromJdnOfCalendar(mainCalendar,jdn);
  viewPagerPosition=(today.getYear() - date.getYear()) * 12 + today.getMonth() - date.getMonth();
  CalendarAdapter.gotoOffset(monthViewPager,viewPagerPosition);
  LocalBroadcastManager.getInstance(getContext()).sendBroadcast(new Intent(Constants.BROADCAST_INTENT_TO_MONTH_FRAGMENT).putExtra(Constants.BROADCAST_FIELD_TO_MONTH_FRAGMENT,viewPagerPosition).putExtra(Constants.BROADCAST_FIELD_SELECT_DAY_JDN,jdn));
  selectDay(jdn);
}