nus-yam/ex-repair huggingface dataset:
Program: 55776
Project: 55776
Buggy source:
/** 
 * Computes the distance of one data point to one cluster center and emits a key-value-pair where the id of the data point is the key and a Distance object is the value.
 */
@Override public void cross(PactRecord dataPointRecord,PactRecord clusterCenterRecord,Collector out){
  dataPointRecord.getField(1,dataPoint);
  clusterCenterRecord.getField(0,clusterCenterId);
  clusterCenterRecord.getField(1,clusterPoint);
  this.distance.setValue(dataPoint.computeEuclidianDistance(clusterPoint));
  dataPointRecord.setField(2,clusterCenterId);
  dataPointRecord.setField(3,this.distance);
  out.collect(dataPointRecord);
}

Fixed version (ground truth):
/** 
 * Computes the distance of one data point to one cluster center and emits a key-value-pair where the id of the data point is the key and a Distance object is the value.
 */
@Override public void cross(PactRecord dataPointRecord,PactRecord clusterCenterRecord,Collector out){
  CoordVector dataPoint=dataPointRecord.getField(1,CoordVector.class);
  PactInteger clusterCenterId=clusterCenterRecord.getField(0,PactInteger.class);
  CoordVector clusterPoint=clusterCenterRecord.getField(1,CoordVector.class);
  this.distance.setValue(dataPoint.computeEuclidianDistance(clusterPoint));
  dataPointRecord.setField(2,clusterCenterId);
  dataPointRecord.setField(3,this.distance);
  out.collect(dataPointRecord);
}
Program: 55777
Project: 55777
Buggy source:
@Override public int serializeRecord(PactRecord record,byte[] target){
  record.getField(0,this.centerId);
  record.getField(1,this.centerPos);
  StringBuilder line=new StringBuilder();
  line.append(this.centerId.getValue());
  for (  double coord : this.centerPos.getCoordinates()) {
    line.append('|');
    line.append(df.format(coord));
  }
  line.append('|');
  byte[] byteString=line.toString().getBytes();
  if (byteString.length <= target.length) {
    System.arraycopy(byteString,0,target,0,byteString.length);
    return byteString.length;
  }
 else {
    return -1 * byteString.length;
  }
}

Fixed version (ground truth):
@Override public int serializeRecord(PactRecord record,byte[] target){
  line.setLength(0);
  PactInteger centerId=record.getField(0,PactInteger.class);
  CoordVector centerPos=record.getField(1,CoordVector.class);
  line.append(centerId.getValue());
  for (  double coord : centerPos.getCoordinates()) {
    line.append('|');
    line.append(df.format(coord));
  }
  line.append('|');
  byte[] byteString=line.toString().getBytes();
  if (byteString.length <= target.length) {
    System.arraycopy(byteString,0,target,0,byteString.length);
    return byteString.length;
  }
 else {
    return -byteString.length;
  }
}
Program: 55778
Project: 55778
Buggy source:
/** 
 * Computes a pre-aggregated average value of a coordinate vector.
 */
@Override public void combine(Iterator<PactRecord> dataPoints,Collector out){
  this.coordinates.setCoordinates(null);
  double[] coordinateSum=null;
  int count=0;
  while (dataPoints.hasNext()) {
    PactRecord next=dataPoints.next();
    next.getField(0,cid);
    double[] thisCoords=next.getField(1,CoordVector.class).getCoordinates();
    int thisCount=next.getField(2,PactInteger.class).getValue();
    if (coordinateSum == null) {
      if (this.coordinates.getCoordinates() != null) {
        coordinateSum=this.coordinates.getCoordinates();
      }
 else {
        coordinateSum=new double[thisCoords.length];
      }
    }
    addToCoordVector(coordinateSum,thisCoords);
    count+=thisCount;
  }
  this.coordinates.setCoordinates(coordinateSum);
  this.count.setValue(count);
  result.setField(0,cid);
  result.setField(1,this.coordinates);
  result.setField(2,this.count);
  out.collect(result);
}

Fixed version (ground truth):
/** 
 * Computes a pre-aggregated average value of a coordinate vector.
 */
@Override public void combine(Iterator<PactRecord> dataPoints,Collector out){
  PactRecord next=null;
  this.coordinates.setCoordinates(null);
  double[] coordinateSum=null;
  int count=0;
  while (dataPoints.hasNext()) {
    next=dataPoints.next();
    double[] thisCoords=next.getField(1,CoordVector.class).getCoordinates();
    int thisCount=next.getField(2,PactInteger.class).getValue();
    if (coordinateSum == null) {
      if (this.coordinates.getCoordinates() != null) {
        coordinateSum=this.coordinates.getCoordinates();
      }
 else {
        coordinateSum=new double[thisCoords.length];
      }
    }
    addToCoordVector(coordinateSum,thisCoords);
    count+=thisCount;
  }
  this.coordinates.setCoordinates(coordinateSum);
  this.count.setValue(count);
  next.setField(1,this.coordinates);
  next.setField(2,this.count);
  out.collect(next);
}
Program: 55779
Project: 55779
Buggy source:
/** 
 * Aggregate "amount": sum(amount) GROUP BY nation, year Output Schema: Key: (nation, year) Value: amount
 */
@Override public void reduce(Iterator<PactRecord> records,Collector out) throws Exception {
  float amount=0;
  while (records.hasNext()) {
    record=records.next();
    record.getField(1,value);
    amount+=Float.parseFloat(value.toString());
  }
  if (value != null) {
    value.setValue("String_Node_Str" + amount);
    record.setField(1,value);
    out.collect(record);
  }
}

Fixed version (ground truth):
/** 
 * Aggregate "amount": sum(amount) GROUP BY nation, year Output Schema: Key: (nation, year) Value: amount
 */
@Override public void reduce(Iterator<PactRecord> records,Collector out) throws Exception {
  PactRecord record=null;
  float amount=0;
  while (records.hasNext()) {
    record=records.next();
    PactString value=record.getField(1,PactString.class);
    amount+=Float.parseFloat(value.toString());
  }
  value.setValue(String.valueOf(amount));
  record.setField(1,value);
  out.collect(record);
}
Program: 55780
Project: 55780
Buggy source:
/** 
 * Join together parts and orderedParts by matching partkey and suppkey. Output Schema: Key: suppkey Value: (amount, year)
 */
