nus-yam/ex-repair huggingface dataset:
Program: 113107
Project: 113107
Buggy source:
@Override protected void reduce(final ComparisonCellData key,final Iterable<LongWritable> values,final Context context) throws IOException, InterruptedException {
  for (  final LongWritable v : values) {
    final long cellIndex=v.get() / numLevels;
    final Point2d[] bbox=fromIndexToLL_UR(cellIndex);
    builder.add(GeometryUtils.GEOMETRY_FACTORY.toGeometry(new Envelope(bbox[0].x,bbox[1].x,bbox[0].y,bbox[1].y)));
    builder.add(key.getSummerPercentile());
    builder.add(key.getWinterPercentile());
    builder.add(key.getCombinedPercentile());
    inc+=(1.0 / totalKeys);
    builder.add(inc);
    final SimpleFeature feature=builder.buildFeature(new Long(cellIndex).toString());
    dataStore.ingest(adapter,index,feature);
  }
}

Fixed version (ground truth):
@Override protected void reduce(final ComparisonCellData key,final Iterable<LongWritable> values,final Context context) throws IOException, InterruptedException {
  for (  final LongWritable v : values) {
    final long cellIndex=v.get() / numLevels;
    final Point2d[] bbox=fromIndexToLL_UR(cellIndex);
    builder.add(GeometryUtils.GEOMETRY_FACTORY.toGeometry(new Envelope(bbox[0].x,bbox[1].x,bbox[0].y,bbox[1].y)));
    builder.add(key.getSummerPercentile());
    builder.add(key.getWinterPercentile());
    builder.add(key.getCombinedPercentile());
    inc+=(1.0 / totalKeys);
    builder.add(inc);
    final SimpleFeature feature=builder.buildFeature(Long.toString(cellIndex));
    dataStore.ingest(adapter,index,feature);
  }
}
Program: 113108
Project: 113108
Buggy source:
@Override protected void collectStats(final LongWritable key,final double sum,final org.apache.hadoop.mapreduce.Reducer.Context context){
  long positiveKey=key.get();
  boolean isWinter=false;
  if (positiveKey < 0) {
    positiveKey=-positiveKey - 1;
    isWinter=true;
  }
  final long level=(positiveKey % numLevels) + minLevel;
  context.getCounter("String_Node_Str" + (isWinter ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str","String_Node_Str" + new Long(level).toString()).increment(1);
}

Fixed version (ground truth):
@Override protected void collectStats(final LongWritable key,final double sum,final org.apache.hadoop.mapreduce.Reducer.Context context){
  long positiveKey=key.get();
  boolean isWinter=false;
  if (positiveKey < 0) {
    positiveKey=-positiveKey - 1;
    isWinter=true;
  }
  final long level=(positiveKey % numLevels) + minLevel;
  context.getCounter("String_Node_Str" + (isWinter ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str","String_Node_Str" + Long.toString(level)).increment(1);
}
Program: 113109
Project: 113109
Buggy source:
protected void collectStats(final long key,final Context context){
  final long level=(key % numLevels) + minLevel;
  context.getCounter("String_Node_Str","String_Node_Str" + new Long(level).toString()).increment(1);
}

Fixed version (ground truth):
protected void collectStats(final long key,final Context context){
  final long level=(key % numLevels) + minLevel;
  context.getCounter("String_Node_Str","String_Node_Str" + Long.toString(level)).increment(1);
}
Program: 113110
Project: 113110
Buggy source:
private static Object convertTrueFalseStringToBoolean(Object obj){
  if (!(obj instanceof Number) && !(obj instanceof Boolean)) {
    if (obj.toString().trim().toLowerCase().equals("String_Node_Str")) {
      obj=new Boolean(true);
    }
 else     if (obj.toString().trim().toLowerCase().equals("String_Node_Str")) {
      obj=new Boolean(false);
    }
  }
  return obj;
}

Fixed version (ground truth):
private static Object convertTrueFalseStringToBoolean(Object obj){
  if (!(obj instanceof Number) && !(obj instanceof Boolean)) {
    if (obj.toString().trim().toLowerCase().equals("String_Node_Str")) {
      obj=Boolean.TRUE;
    }
 else     if (obj.toString().trim().toLowerCase().equals("String_Node_Str")) {
      obj=Boolean.FALSE;
    }
  }
  return obj;
}
Program: 113111
Project: 113111
Buggy source:
@Override public boolean equals(final Object obj){
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (getClass() != obj.getClass()) {
    return false;
  }
  final ByteArrayId other=(ByteArrayId)obj;
  if (!Arrays.equals(id,other.id)) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean equals(final Object obj){
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (getClass() != obj.getClass()) {
    return false;
  }
  final ByteArrayId other=(ByteArrayId)obj;
  return Arrays.equals(id,other.id);
}
Program: 113112
Project: 113112
Buggy source:
@Override public BinRange[] getNormalizedRanges(final NumericData range){
  final Calendar startEpoch=Calendar.getInstance(TimeZone.getTimeZone(timezone));
  final long binSizeMillis=getBinSizeMillis();
  startEpoch.setTimeInMillis((long)range.getMin());
  setToEpoch(startEpoch);
  final long startEpochMillis=startEpoch.getTimeInMillis();
  long epochIterator=startEpochMillis;
  final List<BinRange> bins=new ArrayList<BinRange>();
  boolean firstBin=((long)range.getMin() != startEpochMillis);
  boolean lastBin=false;
  do {
    final Calendar nextEpochCal=Calendar.getInstance(TimeZone.getTimeZone(timezone));
    nextEpochCal.setTimeInMillis(epochIterator + (long)(binSizeMillis * 1.5));
    setToEpoch(nextEpochCal);
    final long nextEpoch=nextEpochCal.getTimeInMillis();
    final long maxOfBin=nextEpoch - 1;
    final Calendar cal=Calendar.getInstance(TimeZone.getTimeZone(timezone));
    cal.setTimeInMillis(epochIterator);
    long startMillis, endMillis;
    boolean fullExtent;
    if ((long)range.getMax() <= maxOfBin) {
      lastBin=true;
      endMillis=(long)range.getMax();
      fullExtent=range.getMax() == maxOfBin;
    }
 else {
      endMillis=maxOfBin;
      fullExtent=!firstBin;
    }
    if (firstBin) {
      startMillis=(long)range.getMin();
      firstBin=false;
    }
 else {
      startMillis=epochIterator;
    }
    bins.add(new BinRange(getBinId(cal),startMillis - epochIterator,endMillis - epochIterator,fullExtent));
    epochIterator=nextEpoch;
  }
 while (!lastBin);
  return bins.toArray(new BinRange[]{});
}

Fixed version (ground truth):
@Override public BinRange[] getNormalizedRanges(final NumericData range){
  final Calendar startEpoch=Calendar.getInstance(TimeZone.getTimeZone(timezone));
  final long binSizeMillis=getBinSizeMillis();
  startEpoch.setTimeInMillis((long)range.getMin());
  setToEpoch(startEpoch);
  final long startEpochMillis=startEpoch.getTimeInMillis();
  long epochIterator=startEpochMillis;
  final List<BinRange> bins=new ArrayList<BinRange>();
  boolean firstBin=((long)range.getMin() != startEpochMillis);
  boolean lastBin=false;
  do {
    final Calendar nextEpochCal=Calendar.getInstance(TimeZone.getTimeZone(timezone));
    nextEpochCal.setTimeInMillis(epochIterator + (long)(binSizeMillis * 1.5));
    setToEpoch(nextEpochCal);
    final long nextEpoch=nextEpochCal.getTimeInMillis();
    final long maxOfBin=nextEpoch - 1;
    final Calendar cal=Calendar.getInstance(TimeZone.getTimeZone(timezone));
    cal.setTimeInMillis(epochIterator);
    long startMillis, endMillis;
    boolean fullExtent;
    if ((long)range.getMax() <= maxOfBin) {
      lastBin=true;
      endMillis=(long)range.getMax();
      fullExtent=range.getMax() == maxOfBin;
    }
 else {
      endMillis=maxOfBin;
      fullExtent=!firstBin;
    }
    if (firstBin) {
      startMillis=(long)range.getMin();
      firstBin=false;
    }
 else {
      startMillis=epochIterator;
    }
    bins.add(new BinRange(getBinId(cal),startMillis - epochIterator,endMillis - epochIterator,fullExtent));
    epochIterator=nextEpoch;
  }
 while (!lastBin);
  return bins.toArray(new BinRange[bins.size()]);
}
Program: 113113
Project: 113113
Buggy source:
@Override public boolean equals(final Object obj){
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (getClass() != obj.getClass()) {
    return false;
  }
  final TieredSFCIndexStrategy other=(TieredSFCIndexStrategy)obj;
  if (!Arrays.equals(baseDefinitions,other.baseDefinitions)) {
    return false;
  }
  if (!Arrays.equals(orderedSfcs,other.orderedSfcs)) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean equals(final Object obj){
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (getClass() != obj.getClass()) {
    return false;
  }
  final TieredSFCIndexStrategy other=(TieredSFCIndexStrategy)obj;
  if (!Arrays.equals(baseDefinitions,other.baseDefinitions)) {
    return false;
  }
  return Arrays.equals(orderedSfcs,other.orderedSfcs);
}
Program: 113114
Project: 113114
Buggy source:
@Test public void testTimeDefinitionMinBinByMonth(){
  final double expectedMin=0.0;
  final double expectedMax=2678399999.0;
  final Calendar calendar=Calendar.getInstance();
  calendar.set(Calendar.MONTH,6);
  calendar.set(Calendar.DATE,1);
  calendar.set(Calendar.HOUR_OF_DAY,00);
  calendar.set(Calendar.MINUTE,00);
  calendar.set(Calendar.SECOND,0);
  calendar.set(Calendar.MILLISECOND,000);
  BinningStrategy bin=getStrategyByUnit(Unit.MONTH);
  Assert.assertEquals(expectedMin,bin.getBinMin(),DELTA);
  Assert.assertEquals(expectedMax,bin.getBinMax(),DELTA);
  Assert.assertEquals(bin.getBinMin(),bin.getBinnedValue(calendar.getTimeInMillis()).getNormalizedValue(),DELTA);
}

Fixed version (ground truth):
@Test public void testTimeDefinitionMinBinByMonth(){
  final double expectedMin=0.0;
  final double expectedMax=2678399999.0;
  final Calendar calendar=Calendar.getInstance();
  calendar.set(Calendar.MONTH,6);
  calendar.set(Calendar.DATE,1);
  calendar.set(Calendar.HOUR_OF_DAY,0);
  calendar.set(Calendar.MINUTE,0);
  calendar.set(Calendar.SECOND,0);
  calendar.set(Calendar.MILLISECOND,0);
  BinningStrategy bin=getStrategyByUnit(Unit.MONTH);
  Assert.assertEquals(expectedMin,bin.getBinMin(),DELTA);
  Assert.assertEquals(expectedMax,bin.getBinMax(),DELTA);
  Assert.assertEquals(bin.getBinMin(),bin.getBinnedValue(calendar.getTimeInMillis()).getNormalizedValue(),DELTA);
}
Program: 113115
Project: 113115
Buggy source:
@Override public Mutation next(){
  boolean ignoreLastEntry=false;
  if (!pendingOutput.isEmpty()) {
    return pendingOutput.removeFirst();
  }
 else   if (rawIt.hasNext()) {
    while (rawIt.hasNext()) {
      Entry<Key,Value> entry=rawIt.next();
      addEntry(lastEntries,entry);
      byte[] currentRowID=entry.getKey().getRow().getBytes();
      if (rowID == null || Arrays.equals(rowID,currentRowID)) {
        rowID=currentRowID;
        continue;
      }
 else {
        rowID=currentRowID;
        ignoreLastEntry=true;
        break;
      }
    }
  }
  int countDown=lastEntries.size();
  Iterator<Entry<Key,Value>> it=lastEntries.iterator();
  while (it.hasNext()) {
    Entry<Key,Value> lastEntry=it.next();
    countDown--;
    if (ignoreLastEntry && countDown == 0)     break;
    Mutation mutation=new Mutation(lastEntry.getKey().getRow());
    if (lastEntry.getKey().isDeleted()) {
      mutation.putDelete(lastEntry.getKey().getColumnFamily(),lastEntry.getKey().getColumnQualifier(),lastEntry.getKey().getColumnVisibilityParsed(),lastEntry.getKey().getTimestamp());
    }
 else {
      mutation.put(lastEntry.getKey().getColumnFamily(),lastEntry.getKey().getColumnQualifier(),lastEntry.getKey().getColumnVisibilityParsed(),lastEntry.getValue());
    }
    pendingOutput.addLast(mutation);
    it.remove();
  }
  return pendingOutput.removeFirst();
}

Fixed version (ground truth):
@Override public Mutation next(){
  boolean ignoreLastEntry=false;
  if (!pendingOutput.isEmpty()) {
    return pendingOutput.removeFirst();
  }
 else   if (rawIt.hasNext()) {
    while (rawIt.hasNext()) {
      Entry<Key,Value> entry=rawIt.next();
      addEntry(lastEntries,entry);
      byte[] currentRowID=entry.getKey().getRow().getBytes();
      if (rowID == null || Arrays.equals(rowID,currentRowID)) {
        rowID=currentRowID;
      }
 else {
        rowID=currentRowID;
        ignoreLastEntry=true;
        break;
      }
    }
  }
  int countDown=lastEntries.size();
  Iterator<Entry<Key,Value>> it=lastEntries.iterator();
  while (it.hasNext()) {
    Entry<Key,Value> lastEntry=it.next();
    countDown--;
    if (ignoreLastEntry && countDown == 0)     break;
    Mutation mutation=new Mutation(lastEntry.getKey().getRow());
    if (lastEntry.getKey().isDeleted()) {
      mutation.putDelete(lastEntry.getKey().getColumnFamily(),lastEntry.getKey().getColumnQualifier(),lastEntry.getKey().getColumnVisibilityParsed(),lastEntry.getKey().getTimestamp());
    }
 else {
      mutation.put(lastEntry.getKey().getColumnFamily(),lastEntry.getKey().getColumnQualifier(),lastEntry.getKey().getColumnVisibilityParsed(),lastEntry.getValue());
    }
    pendingOutput.addLast(mutation);
    it.remove();
  }
  return pendingOutput.removeFirst();
}
Program: 113118
Project: 113118
Buggy source:
private static DataAdapter<?>[] getDataAdaptersInternal(final Class<?> implementingClass,final Configuration configuration){
  final Map<String,String> input=configuration.getValByRegex(enumToConfKey(implementingClass,GeoWaveMetaStore.DATA_ADAPTER) + "String_Node_Str");
  if (input != null) {
    final List<DataAdapter<?>> adapters=new ArrayList<DataAdapter<?>>(input.size());
    for (    final String dataAdapterStr : input.values()) {
      final byte[] dataAdapterBytes=ByteArrayUtils.byteArrayFromString(dataAdapterStr);
      adapters.add(PersistenceUtils.fromBinary(dataAdapterBytes,DataAdapter.class));
    }
    return adapters.toArray(new DataAdapter[]{});
  }
  return new DataAdapter[]{};
}

Fixed version (ground truth):
private static DataAdapter<?>[] getDataAdaptersInternal(final Class<?> implementingClass,final Configuration configuration){
  final Map<String,String> input=configuration.getValByRegex(enumToConfKey(implementingClass,GeoWaveMetaStore.DATA_ADAPTER) + "String_Node_Str");
  if (input != null) {
    final List<DataAdapter<?>> adapters=new ArrayList<DataAdapter<?>>(input.size());
    for (    final String dataAdapterStr : input.values()) {
      final byte[] dataAdapterBytes=ByteArrayUtils.byteArrayFromString(dataAdapterStr);
      adapters.add(PersistenceUtils.fromBinary(dataAdapterBytes,DataAdapter.class));
    }
    return adapters.toArray(new DataAdapter[adapters.size()]);
  }
  return new DataAdapter[]{};
}
Program: 113119
Project: 113119
Buggy source:
private static Index[] getIndicesInternal(final Class<?> implementingClass,final Configuration configuration){
  final Map<String,String> input=configuration.getValByRegex(enumToConfKey(implementingClass,GeoWaveMetaStore.INDEX) + "String_Node_Str");
  if (input != null) {
    final List<Index> indices=new ArrayList<Index>(input.size());
    for (    final String indexStr : input.values()) {
      final byte[] indexBytes=ByteArrayUtils.byteArrayFromString(indexStr);
      indices.add(PersistenceUtils.fromBinary(indexBytes,Index.class));
    }
    return indices.toArray(new Index[]{});
  }
  return new Index[]{};
}

Fixed version (ground truth):
private static Index[] getIndicesInternal(final Class<?> implementingClass,final Configuration configuration){
  final Map<String,String> input=configuration.getValByRegex(enumToConfKey(implementingClass,GeoWaveMetaStore.INDEX) + "String_Node_Str");
  if (input != null) {
    final List<Index> indices=new ArrayList<Index>(input.size());
    for (    final String indexStr : input.values()) {
      final byte[] indexBytes=ByteArrayUtils.byteArrayFromString(indexStr);
      indices.add(PersistenceUtils.fromBinary(indexBytes,Index.class));
    }
    return indices.toArray(new Index[indices.size()]);
  }
  return new Index[]{};
}
Program: 113120
Project: 113120
Buggy source:
private GeoWaveInputSplit toFinalSplit(){
  final Map<Index,List<Range>> rangesPerIndex=new HashMap<Index,List<Range>>();
  final Set<String> locations=new HashSet<String>();
  for (  final Entry<Index,List<RangeLocationPair>> entry : splitInfo.entrySet()) {
    final List<Range> ranges=new ArrayList<Range>(entry.getValue().size());
    for (    final RangeLocationPair pair : entry.getValue()) {
      locations.add(pair.location);
      ranges.add(pair.range);
    }
    rangesPerIndex.put(entry.getKey(),ranges);
  }
  return new GeoWaveInputSplit(rangesPerIndex,locations.toArray(new String[]{}));
}

Fixed version (ground truth):
private GeoWaveInputSplit toFinalSplit(){
  final Map<Index,List<Range>> rangesPerIndex=new HashMap<Index,List<Range>>();
  final Set<String> locations=new HashSet<String>();
  for (  final Entry<Index,List<RangeLocationPair>> entry : splitInfo.entrySet()) {
    final List<Range> ranges=new ArrayList<Range>(entry.getValue().size());
    for (    final RangeLocationPair pair : entry.getValue()) {
      locations.add(pair.location);
      ranges.add(pair.range);
    }
    rangesPerIndex.put(entry.getKey(),ranges);
  }
  return new GeoWaveInputSplit(rangesPerIndex,locations.toArray(new String[locations.size()]));
}
Program: 113121
Project: 113121
Buggy source:
/** 
 * Creates a new expanding filter. 
 * @param expandMinX the distance to expand the box X dimension leftwards
 * @param expandMaxX the distance to expand the box X dimension rightwards
 * @param expandMinY the distance to expand the box Y dimension downwards
 * @param expandMaxY the distance to expand the box Y dimension upwards
 */
public BBOXExpandingFilterVisitor(double expandMinX,double expandMaxX,double expandMinY,double expandMaxY){
  this.expandMinX=expandMinX;
  this.expandMaxX=expandMaxX;
  this.expandMinY=expandMinY;
  this.expandMaxY=expandMaxX;
}

Fixed version (ground truth):
/** 
 * Creates a new expanding filter. 
 * @param expandMinX the distance to expand the box X dimension leftwards
 * @param expandMaxX the distance to expand the box X dimension rightwards
 * @param expandMinY the distance to expand the box Y dimension downwards
 * @param expandMaxY the distance to expand the box Y dimension upwards
 */
public BBOXExpandingFilterVisitor(double expandMinX,double expandMaxX,double expandMinY,double expandMaxY){
  this.expandMinX=expandMinX;
  this.expandMaxX=expandMaxX;
  this.expandMinY=expandMinY;
  this.expandMaxY=expandMaxY;
}
Program: 113122
Project: 113122
Buggy source:
private float[][] extractGrid(float[][] grid,int xBase,int yBase,int xSize,int ySize){
  float[][] gridExtract=new float[xSize][ySize];
  for (int i=0; i < xSize; i++) {
    for (int j=0; j < ySize; j++) {
      gridExtract[i][j]=grid[xBase + i][yBase + j];
    }
  }
  return gridExtract;
}

Fixed version (ground truth):
private float[][] extractGrid(float[][] grid,int xBase,int yBase,int xSize,int ySize){
  float[][] gridExtract=new float[xSize][ySize];
  for (int i=0; i < xSize; i++) {
    System.arraycopy(grid[xBase + i],yBase,gridExtract[i],0,ySize);
  }
  return gridExtract;
}
Program: 113123
Project: 113123
Buggy source:
@Override public void map(final GeoWaveInputKey key,final SimpleFeatureImpl value,final Context context) throws IOException, InterruptedException {
  final Integer pointId=Integer.parseInt(value.getAttribute("String_Node_Str").toString());
  final Geometry geometry=(Geometry)value.getDefaultGeometry();
  final Coordinate coord=geometry.getCentroid().getCoordinate();
  final DataPoint dp=new DataPoint(pointId,coord.x,coord.y,-1,false);
  final String outputRowId=context.getConfiguration().get("String_Node_Str");
  DataPoint assignedCentroid=null;
  double leastDist=Double.MAX_VALUE;
  for (  final DataPoint centroid : centroids) {
    final double dist=centroid.calculateDistance(dp);
    if (dist < leastDist) {
      assignedCentroid=centroid;
      leastDist=dist;
    }
  }
  final Mutation m=new Mutation(outputRowId);
  m.put(new Text(new Integer(assignedCentroid.id).toString()),new Text(pointId.toString()),new Value(coord.toString().getBytes()));
  context.write(outKey,m);
}

Fixed version (ground truth):
@Override public void map(final GeoWaveInputKey key,final SimpleFeatureImpl value,final Context context) throws IOException, InterruptedException {
  final Integer pointId=Integer.parseInt(value.getAttribute("String_Node_Str").toString());
  final Geometry geometry=(Geometry)value.getDefaultGeometry();
  final Coordinate coord=geometry.getCentroid().getCoordinate();
  final DataPoint dp=new DataPoint(pointId,coord.x,coord.y,-1,false);
  final String outputRowId=context.getConfiguration().get("String_Node_Str");
  DataPoint assignedCentroid=null;
  double leastDist=Double.MAX_VALUE;
  for (  final DataPoint centroid : centroids) {
    final double dist=centroid.calculateDistance(dp);
    if (dist < leastDist) {
      assignedCentroid=centroid;
      leastDist=dist;
    }
  }
  final Mutation m=new Mutation(outputRowId);
  m.put(new Text(assignedCentroid.id.toString()),new Text(pointId.toString()),new Value(coord.toString().getBytes()));
  context.write(outKey,m);
}
Program: 113124
Project: 113124
Buggy source:
@Override protected void reduce(final DoubleWritable key,final Iterable<LongWritable> values,final Context context) throws IOException, InterruptedException {
  if (key.get() < 0) {
    final double prevMax=-key.get();
    if (prevMax > max) {
      max=prevMax;
    }
  }
 else {
    final double normalized=key.get() / max;
    for (    final LongWritable v : values) {
      final long cellIndex=v.get() / numLevels;
      final Point2d[] bbox=fromIndexToLL_UR(cellIndex);
      builder.add(GeometryUtils.GEOMETRY_FACTORY.toGeometry(new Envelope(bbox[0].x,bbox[1].x,bbox[0].y,bbox[1].y)));
      builder.add(key.get());
      builder.add(normalized);
      inc+=(1.0 / totalKeys);
      builder.add(inc);
      final SimpleFeature feature=builder.buildFeature(new Long(cellIndex).toString());
      dataStore.ingest(adapter,index,feature);
    }
  }
}

Fixed version (ground truth):
@Override protected void reduce(final DoubleWritable key,final Iterable<LongWritable> values,final Context context) throws IOException, InterruptedException {
  if (key.get() < 0) {
    final double prevMax=-key.get();
    if (prevMax > max) {
      max=prevMax;
    }
  }
 else {
    final double normalized=key.get() / max;
    for (    final LongWritable v : values) {
      final long cellIndex=v.get() / numLevels;
      final Point2d[] bbox=fromIndexToLL_UR(cellIndex);
      builder.add(GeometryUtils.GEOMETRY_FACTORY.toGeometry(new Envelope(bbox[0].x,bbox[1].x,bbox[0].y,bbox[1].y)));
      builder.add(key.get());
      builder.add(normalized);
      inc+=(1.0 / totalKeys);
      builder.add(inc);
      final SimpleFeature feature=builder.buildFeature(Long.toString(cellIndex));
      dataStore.ingest(adapter,index,feature);
    }
  }
}
Program: 113125
Project: 113125
Buggy source:
protected void collectStats(final LongWritable key,final double sum,final Context context){
  final long level=(key.get() % numLevels) + minLevel;
  Double max=maxPerLevel.get(level);
  if ((max == null) || (sum > max)) {
    max=sum;
    maxPerLevel.put(level,max);
  }
  context.getCounter("String_Node_Str","String_Node_Str" + new Long(level).toString()).increment(1);
}

Fixed version (ground truth):
protected void collectStats(final LongWritable key,final double sum,final Context context){
  final long level=(key.get() % numLevels) + minLevel;
  Double max=maxPerLevel.get(level);
  if ((max == null) || (sum > max)) {
    max=sum;
    maxPerLevel.put(level,max);
  }
  context.getCounter("String_Node_Str","String_Node_Str" + Long.toString(level)).increment(1);
}
Program: 113126
Project: 113126
Buggy source:
@Override protected void reduce(final ComparisonCellData key,final Iterable<LongWritable> values,final Context context) throws IOException, InterruptedException {
  for (  final LongWritable v : values) {
    final long cellIndex=v.get() / numLevels;
    final Point2d[] bbox=fromIndexToLL_UR(cellIndex);
    builder.add(GeometryUtils.GEOMETRY_FACTORY.toGeometry(new Envelope(bbox[0].x,bbox[1].x,bbox[0].y,bbox[1].y)));
    builder.add(key.getSummerPercentile());
    builder.add(key.getWinterPercentile());
    builder.add(key.getCombinedPercentile());
    inc+=(1.0 / totalKeys);
    builder.add(inc);
    final SimpleFeature feature=builder.buildFeature(new Long(cellIndex).toString());
    dataStore.ingest(adapter,index,feature);
  }
}

Fixed version (ground truth):
@Override protected void reduce(final ComparisonCellData key,final Iterable<LongWritable> values,final Context context) throws IOException, InterruptedException {
  for (  final LongWritable v : values) {
    final long cellIndex=v.get() / numLevels;
    final Point2d[] bbox=fromIndexToLL_UR(cellIndex);
    builder.add(GeometryUtils.GEOMETRY_FACTORY.toGeometry(new Envelope(bbox[0].x,bbox[1].x,bbox[0].y,bbox[1].y)));
    builder.add(key.getSummerPercentile());
    builder.add(key.getWinterPercentile());
    builder.add(key.getCombinedPercentile());
    inc+=(1.0 / totalKeys);
    builder.add(inc);
    final SimpleFeature feature=builder.buildFeature(Long.toString(cellIndex));
    dataStore.ingest(adapter,index,feature);
  }
}
Program: 113127
Project: 113127
Buggy source:
@Override protected void collectStats(final LongWritable key,final double sum,final org.apache.hadoop.mapreduce.Reducer.Context context){
  long positiveKey=key.get();
  boolean isWinter=false;
  if (positiveKey < 0) {
    positiveKey=-positiveKey - 1;
    isWinter=true;
  }
  final long level=(positiveKey % numLevels) + minLevel;
  context.getCounter("String_Node_Str" + (isWinter ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str","String_Node_Str" + new Long(level).toString()).increment(1);
}

Fixed version (ground truth):
@Override protected void collectStats(final LongWritable key,final double sum,final org.apache.hadoop.mapreduce.Reducer.Context context){
  long positiveKey=key.get();
  boolean isWinter=false;
  if (positiveKey < 0) {
    positiveKey=-positiveKey - 1;
    isWinter=true;
  }
  final long level=(positiveKey % numLevels) + minLevel;
  context.getCounter("String_Node_Str" + (isWinter ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str","String_Node_Str" + Long.toString(level)).increment(1);
}
Program: 113128
Project: 113128
Buggy source:
protected void collectStats(final long key,final Context context){
  final long level=(key % numLevels) + minLevel;
  context.getCounter("String_Node_Str","String_Node_Str" + new Long(level).toString()).increment(1);
}

Fixed version (ground truth):
protected void collectStats(final long key,final Context context){
  final long level=(key % numLevels) + minLevel;
  context.getCounter("String_Node_Str","String_Node_Str" + Long.toString(level)).increment(1);
}
Program: 113129
Project: 113129
Buggy source:
private static Object convertTrueFalseStringToBoolean(Object obj){
  if (!(obj instanceof Number) && !(obj instanceof Boolean)) {
    if (obj.toString().trim().toLowerCase().equals("String_Node_Str")) {
      obj=new Boolean(true);
    }
 else     if (obj.toString().trim().toLowerCase().equals("String_Node_Str")) {
      obj=new Boolean(false);
    }
  }
  return obj;
}

Fixed version (ground truth):
private static Object convertTrueFalseStringToBoolean(Object obj){
  if (!(obj instanceof Number) && !(obj instanceof Boolean)) {
    if (obj.toString().trim().toLowerCase().equals("String_Node_Str")) {
      obj=Boolean.TRUE;
    }
 else     if (obj.toString().trim().toLowerCase().equals("String_Node_Str")) {
      obj=Boolean.FALSE;
    }
  }
  return obj;
}
Program: 113130
Project: 113130
Buggy source:
@Override public boolean equals(final Object obj){
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (getClass() != obj.getClass()) {
    return false;
  }
  final ByteArrayId other=(ByteArrayId)obj;
  if (!Arrays.equals(id,other.id)) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean equals(final Object obj){
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (getClass() != obj.getClass()) {
    return false;
  }
  final ByteArrayId other=(ByteArrayId)obj;
  return Arrays.equals(id,other.id);
}
Program: 113131
Project: 113131
Buggy source:
@Override public BinRange[] getNormalizedRanges(final NumericData range){
  final Calendar startEpoch=Calendar.getInstance(TimeZone.getTimeZone(timezone));
  final long binSizeMillis=getBinSizeMillis();
  startEpoch.setTimeInMillis((long)range.getMin());
  setToEpoch(startEpoch);
  final long startEpochMillis=startEpoch.getTimeInMillis();
  long epochIterator=startEpochMillis;
  final List<BinRange> bins=new ArrayList<BinRange>();
  boolean firstBin=((long)range.getMin() != startEpochMillis);
  boolean lastBin=false;
  do {
    final Calendar nextEpochCal=Calendar.getInstance(TimeZone.getTimeZone(timezone));
    nextEpochCal.setTimeInMillis(epochIterator + (long)(binSizeMillis * 1.5));
    setToEpoch(nextEpochCal);
    final long nextEpoch=nextEpochCal.getTimeInMillis();
    final long maxOfBin=nextEpoch - 1;
    final Calendar cal=Calendar.getInstance(TimeZone.getTimeZone(timezone));
    cal.setTimeInMillis(epochIterator);
    long startMillis, endMillis;
    boolean fullExtent;
    if ((long)range.getMax() <= maxOfBin) {
      lastBin=true;
      endMillis=(long)range.getMax();
      fullExtent=range.getMax() == maxOfBin;
    }
 else {
      endMillis=maxOfBin;
      fullExtent=!firstBin;
    }
    if (firstBin) {
      startMillis=(long)range.getMin();
      firstBin=false;
    }
 else {
      startMillis=epochIterator;
    }
    bins.add(new BinRange(getBinId(cal),startMillis - epochIterator,endMillis - epochIterator,fullExtent));
    epochIterator=nextEpoch;
  }
 while (!lastBin);
  return bins.toArray(new BinRange[]{});
}

Fixed version (ground truth):
@Override public BinRange[] getNormalizedRanges(final NumericData range){
  final Calendar startEpoch=Calendar.getInstance(TimeZone.getTimeZone(timezone));
  final long binSizeMillis=getBinSizeMillis();
  startEpoch.setTimeInMillis((long)range.getMin());
  setToEpoch(startEpoch);
  final long startEpochMillis=startEpoch.getTimeInMillis();
  long epochIterator=startEpochMillis;
  final List<BinRange> bins=new ArrayList<BinRange>();
  boolean firstBin=((long)range.getMin() != startEpochMillis);
  boolean lastBin=false;
  do {
    final Calendar nextEpochCal=Calendar.getInstance(TimeZone.getTimeZone(timezone));
    nextEpochCal.setTimeInMillis(epochIterator + (long)(binSizeMillis * 1.5));
    setToEpoch(nextEpochCal);
    final long nextEpoch=nextEpochCal.getTimeInMillis();
    final long maxOfBin=nextEpoch - 1;
    final Calendar cal=Calendar.getInstance(TimeZone.getTimeZone(timezone));
    cal.setTimeInMillis(epochIterator);
    long startMillis, endMillis;
    boolean fullExtent;
    if ((long)range.getMax() <= maxOfBin) {
      lastBin=true;
      endMillis=(long)range.getMax();
      fullExtent=range.getMax() == maxOfBin;
    }
 else {
      endMillis=maxOfBin;
      fullExtent=!firstBin;
    }
    if (firstBin) {
      startMillis=(long)range.getMin();
      firstBin=false;
    }
 else {
      startMillis=epochIterator;
    }
    bins.add(new BinRange(getBinId(cal),startMillis - epochIterator,endMillis - epochIterator,fullExtent));
    epochIterator=nextEpoch;
  }
 while (!lastBin);
  return bins.toArray(new BinRange[bins.size()]);
}
Program: 113132
Project: 113132
Buggy source:
@Override public boolean equals(final Object obj){
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (getClass() != obj.getClass()) {
    return false;
  }
  final TieredSFCIndexStrategy other=(TieredSFCIndexStrategy)obj;
  if (!Arrays.equals(baseDefinitions,other.baseDefinitions)) {
    return false;
  }
  if (!Arrays.equals(orderedSfcs,other.orderedSfcs)) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean equals(final Object obj){
  if (this == obj) {
    return true;
  }
  if (obj == null) {
    return false;
  }
  if (getClass() != obj.getClass()) {
    return false;
  }
  final TieredSFCIndexStrategy other=(TieredSFCIndexStrategy)obj;
  if (!Arrays.equals(baseDefinitions,other.baseDefinitions)) {
    return false;
  }
  return Arrays.equals(orderedSfcs,other.orderedSfcs);
}
Program: 113133
Project: 113133
Buggy source:
@Test public void testTimeDefinitionMinBinByMonth(){
  final double expectedMin=0.0;
  final double expectedMax=2678399999.0;
  final Calendar calendar=Calendar.getInstance();
  calendar.set(Calendar.MONTH,6);
  calendar.set(Calendar.DATE,1);
  calendar.set(Calendar.HOUR_OF_DAY,00);
  calendar.set(Calendar.MINUTE,00);
  calendar.set(Calendar.SECOND,0);
  calendar.set(Calendar.MILLISECOND,000);
  BinningStrategy bin=getStrategyByUnit(Unit.MONTH);
  Assert.assertEquals(expectedMin,bin.getBinMin(),DELTA);
  Assert.assertEquals(expectedMax,bin.getBinMax(),DELTA);
  Assert.assertEquals(bin.getBinMin(),bin.getBinnedValue(calendar.getTimeInMillis()).getNormalizedValue(),DELTA);
}

Fixed version (ground truth):
@Test public void testTimeDefinitionMinBinByMonth(){
  final double expectedMin=0.0;
  final double expectedMax=2678399999.0;
  final Calendar calendar=Calendar.getInstance();
  calendar.set(Calendar.MONTH,6);
  calendar.set(Calendar.DATE,1);
  calendar.set(Calendar.HOUR_OF_DAY,0);
  calendar.set(Calendar.MINUTE,0);
  calendar.set(Calendar.SECOND,0);
  calendar.set(Calendar.MILLISECOND,0);
  BinningStrategy bin=getStrategyByUnit(Unit.MONTH);
  Assert.assertEquals(expectedMin,bin.getBinMin(),DELTA);
  Assert.assertEquals(expectedMax,bin.getBinMax(),DELTA);
  Assert.assertEquals(bin.getBinMin(),bin.getBinnedValue(calendar.getTimeInMillis()).getNormalizedValue(),DELTA);
}
Program: 113134
Project: 113134
Buggy source:
protected static byte[] getNoDataBinary(final double[][] noDataValuesPerBand){
  if (noDataValuesPerBand != null) {
    int totalBytes=4;
    final List<byte[]> noDataValuesBytes=new ArrayList<byte[]>(noDataValuesPerBand.length);
    for (    final double[] noDataValues : noDataValuesPerBand) {
      final int thisBytes=4 + (noDataValues.length * 8);
      totalBytes+=thisBytes;
      final ByteBuffer noDataBuf=ByteBuffer.allocate(thisBytes);
      noDataBuf.putInt(noDataValues.length);
      for (      final double noDataValue : noDataValues) {
        noDataBuf.putDouble(noDataValue);
      }
      noDataValuesBytes.add(noDataBuf.array());
    }
    final ByteBuffer noDataBuf=ByteBuffer.allocate(totalBytes);
    noDataBuf.putInt(noDataValuesPerBand.length);
    for (    final byte[] noDataValueBytes : noDataValuesBytes) {
      noDataBuf.put(noDataValueBytes);
    }
    return noDataBuf.array();
  }
 else {
    return new byte[]{};
  }
}

Fixed version (ground truth):
protected static byte[] getNoDataBinary(final double[][] noDataValuesPerBand){
  if (noDataValuesPerBand != null) {
    int totalBytes=4;
    final List<byte[]> noDataValuesBytes=new ArrayList<byte[]>(noDataValuesPerBand.length);
    for (    final double[] noDataValues : noDataValuesPerBand) {
      int length=0;
      if (noDataValues != null) {
        length=noDataValues.length;
      }
      final int thisBytes=4 + (length * 8);
      totalBytes+=thisBytes;
      final ByteBuffer noDataBuf=ByteBuffer.allocate(thisBytes);
      noDataBuf.putInt(length);
      if (noDataValues != null) {
        for (        final double noDataValue : noDataValues) {
          noDataBuf.putDouble(noDataValue);
        }
      }
      noDataValuesBytes.add(noDataBuf.array());
    }
    final ByteBuffer noDataBuf=ByteBuffer.allocate(totalBytes);
    noDataBuf.putInt(noDataValuesPerBand.length);
    for (    final byte[] noDataValueBytes : noDataValuesBytes) {
      noDataBuf.put(noDataValueBytes);
    }
    return noDataBuf.array();
  }
 else {
    return new byte[]{};
  }
}
Program: 113136
Project: 113136
Buggy source:
@Override public byte[] toBinary(){
  final byte[] noDataBinary;
  if ((noDataPerBand != null) && (noDataPerBand.length > 0)) {
    int totalBytes=4;
    final List<byte[]> noDataValuesBytes=new ArrayList<byte[]>(noDataPerBand.length);
    for (    final double[] noDataValues : noDataPerBand) {
      final int thisBytes=4 + (noDataValues.length * 8);
      totalBytes+=thisBytes;
      final ByteBuffer noDataBuf=ByteBuffer.allocate(thisBytes);
      noDataBuf.putInt(noDataValues.length);
      for (      final double noDataValue : noDataValues) {
        noDataBuf.putDouble(noDataValue);
      }
      noDataValuesBytes.add(noDataBuf.array());
    }
    final ByteBuffer noDataBuf=ByteBuffer.allocate(totalBytes);
    noDataBuf.putInt(noDataPerBand.length);
    for (    final byte[] noDataValueBytes : noDataValuesBytes) {
      noDataBuf.put(noDataValueBytes);
    }
    noDataBinary=noDataBuf.array();
  }
 else {
    noDataBinary=new byte[]{};
  }
  final byte[] geometryBinary=GeometryUtils.geometryToBinary(shape);
  final ByteBuffer buf=ByteBuffer.allocate(geometryBinary.length + noDataPerBand.length + 4);
  buf.putInt(noDataBinary.length);
  buf.put(noDataBinary);
  buf.put(geometryBinary);
  return buf.array();
}

Fixed version (ground truth):
@Override public byte[] toBinary(){
  final byte[] noDataBinary;
  if ((noDataPerBand != null) && (noDataPerBand.length > 0)) {
    int totalBytes=4;
    final List<byte[]> noDataValuesBytes=new ArrayList<byte[]>(noDataPerBand.length);
    for (    final double[] noDataValues : noDataPerBand) {
      final int thisBytes=4 + (noDataValues.length * 8);
      totalBytes+=thisBytes;
      final ByteBuffer noDataBuf=ByteBuffer.allocate(thisBytes);
      noDataBuf.putInt(noDataValues.length);
      for (      final double noDataValue : noDataValues) {
        noDataBuf.putDouble(noDataValue);
      }
      noDataValuesBytes.add(noDataBuf.array());
    }
    final ByteBuffer noDataBuf=ByteBuffer.allocate(totalBytes);
    noDataBuf.putInt(noDataPerBand.length);
    for (    final byte[] noDataValueBytes : noDataValuesBytes) {
      noDataBuf.put(noDataValueBytes);
    }
    noDataBinary=noDataBuf.array();
  }
 else {
    noDataBinary=new byte[]{};
  }
  final byte[] geometryBinary=GeometryUtils.geometryToBinary(shape);
  final ByteBuffer buf=ByteBuffer.allocate(geometryBinary.length + noDataBinary.length + 4);
  buf.putInt(noDataBinary.length);
  buf.put(noDataBinary);
  buf.put(geometryBinary);
  return buf.array();
}
Program: 113137
Project: 113137
Buggy source:
@Override protected void transformRange(final SortedKeyValueIterator<Key,Value> input,final KVBuffer output) throws IOException {
  Mergeable currentMergeable=null;
  Key outputKey=null;
  while (input.hasTop()) {
    final Value val=input.getTopValue();
    final Key currentKey=new Key(input.getTopKey());
    if (outputKey == null) {
      outputKey=currentKey;
    }
 else     if (currentMergeable != null && !outputKey.getRowData().equals(currentKey.getRowData())) {
      output.append(outputKey,new Value(PersistenceUtils.toBinary(currentMergeable)));
      currentMergeable=null;
      outputKey=currentKey;
      continue;
    }
 else {
      final Text combinedVisibility=new Text(combineVisibilities(currentKey.getColumnVisibility().getBytes(),outputKey.getColumnVisibility().getBytes()));
      outputKey=replaceColumnVisibility(outputKey,combinedVisibility);
    }
    Mergeable mergeable=PersistenceUtils.fromBinary(val.get(),Mergeable.class);
    mergeable=transform(currentKey,mergeable);
    if (mergeable != null) {
      if (currentMergeable == null) {
        currentMergeable=mergeable;
      }
 else {
        currentMergeable.merge(mergeable);
      }
    }
    input.next();
  }
  if (currentMergeable != null) {
    output.append(outputKey,new Value(PersistenceUtils.toBinary(currentMergeable)));
  }
}

Fixed version (ground truth):
@Override protected void transformRange(final SortedKeyValueIterator<Key,Value> input,final KVBuffer output) throws IOException {
  Mergeable currentMergeable=null;
  Key outputKey=null;
  while (input.hasTop()) {
    final Value val=input.getTopValue();
    final Key currentKey=new Key(input.getTopKey());
    if (outputKey == null) {
      outputKey=currentKey;
    }
 else     if ((currentMergeable != null) && !outputKey.getRowData().equals(currentKey.getRowData())) {
      output.append(outputKey,new Value(PersistenceUtils.toBinary(currentMergeable)));
      currentMergeable=null;
      outputKey=currentKey;
      continue;
    }
 else {
      final Text combinedVisibility=new Text(combineVisibilities(currentKey.getColumnVisibility().getBytes(),outputKey.getColumnVisibility().getBytes()));
      outputKey=replaceColumnVisibility(outputKey,combinedVisibility);
    }
    final Mergeable mergeable=getMergeable(currentKey,val.get());
    if (mergeable != null) {
      if (currentMergeable == null) {
        currentMergeable=mergeable;
      }
 else {
        currentMergeable.merge(mergeable);
      }
    }
    input.next();
  }
  if (currentMergeable != null) {
    output.append(outputKey,new Value(getBinary(currentMergeable)));
  }
}
Program: 113138
Project: 113138
Buggy source:
private static byte[] combineVisibilities(final byte[] vis1,final byte[] vis2){
  if (vis1 == null || vis1.length == 0) {
    return vis2;
  }
  if (vis2 == null || vis2.length == 0) {
    return vis1;
  }
  return new ColumnVisibility(ArrayUtils.addAll(ArrayUtils.addAll(ColumnVisibility.quote(vis1),AMPRISAND),ColumnVisibility.quote(vis2))).flatten();
}

Fixed version (ground truth):
private static byte[] combineVisibilities(final byte[] vis1,final byte[] vis2){
  if ((vis1 == null) || (vis1.length == 0)) {
    return vis2;
  }
  if ((vis2 == null) || (vis2.length == 0)) {
    return vis1;
  }
  return new ColumnVisibility(ArrayUtils.addAll(ArrayUtils.addAll(ColumnVisibility.quote(vis1),AMPRISAND),ColumnVisibility.quote(vis2))).flatten();
}
Program: 113139
Project: 113139
Buggy source:
@Override protected Mergeable getMergeable(final Key key,final byte[] binary){
  final RasterTile mergeable=PersistenceUtils.classFactory(RasterTile.class.getName(),RasterTile.class);
  return helper.transform(key,mergeable);
}

Fixed version (ground truth):
@Override protected Mergeable getMergeable(final Key key,final byte[] binary){
  final RasterTile mergeable=PersistenceUtils.classFactory(RasterTile.class.getName(),RasterTile.class);
  if (mergeable != null) {
    mergeable.fromBinary(binary);
  }
  return helper.transform(key,mergeable);
}
Program: 113142
Project: 113142
Buggy source:
public GeoWaveGTDataStore(final GeoWavePluginConfig config) throws IOException, AccumuloException, AccumuloSecurityException {
  listenerManager=new FeatureListenerManager();
  lockingManager=config.getLockingManagementFactory().createLockingManager(config);
  authorizationSPI=config.getAuthorizationFactory().create(config.getAuthorizationURL());
  init(config);
  transactionsAllocater=new ZooKeeperTransactionsAllocater(config.getZookeeperServers(),"String_Node_Str",this);
  try {
    featureNameSpaceURI=new URI("String_Node_Str");
  }
 catch (  URISyntaxException e) {
    LOGGER.error("String_Node_Str",e);
  }
}

Fixed version (ground truth):
public GeoWaveGTDataStore(final GeoWavePluginConfig config) throws IOException, AccumuloException, AccumuloSecurityException {
  listenerManager=new FeatureListenerManager();
  lockingManager=config.getLockingManagementFactory().createLockingManager(config);
  authorizationSPI=config.getAuthorizationFactory().create(config.getAuthorizationURL());
  init(config);
  transactionsAllocater=new ZooKeeperTransactionsAllocater(config.getZookeeperServers(),"String_Node_Str",this);
  featureNameSpaceURI=config.getFeatureNamespace();
}
Program: 113143
Project: 113143
Buggy source:
Name getTypeName(String typeName){
  return new NameImpl(featureNameSpaceURI.toString(),typeName);
}

Fixed version (ground truth):
Name getTypeName(final String typeName){
  return new NameImpl(featureNameSpaceURI.toString(),typeName);
}
Program: 113145
Project: 113145
Buggy source:
private FeatureDataAdapter getAdapter(final String typeName){
  final SimpleFeatureType statsFeatureType=getDefaultSchema(typeName);
  final FeatureDataAdapter featureAdapter;
  if (statsFeatureType != null) {
    featureAdapter=new FeatureDataAdapter(statsFeatureType,getVisibilityManagement());
  }
 else {
    final DataAdapter<?> adapter=adapterStore.getAdapter(new ByteArrayId(StringUtils.stringToBinary(typeName)));
    if ((adapter == null) || !(adapter instanceof FeatureDataAdapter)) {
      return null;
    }
    featureAdapter=(FeatureDataAdapter)adapter;
  }
  featureAdapter.setNamespace(this.featureNameSpaceURI.toString());
  return featureAdapter;
}

Fixed version (ground truth):
private FeatureDataAdapter getAdapter(final String typeName){
  final SimpleFeatureType statsFeatureType=getDefaultSchema(typeName);
  final FeatureDataAdapter featureAdapter;
  if (statsFeatureType != null) {
    featureAdapter=new FeatureDataAdapter(statsFeatureType,getVisibilityManagement());
  }
 else {
    final DataAdapter<?> adapter=adapterStore.getAdapter(new ByteArrayId(StringUtils.stringToBinary(typeName)));
    if ((adapter == null) || !(adapter instanceof FeatureDataAdapter)) {
      return null;
    }
    featureAdapter=(FeatureDataAdapter)adapter;
  }
  if (featureNameSpaceURI != null)   featureAdapter.setNamespace(featureNameSpaceURI.toString());
  return featureAdapter;
}
Program: 113146
Project: 113146
Buggy source:
@Override public void removeSchema(final String typeName) throws IOException {
  final DataAdapter<?> adapter=adapterStore.getAdapter(new ByteArrayId(StringUtils.stringToBinary(typeName)));
  if (adapter != null) {
    String[] authorizations=getAuthorizationSPI().getAuthorizations();
    try (CloseableIterator<Index> indicesIt=dataStore.getIndices()){
      while (indicesIt.hasNext()) {
        dataStore.deleteEntries(adapter,indicesIt.next(),authorizations);
      }
    }
 catch (    IOException ex) {
      LOGGER.error("String_Node_Str",ex);
    }
  }
}

Fixed version (ground truth):
@Override public void removeSchema(final String typeName) throws IOException {
  final DataAdapter<?> adapter=adapterStore.getAdapter(new ByteArrayId(StringUtils.stringToBinary(typeName)));
  if (adapter != null) {
    final String[] authorizations=getAuthorizationSPI().getAuthorizations();
    try (CloseableIterator<Index> indicesIt=dataStore.getIndices()){
      while (indicesIt.hasNext()) {
        dataStore.deleteEntries(adapter,indicesIt.next(),authorizations);
      }
    }
 catch (    final IOException ex) {
      LOGGER.error("String_Node_Str",ex);
    }
  }
}
Program: 113147
Project: 113147
Buggy source:
@Override public void createSchema(final SimpleFeatureType featureType){
  if (featureType.getGeometryDescriptor() == null) {
    throw new UnsupportedOperationException("String_Node_Str");
  }
  final FeatureDataAdapter adapter=new FeatureDataAdapter(featureType,getVisibilityManagement());
  if (featureNameSpaceURI != null)   adapter.setNamespace(featureNameSpaceURI.toString());
  adapterStore.addAdapter(adapter);
  getPreferredIndex(adapter);
}

Fixed version (ground truth):
@Override public void createSchema(final SimpleFeatureType featureType){
  if (featureType.getGeometryDescriptor() == null) {
    throw new UnsupportedOperationException("String_Node_Str");
  }
  final FeatureDataAdapter adapter=new FeatureDataAdapter(featureType,getVisibilityManagement());
  if (featureNameSpaceURI != null) {
    adapter.setNamespace(featureNameSpaceURI.toString());
  }
  adapterStore.addAdapter(adapter);
  getPreferredIndex(adapter);
}
Program: 113148
Project: 113148
Buggy source:
private SimpleFeatureType getDefaultSchema(final String typeName){
  final FeatureDataAdapter adapter=getStatsAdapter(typeName);
  if (adapter != null) {
    final SimpleFeatureType type=adapter.getType();
    String nameSpace=featureNameSpaceURI != null ? featureNameSpaceURI.toString() : type.getName().getNamespaceURI();
    return new SimpleFeatureTypeImpl(new NameImpl(nameSpace,type.getName().getSeparator(),typeName),type.getAttributeDescriptors(),type.getGeometryDescriptor(),type.isAbstract(),type.getRestrictions(),type.getSuper(),type.getDescription());
  }
  return null;
}

Fixed version (ground truth):
private SimpleFeatureType getDefaultSchema(final String typeName){
  final FeatureDataAdapter adapter=getStatsAdapter(typeName);
  if (adapter != null) {
    final SimpleFeatureType type=adapter.getType();
    final String nameSpace=featureNameSpaceURI != null ? featureNameSpaceURI.toString() : type.getName().getNamespaceURI();
    return new SimpleFeatureTypeImpl(new NameImpl(nameSpace,type.getName().getSeparator(),typeName),type.getAttributeDescriptors(),type.getGeometryDescriptor(),type.isAbstract(),type.getRestrictions(),type.getSuper(),type.getDescription());
  }
  return null;
}