@Override public void match(PactRecord value1,PactRecord value2,Collector out) throws Exception {
  value1.getField(0,partAndSupplierKey);
  value1.getField(1,supplyCostStr);
  value2.getField(1,ordersValue);
  PactInteger year=new PactInteger(Integer.parseInt(ordersValue.getStringValueAt(0)));
  float quantity=Float.parseFloat(ordersValue.getStringValueAt(1));
  float price=Float.parseFloat(ordersValue.getStringValueAt(2));
  float supplyCost=Float.parseFloat(supplyCostStr.toString());
  float amount=price - supplyCost * quantity;
  value1.setField(0,partAndSupplierKey.getSecond());
  value1.setField(1,new StringIntPair(new PactString("String_Node_Str" + amount),year));
  out.collect(value1);
}

Fixed version (ground truth):
/** 
 * Join together parts and orderedParts by matching partkey and suppkey. Output Schema: Key: suppkey Value: (amount, year)
 */
@Override public void match(PactRecord value1,PactRecord value2,Collector out) throws Exception {
  IntPair partAndSupplierKey=value1.getField(0,this.partAndSupplierKey);
  PactString supplyCostStr=value1.getField(1,this.supplyCostStr);
  Tuple ordersValue=value2.getField(1,this.ordersValue);
  PactInteger year=new PactInteger(Integer.parseInt(ordersValue.getStringValueAt(0)));
  float quantity=Float.parseFloat(ordersValue.getStringValueAt(1));
  float price=Float.parseFloat(ordersValue.getStringValueAt(2));
  float supplyCost=Float.parseFloat(supplyCostStr.toString());
  float amount=price - supplyCost * quantity;
  value1.setField(0,partAndSupplierKey.getSecond());
  value1.setField(1,new StringIntPair(new PactString("String_Node_Str" + amount),year));
  out.collect(value1);
}
Program: 55781
Project: 55781
Buggy source:
/** 
 * Filter "lineitem". Output Schema: Key: orderkey Value: (partkey, suppkey, quantity, price)
 */
@Override public void map(PactRecord record,Collector out) throws Exception {
  record.getField(1,inputTuple);
  float price=Float.parseFloat(inputTuple.getStringValueAt(5)) * (1 - Float.parseFloat(inputTuple.getStringValueAt(6)));
  inputTuple.project((0 << 0) | (1 << 1) | (1 << 2)| (0 << 3)| (1 << 4));
  inputTuple.addAttribute("String_Node_Str" + price);
  record.setField(1,inputTuple);
  out.collect(record);
}

Fixed version (ground truth):
/** 
 * Filter "lineitem". Output Schema: Key: orderkey Value: (partkey, suppkey, quantity, price)
 */
@Override public void map(PactRecord record,Collector out) throws Exception {
  Tuple inputTuple=record.getField(1,Tuple.class);
  float price=Float.parseFloat(inputTuple.getStringValueAt(5)) * (1 - Float.parseFloat(inputTuple.getStringValueAt(6)));
  inputTuple.project((0 << 0) | (1 << 1) | (1 << 2)| (0 << 3)| (1 << 4));
  inputTuple.addAttribute("String_Node_Str" + price);
  record.setField(1,inputTuple);
  out.collect(record);
}
Program: 55782
Project: 55782
Buggy source:
/** 
 * Project "orders" Output Schema: Key: orderkey Value: year (from date)
 */
@Override public void map(PactRecord record,Collector out) throws Exception {
  record.getField(1,inputTuple);
  int year=Integer.parseInt(inputTuple.getStringValueAt(4).substring(0,4));
  record.setField(1,new PactInteger(year));
  out.collect(record);
}

Fixed version (ground truth):
/** 
 * Project "orders" Output Schema: Key: orderkey Value: year (from date)
 */
@Override public void map(PactRecord record,Collector out) throws Exception {
  Tuple inputTuple=record.getField(1,this.inputTuple);
  int year=Integer.parseInt(inputTuple.getStringValueAt(4).substring(0,4));
  record.setField(1,new PactInteger(year));
  out.collect(record);
}
Program: 55783
Project: 55783
Buggy source:
/** 
 * Join "orders" and "lineitem" by "orderkey". Output Schema: Key: (partkey, suppkey) Value: (year, quantity, price)
 */
@Override public void match(PactRecord value1,PactRecord value2,Collector out) throws Exception {
  value1.getField(1,year);
  value2.getField(1,lineItem);
  IntPair newKey=new IntPair(new PactInteger(Integer.parseInt(lineItem.getStringValueAt(0))),new PactInteger(Integer.parseInt(lineItem.getStringValueAt(1))));
  Tuple newValue=new Tuple();
  newValue.addAttribute(year.toString());
  newValue.addAttribute(lineItem.getStringValueAt(2));
  newValue.addAttribute(lineItem.getStringValueAt(3));
  value1.setField(0,newKey);
  value1.setField(1,newValue);
  out.collect(value1);
}

Fixed version (ground truth):
/** 
 * Join "orders" and "lineitem" by "orderkey". Output Schema: Key: (partkey, suppkey) Value: (year, quantity, price)
 */
@Override public void match(PactRecord value1,PactRecord value2,Collector out) throws Exception {
  PactInteger year=value1.getField(1,PactInteger.class);
  Tuple lineItem=value2.getField(1,Tuple.class);
  IntPair newKey=new IntPair(new PactInteger(Integer.parseInt(lineItem.getStringValueAt(0))),new PactInteger(Integer.parseInt(lineItem.getStringValueAt(1))));
  Tuple newValue=new Tuple();
  newValue.addAttribute(year.toString());
  newValue.addAttribute(lineItem.getStringValueAt(2));
  newValue.addAttribute(lineItem.getStringValueAt(3));
  value1.setField(0,newKey);
  value1.setField(1,newValue);
  out.collect(value1);
}
Program: 55784
Project: 55784
Buggy source:
/** 
 * Filter and project "part". The parts are filtered by "name LIKE %green%". Output Schema: Key: partkey Value: (empty)
 */
@Override public void map(PactRecord record,Collector out) throws Exception {
  record.getField(1,inputTuple);
  if (inputTuple.getStringValueAt(1).indexOf(COLOR) != -1) {
    record.setField(1,PactNull.getInstance());
    out.collect(record);
  }
}

Fixed version (ground truth):
/** 
 * Filter and project "part". The parts are filtered by "name LIKE %green%". Output Schema: Key: partkey Value: (empty)
 */
@Override public void map(PactRecord record,Collector out) throws Exception {
  Tuple inputTuple=record.getField(1,this.inputTuple);
  if (inputTuple.getStringValueAt(1).indexOf(COLOR) != -1) {
    record.setField(1,PactNull.getInstance());
    out.collect(record);
  }
}
Program: 55785
Project: 55785
Buggy source:
/** 
 * Join "part" and "partsupp" by "partkey". Output Schema: Key: (partkey, suppkey) Value: supplycost
 */
@Override public void match(PactRecord value1,PactRecord value2,Collector out) throws Exception {
  value1.getField(0,partKey);
  value2.getField(1,partSuppValue);
  IntPair newKey=new IntPair(partKey,new PactInteger(Integer.parseInt(partSuppValue.getStringValueAt(0))));
  String supplyCost=partSuppValue.getStringValueAt(1);
  value1.setField(0,newKey);
  value1.setField(1,new PactString(supplyCost));
  out.collect(value1);
}

Fixed version (ground truth):
/** 
 * Join "part" and "partsupp" by "partkey". Output Schema: Key: (partkey, suppkey) Value: supplycost
 */
@Override public void match(PactRecord value1,PactRecord value2,Collector out) throws Exception {
  PactInteger partKey=value1.getField(0,this.partKey);
  Tuple partSuppValue=value2.getField(1,this.partSuppValue);
  IntPair newKey=new IntPair(partKey,new PactInteger(Integer.parseInt(partSuppValue.getStringValueAt(0))));
  String supplyCost=partSuppValue.getStringValueAt(1);
  value1.setField(0,newKey);
  value1.setField(1,new PactString(supplyCost));
  out.collect(value1);
}
Program: 55786
Project: 55786
Buggy source:
/** 
 * Join "filteredParts" and "suppliers" by "suppkey". Output Schema: Key: (nation, year) Value: amount
 */
@Override public void match(PactRecord value1,PactRecord value2,Collector out) throws Exception {
  value1.getField(1,amountYearPair);
  value2.getField(1,nationName);
  PactInteger year=amountYearPair.getSecond();
  PactString amount=amountYearPair.getFirst();
  StringIntPair key=new StringIntPair(nationName,year);
  value1.setField(0,key);
  value1.setField(1,amount);
  out.collect(value1);
}

Fixed version (ground truth):
/** 
 * Join "filteredParts" and "suppliers" by "suppkey". Output Schema: Key: (nation, year) Value: amount
 */
@Override public void match(PactRecord value1,PactRecord value2,Collector out) throws Exception {
  StringIntPair amountYearPair=value1.getField(1,this.amountYearPair);
  PactString nationName=value2.getField(1,this.nationName);
  PactInteger year=amountYearPair.getSecond();
  PactString amount=amountYearPair.getFirst();
  StringIntPair key=new StringIntPair(nationName,year);
  value1.setField(0,key);
  value1.setField(1,amount);
  out.collect(value1);
}
Program: 55787
Project: 55787
Buggy source:
boolean canBeAdded(final TransferEnvelope transferEnvelope){
  if (this.tailSequenceNumber == -1) {
    return true;
  }
  final EventList eventList=transferEnvelope.getEventList();
  if (eventList != null) {
    if (!eventList.isEmpty()) {
      return false;
    }
  }
  if (!this.jobID.equals(transferEnvelope.getJobID())) {
    return false;
  }
  if (!this.source.equals(transferEnvelope.getSource())) {
    return false;
  }
  if (this.tailSequenceNumber != (transferEnvelope.getSequenceNumber() - 1)) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
boolean canBeAdded(final TransferEnvelope transferEnvelope){
  if (this.tailSequenceNumber == -1) {
    return true;
  }
  final EventList eventList=transferEnvelope.getEventList();
  if (eventList != null) {
    if (!eventList.isEmpty()) {
      return false;
    }
  }
  if (!this.jobID.equals(transferEnvelope.getJobID())) {
    return false;
  }
  if (!this.source.equals(transferEnvelope.getSource())) {
    return false;
  }
  if (this.tailSequenceNumber != (transferEnvelope.getSequenceNumber() - 1)) {
    return false;
  }
  if (this.size() >= SIZE_LIMIT) {
    return false;
  }
  return true;
}
Program: 55788
Project: 55788
Buggy source:
int unspill(final BufferProvider bufferProvider) throws IOException {
  if (this.headSequenceNumber == -1) {
    return 0;
  }
  if (this.headSequenceNumber == this.tailSequenceNumber) {
    final Buffer buffer=(Buffer)this.bufferRef;
    if (buffer == null) {
      return 0;
    }
    if (buffer.isBackedByMemory()) {
      return 0;
    }
    final int size=buffer.size();
    final Buffer memBuffer=bufferProvider.requestEmptyBuffer(size);
    if (memBuffer == null) {
      return 0;
    }
    buffer.copyToBuffer(memBuffer);
    this.bufferRef=memBuffer;
    buffer.recycleBuffer();
    return size;
  }
  @SuppressWarnings("String_Node_Str") final Queue<Object> bufferQueue=(Queue<Object>)this.bufferRef;
  final int queueSize=bufferQueue.size();
  int usedMemory=0;
  int count=0;
  while (count++ < queueSize) {
    final Object obj=bufferQueue.poll();
    if (obj == NULL_OBJECT) {
      bufferQueue.add(obj);
      continue;
    }
    final Buffer buffer=(Buffer)obj;
    if (buffer.isBackedByMemory()) {
      bufferQueue.add(buffer);
      continue;
    }
    final int size=buffer.size();
    final Buffer memBuffer=bufferProvider.requestEmptyBuffer(size);
    if (memBuffer != null) {
      buffer.copyToBuffer(memBuffer);
      bufferQueue.add(memBuffer);
      buffer.recycleBuffer();
    }
 else {
      bufferQueue.add(buffer);
      return usedMemory;
    }
    usedMemory+=size;
  }
  return usedMemory;
}

Fixed version (ground truth):
int unspill(final BufferProvider bufferProvider) throws IOException {
  if (this.headSequenceNumber == -1) {
    return 0;
  }
  if (this.headSequenceNumber == this.tailSequenceNumber) {
    final Buffer buffer=(Buffer)this.bufferRef;
    if (buffer == null) {
      return 0;
    }
    if (buffer.isBackedByMemory()) {
      return 0;
    }
    final int size=buffer.size();
    final Buffer memBuffer=bufferProvider.requestEmptyBuffer(size);
    if (memBuffer == null) {
      return 0;
    }
    buffer.copyToBuffer(memBuffer);
    this.bufferRef=memBuffer;
    buffer.recycleBuffer();
    return size;
  }
  @SuppressWarnings("String_Node_Str") final Queue<Object> bufferQueue=(Queue<Object>)this.bufferRef;
  final int queueSize=bufferQueue.size();
  int usedMemory=0;
  int count=0;
  while (count++ < queueSize) {
    final Object obj=bufferQueue.poll();
    if (obj == NULL_OBJECT) {
      bufferQueue.add(obj);
      continue;
    }
    final Buffer buffer=(Buffer)obj;
    if (buffer.isBackedByMemory()) {
      bufferQueue.add(buffer);
      continue;
    }
    final int size=buffer.size();
    final Buffer memBuffer=bufferProvider.requestEmptyBuffer(size);
    if (memBuffer != null) {
      buffer.copyToBuffer(memBuffer);
      bufferQueue.add(memBuffer);
      buffer.recycleBuffer();
    }
 else {
      bufferQueue.add(buffer);
      continue;
    }
    usedMemory+=size;
  }
  return usedMemory;
}
Program: 55790
Project: 55790
Buggy source:
protected ThreadBase getReadingThread(ExceptionHandler<IOException> exceptionHandler,MutableObjectIterator<PactRecord> reader,CircularQueues queues,AbstractTask parentTask,long startSpillingBytes){
  this.collector=new InputDataCollector(queues,startSpillingBytes);
  return new DummyThread(exceptionHandler,queues,parentTask);
}

Fixed version (ground truth):
@Override protected ThreadBase getReadingThread(ExceptionHandler<IOException> exceptionHandler,MutableObjectIterator<PactRecord> reader,CircularQueues queues,AbstractInvokable parentTask,long startSpillingBytes){
  this.collector=new InputDataCollector(queues,startSpillingBytes);
  return new DummyThread(exceptionHandler,queues,parentTask);
}
Program: 55792
Project: 55792
Buggy source:
private CombinerThread(AsynchronousPartialSorterCollector sorter,int[] keyPositions,Class<? extends Key>[] keyClasses,ReduceStub stub,Collector output){
  super("String_Node_Str");
  setDaemon(true);
  this.sorter=sorter;
  this.keyPositions=keyPositions;
  this.keyClasses=keyClasses;
  this.stub=stub;
  this.output=output;
}

Fixed version (ground truth):
private CombinerThread(AsynchronousPartialSorterCollector sorter,int[] keyPositions,Class<? extends Key>[] keyClasses,ReduceStub stub,Collector output){
  super("String_Node_Str");
  setDaemon(true);
  this.sorter=sorter;
  this.keyPositions=keyPositions;
  this.keyClasses=keyClasses;
  this.stub=stub;
  this.output=output;
  this.running=true;
}
Program: 55793
Project: 55793
Buggy source:
@SuppressWarnings("String_Node_Str") private final <K extends Key,V extends Value>RecordReader<KeyValuePair<K,V>> getReader1(){
  return (RecordReader<KeyValuePair<K,V>>)this.reader1;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private final <K extends Key,V extends Value>Reader<KeyValuePair<K,V>> getReader1(){
  return (Reader<KeyValuePair<K,V>>)this.reader1;
}
Program: 55794
Project: 55794
Buggy source:
@SuppressWarnings("String_Node_Str") private final <K extends Key,V extends Value>RecordReader<KeyValuePair<K,V>> getReader2(){
  return (RecordReader<KeyValuePair<K,V>>)this.reader2;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private final <K extends Key,V extends Value>Reader<KeyValuePair<K,V>> getReader2(){
  return (Reader<KeyValuePair<K,V>>)this.reader2;
}
Program: 55796
Project: 55796
Buggy source:
void shareInstancesWith(final ExecutionGroupVertex groupVertex) throws GraphConversionException {
  if (userDefinedVertexToShareInstancesWith && this.vertexToShareInstancesWith != null) {
    throw new GraphConversionException("String_Node_Str");
  }
  if (groupVertex == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  final ExecutionGroupVertex oldVertex=this.vertexToShareInstancesWith.getAndSet(groupVertex);
  if (oldVertex != null) {
    oldVertex.removeFromVerticesSharingInstances(this);
  }
  groupVertex.addToVerticesSharingInstances(this);
  reassignInstances();
  this.executionGraph.repairInstanceAssignment();
}

Fixed version (ground truth):
void shareInstancesWith(final ExecutionGroupVertex groupVertex) throws GraphConversionException {
  if (userDefinedVertexToShareInstancesWith && this.vertexToShareInstancesWith.get() != null) {
    throw new GraphConversionException("String_Node_Str");
  }
  if (groupVertex == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  final ExecutionGroupVertex oldVertex=this.vertexToShareInstancesWith.getAndSet(groupVertex);
  if (oldVertex != null) {
    oldVertex.removeFromVerticesSharingInstances(this);
  }
  groupVertex.addToVerticesSharingInstances(this);
  reassignInstances();
  this.executionGraph.repairInstanceAssignment();
}
Program: 55797
Project: 55797
Buggy source:
private List<AllocatedResource> collectAvailableResources(){
  List<AllocatedResource> availableResources;
  if (this.vertexToShareInstancesWith != null) {
    availableResources=this.vertexToShareInstancesWith.get().collectAvailableResources();
  }
 else {
    availableResources=new ArrayList<AllocatedResource>();
synchronized (this.groupMembers) {
      final Iterator<ExecutionVertex> it=this.groupMembers.iterator();
      while (it.hasNext()) {
        final ExecutionVertex vertex=it.next();
        final AllocatedResource allocatedResource=vertex.getAllocatedResource();
        if (allocatedResource != null) {
          if (!availableResources.contains(allocatedResource)) {
            availableResources.add(allocatedResource);
          }
        }
      }
    }
  }
  return availableResources;
}

Fixed version (ground truth):
private List<AllocatedResource> collectAvailableResources(){
  List<AllocatedResource> availableResources;
  if (this.vertexToShareInstancesWith.get() != null) {
    availableResources=this.vertexToShareInstancesWith.get().collectAvailableResources();
  }
 else {
    availableResources=new ArrayList<AllocatedResource>();
synchronized (this.groupMembers) {
      final Iterator<ExecutionVertex> it=this.groupMembers.iterator();
      while (it.hasNext()) {
        final ExecutionVertex vertex=it.next();
        final AllocatedResource allocatedResource=vertex.getAllocatedResource();
        if (allocatedResource != null) {
          if (!availableResources.contains(allocatedResource)) {
            availableResources.add(allocatedResource);
          }
        }
      }
    }
  }
  return availableResources;
}
Program: 55798
Project: 55798
Buggy source:
/** 
 * This method step over all inputs recursively and combines all alternatives per input with all other alternative of all other inputs.
 * @param inPlans		all alternative plans for all incoming connections (which are unioned)
 * @param predList		list of currently chosen alternative plans (has one entry for each incoming connection)[this list is build up recursively within the method]
 * @param estimator		the cost estimator
 * @param alternativeSubPlans	all generated alternative for this node
 */
@SuppressWarnings("String_Node_Str") final protected void getAlternativeSubPlanCombinationsRecursively(List<? extends OptimizerNode>[] inPlans,ArrayList<OptimizerNode> predList,List<List<OptimizerNode>> alternativeSubPlans){
  final int inputNumberToProcess=predList.size();
  final int numberOfAlternatives=inPlans[inputNumberToProcess].size();
  for (int i=0; i < numberOfAlternatives; ++i) {
    predList.add(inPlans[inputNumberToProcess].get(i));
    if (inputNumberToProcess + 1 == inPlans.length) {
      alternativeSubPlans.add(predList);
      predList=(ArrayList<OptimizerNode>)predList.clone();
    }
 else {
      getAlternativeSubPlanCombinationsRecursively(inPlans,predList,alternativeSubPlans);
    }
    predList.remove(inputNumberToProcess);
  }
}

Fixed version (ground truth):
/** 
 * This method step over all inputs recursively and combines all alternatives per input with all other alternative of all other inputs.
 * @param inPlans		all alternative plans for all incoming connections (which are unioned)
 * @param predList		list of currently chosen alternative plans (has one entry for each incoming connection)[this list is build up recursively within the method]
 * @param estimator		the cost estimator
 * @param alternativeSubPlans	all generated alternative for this node
 */
@SuppressWarnings("String_Node_Str") final protected void getAlternativeSubPlanCombinationsRecursively(List<? extends OptimizerNode>[] inPlans,ArrayList<OptimizerNode> predList,List<List<OptimizerNode>> alternativeSubPlans){
  final int inputNumberToProcess=predList.size();
  final int numberOfAlternatives=inPlans[inputNumberToProcess].size();
  for (int i=0; i < numberOfAlternatives; ++i) {
    predList.add(inPlans[inputNumberToProcess].get(i));
    if (inputNumberToProcess + 1 == inPlans.length) {
      alternativeSubPlans.add((ArrayList<OptimizerNode>)predList.clone());
    }
 else {
      getAlternativeSubPlanCombinationsRecursively(inPlans,predList,alternativeSubPlans);
    }
    predList.remove(inputNumberToProcess);
  }
}
Program: 55800
Project: 55800
Buggy source:
/** 
 * Implements the join between LineItem and Order table on the  order key. WHERE l_orderkey = o_orderkey Output Schema - 0:ORDERKEY, 1:SHIPPRIORITY, 2:EXTENDEDPRICE
 */
@Override public void match(PactRecord first,PactRecord second,Collector out){
  first.unionFields(second);
  out.collect(first);
}

Fixed version (ground truth):
/** 
 * Implements the join between LineItem and Order table on the  order key. WHERE l_orderkey = o_orderkey Output Schema - 0:ORDERKEY, 1:SHIPPRIORITY, 2:EXTENDEDPRICE
 */
@Override public void match(PactRecord first,PactRecord second,Collector out){
  first.setField(1,second.getField(1,PactString.class));
  out.collect(first);
}
Program: 55802
Project: 55802
Buggy source:
@Override public int serializeRecord(PactRecord rec,byte[] target) throws Exception {
  Tuple tuple=rec.getField(0,Tuple.class);
  String tupleStr=tuple.toString();
  byte[] tupleBytes=tupleStr.getBytes();
  if (target.length >= tupleBytes.length) {
    System.arraycopy(tupleBytes,0,target,0,tupleBytes.length);
    return tupleBytes.length;
  }
 else {
    return -1 * tupleBytes.length;
  }
}

Fixed version (ground truth):
@Override public int serializeRecord(PactRecord rec,byte[] target) throws Exception {
  String string=rec.getField(0,PactString.class).toString();
  byte[] stringBytes=string.getBytes();
  Tuple tuple=rec.getField(1,Tuple.class);
  String tupleStr=tuple.toString();
  byte[] tupleBytes=tupleStr.getBytes();
  int totalLength=stringBytes.length + 1 + tupleBytes.length;
  if (target.length >= totalLength) {
    System.arraycopy(stringBytes,0,target,0,stringBytes.length);
    target[stringBytes.length]='|';
    System.arraycopy(tupleBytes,0,target,stringBytes.length + 1,tupleBytes.length);
    return totalLength;
  }
 else {
    return -1 * totalLength;
  }
}
Program: 55803
Project: 55803
Buggy source:
public void setContents(byte[] bytes,int offset,int len,char delimiter){
  if (this.bytes == null || this.bytes.length < len) {
    this.bytes=new byte[len];
  }
  System.arraycopy(bytes,offset,this.bytes,0,len);
  int readPos=offset;
  if (this.offsets == null) {
    this.offsets=new short[4];
  }
  int col=1;
  int startPos=readPos;
  while (readPos < offset + len) {
    if (bytes[readPos++] == delimiter) {
      if (offsets.length <= col) {
        this.offsets=new short[this.offsets.length * 2];
      }
      this.offsets[col++]=(short)(readPos - startPos);
    }
  }
  this.numCols=col - 1;
}

Fixed version (ground truth):
public void setContents(byte[] bytes,int offset,int len,char delimiter){
  if (this.bytes == null || this.bytes.length < len) {
    this.bytes=new byte[len];
  }
  System.arraycopy(bytes,offset,this.bytes,0,len);
  int readPos=offset;
  if (this.offsets == null) {
    this.offsets=new short[4];
  }
  int col=1;
  int startPos=readPos;
  while (readPos < offset + len) {
    if (bytes[readPos++] == delimiter) {
      if (offsets.length <= col) {
        short newOffsets[]=new short[this.offsets.length * 2];
        System.arraycopy(this.offsets,0,newOffsets,0,this.offsets.length);
        this.offsets=newOffsets;
      }
      this.offsets[col++]=(short)(readPos - startPos);
    }
  }
  this.numCols=col - 1;
}
Program: 55804
Project: 55804
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override protected int getTimeout(){
  return 30000;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override protected int getTimeout(){
  return 30;
}
Program: 55805
Project: 55805
Buggy source:
@Override public void reduce(Iterator<PactRecord> records,Collector out) throws Exception {
  long count=0;
  PactRecord rec=null;
  while (records.hasNext()) {
    rec=records.next();
    count++;
  }
  if (rec != null) {
    Tuple tuple=rec.getField(1,Tuple.class);
    tuple.addAttribute("String_Node_Str" + count);
    rec.setField(1,tuple);
  }
  out.collect(rec);
}

Fixed version (ground truth):
@Override public void reduce(Iterator<PactRecord> records,Collector out) throws Exception {
  long count=0;
  PactRecord rec=null;
  while (records.hasNext()) {
    rec=records.next();
    count++;
  }
  if (rec != null) {
    Tuple tuple=new Tuple();
    tuple.addAttribute("String_Node_Str" + count);
    rec.setField(1,tuple);
  }
  out.collect(rec);
}
Program: 55806
Project: 55806
Buggy source:
/** 
 * Join together parts and orderedParts by matching partkey and suppkey. Output Schema: Key: suppkey Value: (amount, year)
 */
@Override public void match(PactRecord value1,PactRecord value2,Collector out) throws Exception {
  value1.getField(0,partAndSupplierKey);
  value1.getField(1,supplyCostStr);
  value2.getField(1,ordersValue);
  PactInteger year=new PactInteger(Integer.parseInt(ordersValue.getStringValueAt(0)));
  float quantity=Float.parseFloat(ordersValue.getStringValueAt(1));
  float price=Float.parseFloat(ordersValue.getStringValueAt(2));
  float supplyCost=Float.parseFloat(supplyCostStr.toString());
  float amount=price - supplyCost * quantity;
  value1.setField(0,partAndSupplierKey);
  value1.setField(1,new StringIntPair(new PactString("String_Node_Str" + amount),year));
  out.collect(value1);
}

Fixed version (ground truth):
/** 
 * Join together parts and orderedParts by matching partkey and suppkey. Output Schema: Key: suppkey Value: (amount, year)
 */
@Override public void match(PactRecord value1,PactRecord value2,Collector out) throws Exception {
  value1.getField(0,partAndSupplierKey);
  value1.getField(1,supplyCostStr);
  value2.getField(1,ordersValue);
  PactInteger year=new PactInteger(Integer.parseInt(ordersValue.getStringValueAt(0)));
  float quantity=Float.parseFloat(ordersValue.getStringValueAt(1));
  float price=Float.parseFloat(ordersValue.getStringValueAt(2));
  float supplyCost=Float.parseFloat(supplyCostStr.toString());
  float amount=price - supplyCost * quantity;
  value1.setField(0,partAndSupplierKey.getSecond());
  value1.setField(1,new StringIntPair(new PactString("String_Node_Str" + amount),year));
  out.collect(value1);
}
Program: 55807
Project: 55807
Buggy source:
/** 
 * Project "partsupp". Output Schema: Key: partkey Value: (suppkey, supplycost)
 */
@Override public void map(PactRecord record,Collector out) throws Exception {
  record.getField(1,inputTuple);
  inputTuple.project((0 << 0) | (1 << 1) | (0 << 2)| (1 << 3)| (0 << 4));
  out.collect(record);
}

Fixed version (ground truth):
/** 
 * Project "partsupp". Output Schema: Key: partkey Value: (suppkey, supplycost)
 */
@Override public void map(PactRecord record,Collector out) throws Exception {
  record.getField(1,inputTuple);
  inputTuple.project((0 << 0) | (1 << 1) | (0 << 2)| (1 << 3)| (0 << 4));
  record.setField(1,inputTuple);
  out.collect(record);
}
Program: 55808
Project: 55808
Buggy source:
/** 
 * Project "supplier". Output Schema: Key: nationkey Value: suppkey
 */
@Override public void map(PactRecord record,Collector out) throws Exception {
  record.getField(0,suppKey);
  record.getField(1,inputTuple);
  PactInteger nationKey=new PactInteger(Integer.parseInt(inputTuple.getStringValueAt(3)));
  record.setField(0,nationKey);
  record.setField(1,suppKey);
}

Fixed version (ground truth):
/** 
 * Project "supplier". Output Schema: Key: nationkey Value: suppkey
 */
@Override public void map(PactRecord record,Collector out) throws Exception {
  record.getField(0,suppKey);
  record.getField(1,inputTuple);
  PactInteger nationKey=new PactInteger(Integer.parseInt(inputTuple.getStringValueAt(3)));
  record.setField(0,nationKey);
  record.setField(1,suppKey);
  out.collect(record);
}
Program: 55809
Project: 55809
Buggy source:
@Override public void writeRecord(PactRecord record) throws IOException {
  int numFields=record.getNumFields();
  for (int i=0; i < numFields; i++) {
    buffer.append(record.getField(0,PactString.class).getValue());
    char delim=(i == numFields - 1) ? '\n' : '|';
    buffer.append(delim);
  }
  byte[] bytes=this.buffer.toString().getBytes();
  this.stream.write(bytes);
}

Fixed version (ground truth):
@Override public void writeRecord(PactRecord record) throws IOException {
  buffer.setLength(0);
  buffer.append(record.getField(1,PactInteger.class).toString());
  buffer.append('|');
  buffer.append(record.getField(0,PactString.class).toString());
  buffer.append('|');
  buffer.append(record.getField(2,PactInteger.class).toString());
  buffer.append('|');
  buffer.append('\n');
  byte[] bytes=this.buffer.toString().getBytes();
  this.stream.write(bytes);
}
Program: 55811
Project: 55811
Buggy source:
/** 
 * @param target
 */
public void copyTo(PactRecord target){
  updateBinaryRepresenation();
  if (target.binaryData == null || target.binaryData.length < this.binaryLen) {
    target.binaryData=new byte[this.binaryLen];
  }
  if (target.offsets == null || target.offsets.length < this.numFields) {
    target.offsets=new int[this.numFields];
  }
  if (target.lengths == null || target.lengths.length < this.numFields) {
    target.lengths=new int[this.numFields];
  }
  if (target.fields == null || target.fields.length < this.numFields) {
    target.fields=new Value[this.numFields];
  }
  System.arraycopy(this.binaryData,0,target.binaryData,0,this.binaryLen);
  System.arraycopy(this.offsets,0,target.offsets,0,this.numFields);
  System.arraycopy(this.lengths,0,target.lengths,0,this.numFields);
  target.binaryLen=this.binaryLen;
  target.numFields=this.numFields;
  target.firstModifiedPos=Integer.MAX_VALUE;
  target.lastUnmodifiedPos=this.numFields - 1;
}

Fixed version (ground truth):
/** 
 * @param target
 */
public void copyTo(PactRecord target){
  updateBinaryRepresenation();
  if (target.binaryData == null || target.binaryData.length < this.binaryLen) {
    target.binaryData=new byte[this.binaryLen];
  }
  if (target.offsets == null || target.offsets.length < this.numFields) {
    target.offsets=new int[this.numFields];
  }
  if (target.lengths == null || target.lengths.length < this.numFields) {
    target.lengths=new int[this.numFields];
  }
  if (target.fields == null || target.fields.length < this.numFields) {
    target.fields=new Value[this.numFields];
  }
  System.arraycopy(this.binaryData,0,target.binaryData,0,this.binaryLen);
  System.arraycopy(this.offsets,0,target.offsets,0,this.numFields);
  System.arraycopy(this.lengths,0,target.lengths,0,this.numFields);
  target.binaryLen=this.binaryLen;
  target.numFields=this.numFields;
  target.firstModifiedPos=Integer.MAX_VALUE;
  target.modified=false;
}
Program: 55812
Project: 55812
Buggy source:
/** 
 * Sets the number of fields in the record. If the new number of fields is longer than the current number of fields, then null fields are appended. If the new number of fields is smaller than the current number of fields, then the last fields are truncated.
 * @param numFields The new number of fields.
 */
public void setNumFields(final int numFields){
  final int oldNumFields=this.numFields;
  if (numFields > oldNumFields) {
    makeSpace(numFields);
    for (int i=oldNumFields; i < numFields; i++) {
      this.offsets[i]=NULL_INDICATOR_OFFSET;
    }
  }
 else {
    if (this.lastUnmodifiedPos >= numFields)     this.lastUnmodifiedPos=numFields - 1;
    markModified(numFields);
  }
  this.numFields=numFields;
}

Fixed version (ground truth):
/** 
 * Sets the number of fields in the record. If the new number of fields is longer than the current number of fields, then null fields are appended. If the new number of fields is smaller than the current number of fields, then the last fields are truncated.
 * @param numFields The new number of fields.
 */
public void setNumFields(final int numFields){
  final int oldNumFields=this.numFields;
  if (numFields > oldNumFields) {
    makeSpace(numFields);
    for (int i=oldNumFields; i < numFields; i++) {
      this.offsets[i]=NULL_INDICATOR_OFFSET;
    }
  }
 else {
    markModified(numFields);
  }
  this.numFields=numFields;
}
Program: 55813
Project: 55813
Buggy source:
/** 
 * Clears the record. After this operation, the record will have zero fields.
 */
public void clear(){
  this.numFields=0;
  this.lastUnmodifiedPos=-1;
  this.firstModifiedPos=Integer.MAX_VALUE;
}

Fixed version (ground truth):
/** 
 * Clears the record. After this operation, the record will have zero fields.
 */
public void clear(){
  if (this.numFields > 0) {
    this.numFields=0;
    this.firstModifiedPos=Integer.MAX_VALUE;
    this.modified=true;
  }
}
Program: 55814
Project: 55814
Buggy source:
private final void markModified(int field){
  if (this.firstModifiedPos > field) {
    this.firstModifiedPos=field;
  }
  if (field == this.lastUnmodifiedPos) {
    this.lastUnmodifiedPos--;
  }
}

Fixed version (ground truth):
private final void markModified(int field){
  if (this.firstModifiedPos > field) {
    this.firstModifiedPos=field;
  }
  this.modified=true;
}
Program: 55817
Project: 55817
Buggy source:
private static final int readLengthIncludingLengthBytes(MemorySegment seg,List<MemorySegment> sources,int segmentNum,int segmentOffset){
  int lenBytes=1;
  if (seg.size() - segmentOffset > 5) {
    int val=seg.get(segmentOffset++) & 0xff;
    if (val >= MAX_BIT) {
      int shift=7;
      int curr;
      val=val & 0x7f;
      while ((curr=seg.get(segmentOffset++) & 0xff) >= MAX_BIT) {
        val|=(curr & 0x7f) << shift;
        shift+=7;
        lenBytes++;
      }
      val|=curr << shift;
    }
    return val + lenBytes;
  }
 else {
    int end=seg.size();
    int val=seg.get(segmentOffset++) & 0xff;
    if (segmentOffset == end) {
      segmentOffset=0;
      seg=sources.get(++segmentNum);
    }
    if (val >= MAX_BIT) {
      int shift=7;
      int curr;
      val=val & 0x7f;
      while ((curr=seg.get(segmentOffset++) & 0xff) >= MAX_BIT) {
        val|=(curr & 0x7f) << shift;
        shift+=7;
        lenBytes++;
        if (segmentOffset == end) {
          segmentOffset=0;
          seg=sources.get(++segmentNum);
        }
      }
      val|=curr << shift;
    }
    return val + lenBytes;
  }
}

Fixed version (ground truth):
private static final int readLengthIncludingLengthBytes(MemorySegment seg,List<MemorySegment> sources,int segmentNum,int segmentOffset){
  int lenBytes=1;
  if (seg.size() - segmentOffset > 5) {
    int val=seg.get(segmentOffset++) & 0xff;
    if (val >= MAX_BIT) {
      int shift=7;
      int curr;
      val=val & 0x7f;
      while ((curr=seg.get(segmentOffset++) & 0xff) >= MAX_BIT) {
        val|=(curr & 0x7f) << shift;
        shift+=7;
        lenBytes++;
      }
      val|=curr << shift;
      lenBytes++;
    }
    return val + lenBytes;
  }
 else {
    int end=seg.size();
    int val=seg.get(segmentOffset++) & 0xff;
    if (segmentOffset == end) {
      segmentOffset=0;
      seg=sources.get(++segmentNum);
    }
    if (val >= MAX_BIT) {
      int shift=7;
      int curr;
      val=val & 0x7f;
      while ((curr=seg.get(segmentOffset++) & 0xff) >= MAX_BIT) {
        val|=(curr & 0x7f) << shift;
        shift+=7;
        lenBytes++;
        if (segmentOffset == end) {
          segmentOffset=0;
          seg=sources.get(++segmentNum);
        }
      }
      val|=curr << shift;
    }
    return val + lenBytes;
  }
}
Program: 55818
Project: 55818
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void queueTransferEnvelope(final TransferEnvelope transferEnvelope){
  final int sequenceNumber=transferEnvelope.getSequenceNumber();
synchronized (this.queuedEnvelopes) {
    if (sequenceNumber <= this.lastReceivedEnvelope) {
      final Buffer buffer=transferEnvelope.getBuffer();
      if (buffer != null) {
        buffer.recycleBuffer();
      }
      return;
    }
    this.queuedEnvelopes.add(transferEnvelope);
    this.lastReceivedEnvelope=sequenceNumber;
  }
  this.byteBufferedInputChannel.checkForNetworkEvents();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void queueTransferEnvelope(final TransferEnvelope transferEnvelope){
  final int sequenceNumber=transferEnvelope.getSequenceNumber();
synchronized (this.queuedEnvelopes) {
    if (sequenceNumber != (this.lastReceivedEnvelope + 1)) {
      final Buffer buffer=transferEnvelope.getBuffer();
      if (buffer != null) {
        buffer.recycleBuffer();
      }
      return;
    }
    this.queuedEnvelopes.add(transferEnvelope);
    this.lastReceivedEnvelope=sequenceNumber;
  }
  this.byteBufferedInputChannel.checkForNetworkEvents();
}
Program: 55819
Project: 55819
Buggy source:
@Override public void copyNormalizedKey(byte[] target,int offset,int len){
  if (len == 4) {
    target[offset]=(byte)((value >>> 24) & 0xff);
    target[offset + 1]=(byte)((value >>> 16) & 0xff);
    target[offset + 2]=(byte)((value >>> 8) & 0xff);
    target[offset + 3]=(byte)((value) & 0xff);
  }
 else   if (len < 4) {
    for (int i=0; len > 0; len--, i++) {
      target[offset + i]=(byte)((value >>> ((3 - i) << 3)) & 0xff);
    }
  }
 else {
    target[offset]=(byte)((value >>> 24) & 0xff);
    target[offset + 1]=(byte)((value >>> 16) & 0xff);
    target[offset + 2]=(byte)((value >>> 8) & 0xff);
    target[offset + 3]=(byte)((value) & 0xff);
    for (int i=4; i < len; i++) {
      target[offset + i]=0;
    }
  }
}

Fixed version (ground truth):
@Override public void copyNormalizedKey(byte[] target,int offset,int len){
  if (len == 4) {
    int highByte=((value >>> 24) & 0xff);
    highByte-=Byte.MIN_VALUE;
    target[offset]=(byte)highByte;
    target[offset + 1]=(byte)((value >>> 16) & 0xff);
    target[offset + 2]=(byte)((value >>> 8) & 0xff);
    target[offset + 3]=(byte)((value) & 0xff);
  }
 else   if (len <= 0) {
  }
 else   if (len < 4) {
    int highByte=((value >>> 24) & 0xff);
    highByte-=Byte.MIN_VALUE;
    target[offset]=(byte)highByte;
    len--;
    for (int i=1; len > 0; len--, i++) {
      target[offset + i]=(byte)((value >>> ((3 - i) << 3)) & 0xff);
    }
  }
 else {
    int highByte=((value >>> 24) & 0xff);
    highByte-=Byte.MIN_VALUE;
    target[offset]=(byte)highByte;
    target[offset + 1]=(byte)((value >>> 16) & 0xff);
    target[offset + 2]=(byte)((value >>> 8) & 0xff);
    target[offset + 3]=(byte)((value) & 0xff);
    for (int i=4; i < len; i++) {
      target[offset + i]=0;
    }
  }
}
Program: 55820
Project: 55820
Buggy source:
@Override public void copyNormalizedKey(byte[] target,int offset,int len){
  if (len == 8) {
    target[offset]=(byte)(value >>> 56);
    target[offset + 1]=(byte)(value >>> 48);
    target[offset + 2]=(byte)(value >>> 40);
    target[offset + 3]=(byte)(value >>> 32);
    target[offset + 4]=(byte)(value >>> 24);
    target[offset + 5]=(byte)(value >>> 16);
    target[offset + 6]=(byte)(value >>> 8);
    target[offset + 7]=(byte)(value);
  }
 else   if (len < 8) {
    for (int i=0; len > 0; len--, i++) {
      target[offset + i]=(byte)(value >>> ((7 - i) << 3));
    }
  }
 else {
    target[offset]=(byte)(value >>> 56);
    target[offset + 1]=(byte)(value >>> 48);
    target[offset + 2]=(byte)(value >>> 40);
    target[offset + 3]=(byte)(value >>> 32);
    target[offset + 4]=(byte)(value >>> 24);
    target[offset + 5]=(byte)(value >>> 16);
    target[offset + 6]=(byte)(value >>> 8);
    target[offset + 7]=(byte)(value);
    for (int i=8; i < len; i++) {
      target[offset + i]=0;
    }
  }
}

Fixed version (ground truth):
@Override public void copyNormalizedKey(byte[] target,int offset,int len){
  if (len == 8) {
    long highByte=((value >>> 56) & 0xff);
    highByte-=Byte.MIN_VALUE;
    target[offset]=(byte)highByte;
    target[offset + 1]=(byte)(value >>> 48);
    target[offset + 2]=(byte)(value >>> 40);
    target[offset + 3]=(byte)(value >>> 32);
    target[offset + 4]=(byte)(value >>> 24);
    target[offset + 5]=(byte)(value >>> 16);
    target[offset + 6]=(byte)(value >>> 8);
    target[offset + 7]=(byte)(value);
  }
 else   if (len <= 0) {
  }
 else   if (len < 8) {
    long highByte=((value >>> 56) & 0xff);
    highByte-=Byte.MIN_VALUE;
    target[offset]=(byte)highByte;
    len--;
    for (int i=1; len > 0; len--, i++) {
      target[offset + i]=(byte)(value >>> ((7 - i) << 3));
    }
  }
 else {
    long highByte=((value >>> 56) & 0xff);
    highByte-=Byte.MIN_VALUE;
    target[offset]=(byte)highByte;
    target[offset + 1]=(byte)(value >>> 48);
    target[offset + 2]=(byte)(value >>> 40);
    target[offset + 3]=(byte)(value >>> 32);
    target[offset + 4]=(byte)(value >>> 24);
    target[offset + 5]=(byte)(value >>> 16);
    target[offset + 6]=(byte)(value >>> 8);
    target[offset + 7]=(byte)(value);
    for (int i=8; i < len; i++) {
      target[offset + i]=0;
    }
  }
}
Program: 55821
Project: 55821
Buggy source:
/** 
 * Returns this PactString's internal character data.
 * @return The character data.
 */
public char[] getChars(){
  return this.value;
}

Fixed version (ground truth):
/** 
 * Returns this PactString's internal character data. The array might be larger than the string which is currently stored in the PactString.
 * @return The character data.
 */
public char[] getChars(){
  return this.value;
}
Program: 55822
Project: 55822
Buggy source:
@Override public char charAt(int index){
  return this.value[index];
}

Fixed version (ground truth):
@Override public char charAt(int index){
  if (index < len) {
    return this.value[index];
  }
 else {
    throw new IndexOutOfBoundsException();
  }
}
Program: 55823
Project: 55823
Buggy source:
@Test public void testPactNull(){
  final PactNull pn1=new PactNull();
  final PactNull pn2=new PactNull();
  assertNormalizableKey(pn1,pn2,0);
  final PactNull pn=new PactNull();
  try {
    pn.write(mOut);
    pn.read(mIn);
    assertNormalizableKey(pn,pn1,0);
  }
 catch (  IOException ioex) {
    Assert.fail("String_Node_Str" + ioex.getMessage());
  }
}

Fixed version (ground truth):
@Test public void testPactNull(){
  final PactNull pn1=new PactNull();
  final PactNull pn2=new PactNull();
  assertNormalizableKey(pn1,pn2,0);
}