nus-yam/ex-repair huggingface dataset:
Program: 113048
Project: 113048
Buggy source:
@Test public void testInsert() throws IOException {
  DataStatisticsStore store=dataStore.createDataStatisticsStore();
  DataStatistics<?> stat=new CountDataStatistics<String>(new ByteArrayId("String_Node_Str"));
  stat.entryIngested(null,null);
  stat.entryIngested(null,null);
  stat.entryIngested(null,null);
  store.incorporateStatistics(stat);
  HBaseRequiredOptions opts=(HBaseRequiredOptions)dataStore.getFactoryOptions();
  BasicHBaseOperations ops=BasicHBaseOperations.createOperations(opts);
  Scan scan=new Scan();
  scan.setStartRow(stat.getStatisticsId().getBytes());
  scan.setStopRow(HBaseUtils.getNextPrefix(stat.getStatisticsId().getBytes()));
  scan.addFamily(new ByteArrayId("String_Node_Str").getBytes());
  ResultScanner rs=ops.getScannedResults(scan,"String_Node_Str");
  Iterator<Result> res=rs.iterator();
  byte[] row=res.next().getRow();
  Assert.assertEquals(stat.getStatisticsId().getBytes().length + 16,row.length);
  byte[] bytes=new byte[stat.getStatisticsId().getBytes().length];
  ByteBuffer bb=ByteBuffer.wrap(row);
  bb.get(bytes);
  ByteArrayId bad=new ByteArrayId(bytes);
  Assert.assertEquals(stat.getStatisticsId().getString(),bad.getString());
  Assert.assertEquals(stat,store.getDataStatistics(stat.getDataAdapterId(),stat.getStatisticsId()));
}

Fixed version (ground truth):
@Test public void testInsert() throws IOException {
  DataStatisticsStore store=dataStore.createDataStatisticsStore();
  DataStatistics<?> stat=new CountDataStatistics<String>(new ByteArrayId("String_Node_Str"));
  stat.entryIngested(null,null);
  stat.entryIngested(null,null);
  stat.entryIngested(null,null);
  store.incorporateStatistics(stat);
  HBaseRequiredOptions opts=(HBaseRequiredOptions)dataStore.getFactoryOptions();
  BasicHBaseOperations ops=BasicHBaseOperations.createOperations(opts);
  Scan scan=new Scan();
  scan.setStartRow(stat.getStatisticsId().getBytes());
  scan.setStopRow(HBaseUtils.getNextPrefix(stat.getStatisticsId().getBytes()));
  scan.addFamily(new ByteArrayId("String_Node_Str").getBytes());
  ResultScanner rs=ops.getScannedResults(scan,"String_Node_Str");
  Iterator<Result> res=rs.iterator();
  byte[] row=res.next().getRow();
  Assert.assertEquals(stat.getStatisticsId().getBytes().length + 16 + 1,row.length);
  byte[] bytes=new byte[stat.getStatisticsId().getBytes().length];
  ByteBuffer bb=ByteBuffer.wrap(row);
  bb.get(bytes);
  ByteArrayId bad=new ByteArrayId(bytes);
  Assert.assertEquals(stat.getStatisticsId().getString(),bad.getString());
  Assert.assertEquals(stat,store.getDataStatistics(stat.getDataAdapterId(),stat.getStatisticsId()));
}
Program: 113050
Project: 113050
Buggy source:
protected List<Scan> getScanners(final Integer limit,final List<Filter> distributableFilters,final CloseableIterator<DataAdapter<?>> adapters){
  FilterList filterList=null;
  if ((distributableFilters != null) && (distributableFilters.size() > 0)) {
    filterList=new FilterList();
    for (    final Filter filter : distributableFilters) {
      filterList.addFilter(filter);
    }
  }
  List<ByteArrayRange> ranges=getRanges();
  if ((ranges == null) || ranges.isEmpty()) {
    ranges=Collections.singletonList(new ByteArrayRange(null,null));
  }
  final List<Scan> scanners=new ArrayList<Scan>();
  if ((ranges != null) && (ranges.size() > 0)) {
    for (    final ByteArrayRange range : ranges) {
      final Scan scanner=new Scan();
      if ((adapterIds != null) && !adapterIds.isEmpty()) {
        for (        final ByteArrayId adapterId : adapterIds) {
          scanner.addFamily(adapterId.getBytes());
        }
      }
      if (range.getStart() != null) {
        scanner.setStartRow(range.getStart().getBytes());
        if (!range.isSingleValue()) {
          scanner.setStopRow(HBaseUtils.getNextPrefix(range.getEnd().getBytes()));
        }
      }
      scanner.setFilter(filterList);
      if ((fieldIds != null) && !fieldIds.isEmpty()) {
        handleSubsetOfFieldIds(scanner,adapters);
      }
      if ((limit != null) && (limit > 0) && (limit < scanner.getBatch())) {
        scanner.setBatch(limit);
      }
      scanners.add(scanner);
    }
  }
  return scanners;
}

Fixed version (ground truth):
protected List<Scan> getScanners(final Integer limit,final List<Filter> distributableFilters,final CloseableIterator<DataAdapter<?>> adapters){
  FilterList filterList=null;
  if ((distributableFilters != null) && (distributableFilters.size() > 0)) {
    filterList=new FilterList();
    for (    final Filter filter : distributableFilters) {
      filterList.addFilter(filter);
    }
  }
  List<ByteArrayRange> ranges=getRanges();
  if ((ranges == null) || ranges.isEmpty()) {
    ranges=Collections.singletonList(new ByteArrayRange(null,null));
  }
  final List<Scan> scanners=new ArrayList<Scan>();
  if ((ranges != null) && (ranges.size() > 0)) {
    for (    final ByteArrayRange range : ranges) {
      final Scan scanner=new Scan();
      if ((adapterIds != null) && !adapterIds.isEmpty()) {
        for (        final ByteArrayId adapterId : adapterIds) {
          scanner.addFamily(adapterId.getBytes());
        }
      }
      if (range.getStart() != null) {
        scanner.setStartRow(range.getStart().getBytes());
        if (!range.isSingleValue()) {
          scanner.setStopRow(HBaseUtils.getNextPrefix(range.getEnd().getBytes()));
        }
 else {
          scanner.setStopRow(HBaseUtils.getNextPrefix(range.getStart().getBytes()));
        }
      }
      scanner.setFilter(filterList);
      if ((fieldIds != null) && !fieldIds.isEmpty()) {
        handleSubsetOfFieldIds(scanner,adapters);
      }
      if ((limit != null) && (limit > 0) && (limit < scanner.getBatch())) {
        scanner.setBatch(limit);
      }
      scanners.add(scanner);
    }
  }
  return scanners;
}
Program: 113051
Project: 113051
Buggy source:
public static byte[] getNextPrefix(final byte[] prefix){
  return new Scan(prefix).getStopRow();
}

Fixed version (ground truth):
public static byte[] getNextPrefix(final byte[] prefix){
  return new Scan().setRowPrefixFilter(prefix).getStopRow();
}
Program: 113053
Project: 113053
Buggy source:
public AltIndexCallback(final String indexName,final WritableDataAdapter<T> adapter,final HBaseOptions accumuloOptions) throws IOException {
  this.adapter=adapter;
  altIdxTableName=indexName + HBaseUtils.ALT_INDEX_TABLE;
  if (operations.tableExists(indexName)) {
    if (!operations.tableExists(altIdxTableName)) {
      throw new TableNotFoundException(altIdxTableName);
    }
  }
 else {
    if (operations.tableExists(altIdxTableName)) {
      operations.deleteTable(altIdxTableName);
      LOGGER.warn("String_Node_Str" + altIdxTableName + "String_Node_Str");
    }
  }
  altIdxWriter=operations.createWriter(altIdxTableName,adapter.getAdapterId().getString(),accumuloOptions.isCreateTable());
}

Fixed version (ground truth):
public AltIndexCallback(final String indexName,final WritableDataAdapter<T> adapter,final HBaseOptions hbaseOptions) throws IOException {
  this.adapter=adapter;
  altIdxTableName=indexName + HBaseUtils.ALT_INDEX_TABLE;
  if (operations.tableExists(indexName)) {
    if (!operations.tableExists(altIdxTableName)) {
      throw new TableNotFoundException(altIdxTableName);
    }
  }
 else {
    if (operations.tableExists(altIdxTableName)) {
      operations.deleteTable(altIdxTableName);
      LOGGER.warn("String_Node_Str" + altIdxTableName + "String_Node_Str");
    }
  }
  altIdxWriter=operations.createWriter(altIdxTableName,adapter.getAdapterId().getString(),hbaseOptions.isCreateTable());
}
Program: 113055
Project: 113055
Buggy source:
private void addColumnFamilyToTable(TableName name,String columnFamilyName) throws IOException {
  HColumnDescriptor cfDesciptor=new HColumnDescriptor(columnFamilyName);
  if (admin.tableExists(name)) {
    if (!admin.isTableEnabled(name)) {
      admin.enableTable(name);
    }
    HTableDescriptor descriptor=admin.getTableDescriptor(name);
    boolean found=false;
    for (    HColumnDescriptor hColumnDescriptor : descriptor.getColumnFamilies()) {
      if (hColumnDescriptor.getNameAsString().equalsIgnoreCase(columnFamilyName))       found=true;
    }
    if (!found) {
      if (admin.isTableEnabled(name)) {
        admin.disableTable(name);
      }
      admin.addColumn(name,cfDesciptor);
      admin.enableTable(name);
    }
  }
 else {
    LOGGER.warn("String_Node_Str" + name.getNameAsString() + "String_Node_Str"+ columnFamilyName+ "String_Node_Str");
  }
}

Fixed version (ground truth):
private void addColumnFamilyToTable(final TableName name,final String columnFamilyName) throws IOException {
  final HColumnDescriptor cfDesciptor=new HColumnDescriptor(columnFamilyName);
  if (admin.tableExists(name)) {
    if (!admin.isTableEnabled(name)) {
      admin.enableTable(name);
    }
    final HTableDescriptor descriptor=admin.getTableDescriptor(name);
    boolean found=false;
    for (    final HColumnDescriptor hColumnDescriptor : descriptor.getColumnFamilies()) {
      if (hColumnDescriptor.getNameAsString().equalsIgnoreCase(columnFamilyName)) {
        found=true;
      }
    }
    if (!found) {
      if (admin.isTableEnabled(name)) {
        admin.disableTable(name);
      }
      admin.addColumn(name,cfDesciptor);
      admin.enableTable(name);
    }
  }
 else {
    LOGGER.warn("String_Node_Str" + name.getNameAsString() + "String_Node_Str"+ columnFamilyName+ "String_Node_Str");
  }
}
Program: 113056
Project: 113056
Buggy source:
public HBaseWriter(Admin admin,Table table){
  this.admin=admin;
  this.table=table;
}

Fixed version (ground truth):
public HBaseWriter(final Admin admin,final Table table){
  this.admin=admin;
  this.table=table;
}
Program: 113057
Project: 113057
Buggy source:
public void write(RowMutations mutation,String columnFamily){
  try {
    addColumnFamilyToTable(table.getName(),columnFamily);
    write(mutation);
  }
 catch (  IOException e) {
    LOGGER.warn("String_Node_Str" + columnFamily,e);
  }
}

Fixed version (ground truth):
public void write(final RowMutations mutation,final String columnFamily){
  try {
    addColumnFamilyToTable(table.getName(),columnFamily);
    write(mutation);
  }
 catch (  final IOException e) {
    LOGGER.warn("String_Node_Str" + columnFamily,e);
  }
}
Program: 113058
Project: 113058
Buggy source:
public void delete(List<Delete> deletes) throws IOException {
  table.delete(deletes);
}

Fixed version (ground truth):
public void delete(final List<Delete> deletes) throws IOException {
  table.delete(deletes);
}
Program: 113060
Project: 113060
Buggy source:
protected BasicHBaseOperations getHbaseOperationsInstance(String zookeeperInstances,String geowaveNamespace) throws IOException {
  return new BasicHBaseOperations(zookeeperInstances,geowaveNamespace);
}

Fixed version (ground truth):
protected BasicHBaseOperations getHbaseOperationsInstance(final String zookeeperInstances,final String geowaveNamespace) throws IOException {
  return new BasicHBaseOperations(zookeeperInstances,geowaveNamespace);
}
Program: 113061
Project: 113061
Buggy source:
protected BasicHBaseOperations createOperations(final Map<String,Object> configOptions,final String namespace){
  try {
    return BasicHBaseOperations.createOperations(configOptions,namespace);
  }
 catch (  final Exception e) {
    LOGGER.error("String_Node_Str",e);
    return null;
  }
}

Fixed version (ground truth):
protected BasicHBaseOperations createOperations(final HBaseRequiredOptions options){
  try {
    return BasicHBaseOperations.createOperations(options);
  }
 catch (  final Exception e) {
    LOGGER.error("String_Node_Str",e);
    return null;
  }
}
Program: 113063
Project: 113063
Buggy source:
@Override public DataStore createStore(final Map<String,Object> configOptions,final String namespace){
  return new HBaseDataStore(GeoWaveStoreFinder.createIndexStore(configOptions,namespace),GeoWaveStoreFinder.createAdapterStore(configOptions,namespace),GeoWaveStoreFinder.createDataStatisticsStore(configOptions,namespace),GeoWaveStoreFinder.createAdapterIndexMappingStore(configOptions,namespace),GeoWaveStoreFinder.createSecondaryIndexDataStore(configOptions,namespace),createOperations(configOptions,namespace));
}

Fixed version (ground truth):
@Override public DataStore createStore(final StoreFactoryOptions options){
  if (!(options instanceof HBaseRequiredOptions)) {
    throw new AssertionError("String_Node_Str" + HBaseRequiredOptions.class.getSimpleName());
  }
  final HBaseRequiredOptions opts=(HBaseRequiredOptions)options;
  if (opts.getAdditionalOptions() == null) {
    opts.setAdditionalOptions(new HBaseOptions());
  }
  final BasicHBaseOperations hbaseOperations=createOperations(opts);
  return new HBaseDataStore(new HBaseIndexStore(hbaseOperations),new HBaseAdapterStore(hbaseOperations),new HBaseDataStatisticsStore(hbaseOperations),new HBaseAdapterIndexMappingStore(hbaseOperations),new HBaseSecondaryIndexDataStore(hbaseOperations,opts.getAdditionalOptions()),hbaseOperations,opts.getAdditionalOptions());
}
Program: 113064
Project: 113064
Buggy source:
private synchronized void ensureOpen(){
  if (writer == null) {
    try {
      writer=operations.createWriter(StringUtils.stringFromBinary(index.getId().getBytes()),adapter.getAdapterId().getString(),options.createTable);
    }
 catch (    final IOException e) {
      LOGGER.error("String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
private synchronized void ensureOpen(){
  if (writer == null) {
    try {
      writer=operations.createWriter(StringUtils.stringFromBinary(index.getId().getBytes()),adapter.getAdapterId().getString(),options.isCreateTable());
    }
 catch (    final IOException e) {
      LOGGER.error("String_Node_Str",e);
    }
  }
}
Program: 113065
Project: 113065
Buggy source:
@Override public SecondaryIndexDataStore createStore(final Map<String,Object> configOptions,final String namespace){
  return new HBaseSecondaryIndexDataStore(createOperations(configOptions,namespace),new HBaseOptions());
}

Fixed version (ground truth):
@Override public SecondaryIndexDataStore createStore(final StoreFactoryOptions options){
  if (!(options instanceof HBaseRequiredOptions)) {
    throw new AssertionError("String_Node_Str" + HBaseRequiredOptions.class.getSimpleName());
  }
  final HBaseRequiredOptions opts=(HBaseRequiredOptions)options;
  if (opts.getAdditionalOptions() == null) {
    opts.setAdditionalOptions(new HBaseOptions());
  }
  return new HBaseSecondaryIndexDataStore(createOperations(opts),opts.getAdditionalOptions());
}
Program: 113066
Project: 113066
Buggy source:
@Override public AdapterIndexMappingStore createStore(final Map<String,Object> configOptions,final String namespace){
  return new HBaseAdapterIndexMappingStore(createOperations(configOptions,namespace));
}

Fixed version (ground truth):
@Override public AdapterIndexMappingStore createStore(final StoreFactoryOptions options){
  if (!(options instanceof HBaseRequiredOptions)) {
    throw new AssertionError("String_Node_Str" + HBaseRequiredOptions.class.getSimpleName());
  }
  final HBaseRequiredOptions opts=(HBaseRequiredOptions)options;
  if (opts.getAdditionalOptions() == null) {
    opts.setAdditionalOptions(new HBaseOptions());
  }
  return new HBaseAdapterIndexMappingStore(createOperations(opts));
}
Program: 113067
Project: 113067
Buggy source:
@Override public AdapterStore createStore(final Map<String,Object> configOptions,final String namespace){
  return new HBaseAdapterStore(createOperations(configOptions,namespace));
}

Fixed version (ground truth):
@Override public AdapterStore createStore(final StoreFactoryOptions options){
  if (!(options instanceof HBaseRequiredOptions)) {
    throw new AssertionError("String_Node_Str" + HBaseRequiredOptions.class.getSimpleName());
  }
  final HBaseRequiredOptions opts=(HBaseRequiredOptions)options;
  return new HBaseAdapterStore(createOperations(opts));
}
Program: 113068
Project: 113068
Buggy source:
@Override public DataStatisticsStore createStore(final Map<String,Object> configOptions,final String namespace){
  return new HBaseDataStatisticsStore(createOperations(configOptions,namespace));
}

Fixed version (ground truth):
@Override public DataStatisticsStore createStore(final StoreFactoryOptions options){
  if (!(options instanceof HBaseRequiredOptions)) {
    throw new AssertionError("String_Node_Str" + HBaseRequiredOptions.class.getSimpleName());
  }
  final HBaseRequiredOptions opts=(HBaseRequiredOptions)options;
  return new HBaseDataStatisticsStore(createOperations(opts));
}
Program: 113069
Project: 113069
Buggy source:
public static void printVersionInfo(){
  final File buildPropertiesFile=getBuildPropertiesFile();
  if (buildPropertiesFile != null) {
    try (Scanner scanner=new Scanner(buildPropertiesFile,ConfigOptions.CHARSET)){
      while (scanner.hasNextLine()) {
        final String line=scanner.nextLine();
        JCommander.getConsole().println(line);
      }
      scanner.close();
    }
 catch (    final IOException e) {
      JCommander.getConsole().print("String_Node_Str" + e.getMessage());
    }
  }
 else {
    JCommander.getConsole().print("String_Node_Str");
  }
}

Fixed version (ground truth):
public static void printVersionInfo(){
  final List<String> buildAndPropertyList=Arrays.asList(getBuildProperties().toString().split("String_Node_Str"));
  if (buildAndPropertyList != null) {
    Collections.sort(buildAndPropertyList.subList(1,buildAndPropertyList.size()));
    for (    String str : buildAndPropertyList) {
      JCommander.getConsole().println(str);
    }
  }
 else {
    JCommander.getConsole().println("String_Node_Str");
  }
}
Program: 113072
Project: 113072
Buggy source:
public IngestTask(LocalIngestRunData runData,Map<ByteArrayId,PrimaryIndex> specifiedPrimaryIndexes,Map<ByteArrayId,PrimaryIndex> requiredIndexMap,BlockingQueue<GeoWaveData<?>> queue){
  this.runData=runData;
  this.specifiedPrimaryIndexes=specifiedPrimaryIndexes;
  this.requiredIndexMap=requiredIndexMap;
  this.readQueue=queue;
}

Fixed version (ground truth):
public IngestTask(String id,LocalIngestRunData runData,Map<ByteArrayId,PrimaryIndex> specifiedPrimaryIndexes,Map<ByteArrayId,PrimaryIndex> requiredIndexMap,BlockingQueue<GeoWaveData<?>> queue){
  this.id=id;
  this.runData=runData;
  this.specifiedPrimaryIndexes=specifiedPrimaryIndexes;
  this.requiredIndexMap=requiredIndexMap;
  this.readQueue=queue;
}
Program: 113076
Project: 113076
Buggy source:
@Override public PrimaryIndex wrapIndexWithOptions(final PrimaryIndex index){
  PrimaryIndex retVal=index;
  if ((options.numPartitions > 1) && !options.partitionStrategy.equals(PartitionStrategy.HASH)) {
    retVal=new CustomIdIndex(new CompoundIndexStrategy(new HashKeyIndexStrategy(index.getIndexStrategy().getOrderedDimensionDefinitions(),options.numPartitions),index.getIndexStrategy()),index.getIndexModel(),new ByteArrayId(index.getId().getString() + "String_Node_Str" + options.partitionStrategy.name()+ "String_Node_Str"+ options.numPartitions));
  }
 else   if ((options.numPartitions > 1) && !options.partitionStrategy.equals(PartitionStrategy.ROUND_ROBIN)) {
    retVal=new CustomIdIndex(new CompoundIndexStrategy(new RoundRobinKeyIndexStrategy(options.numPartitions),index.getIndexStrategy()),index.getIndexModel(),new ByteArrayId(index.getId().getString() + "String_Node_Str" + options.partitionStrategy.name()+ "String_Node_Str"+ options.numPartitions));
  }
  if ((options.nameOverride != null) && (options.nameOverride.length() > 0)) {
    retVal=new CustomIdIndex(retVal.getIndexStrategy(),retVal.getIndexModel(),new ByteArrayId(options.nameOverride));
  }
  return retVal;
}

Fixed version (ground truth):
@Override public PrimaryIndex wrapIndexWithOptions(final PrimaryIndex index){
  PrimaryIndex retVal=index;
  if ((options.numPartitions > 1) && options.partitionStrategy.equals(PartitionStrategy.HASH)) {
    retVal=new CustomIdIndex(new CompoundIndexStrategy(new HashKeyIndexStrategy(index.getIndexStrategy().getOrderedDimensionDefinitions(),options.numPartitions),index.getIndexStrategy()),index.getIndexModel(),new ByteArrayId(index.getId().getString() + "String_Node_Str" + PartitionStrategy.HASH.name()+ "String_Node_Str"+ options.numPartitions));
  }
 else   if (options.numPartitions > 1) {
    if (options.partitionStrategy.equals(PartitionStrategy.NONE)) {
      LOGGER.warn("String_Node_Str");
    }
    retVal=new CustomIdIndex(new CompoundIndexStrategy(new RoundRobinKeyIndexStrategy(options.numPartitions),index.getIndexStrategy()),index.getIndexModel(),new ByteArrayId(index.getId().getString() + "String_Node_Str" + PartitionStrategy.ROUND_ROBIN.name()+ "String_Node_Str"+ options.numPartitions));
  }
  if ((options.nameOverride != null) && (options.nameOverride.length() > 0)) {
    retVal=new CustomIdIndex(retVal.getIndexStrategy(),retVal.getIndexModel(),new ByteArrayId(options.nameOverride));
  }
  return retVal;
}
Program: 113077
Project: 113077
Buggy source:
public static final double getDimensionalBitsUsed(final NumericIndexStrategy indexStrategy,final double[] dataRangePerDimension){
  double result=Long.MAX_VALUE;
  if (dataRangePerDimension.length == 0) {
    return 0;
  }
  final double cellRangePerDimension[]=indexStrategy.getHighestPrecisionIdRangePerDimension();
  final double bitsPerDimension[]=getBitsPerDimension(indexStrategy,cellRangePerDimension);
  for (int d=0; d < dataRangePerDimension.length; d++) {
    final double bitsUsed=bitsPerDimension[d] - log2(Math.ceil(dataRangePerDimension[d] / cellRangePerDimension[d]));
    result=Math.min(bitsUsed,result);
  }
  return result * cellRangePerDimension.length;
}

Fixed version (ground truth):
public static final double getDimensionalBitsUsed(final NumericIndexStrategy indexStrategy,final double[] dataRangePerDimension){
  double result=Long.MAX_VALUE;
  if (dataRangePerDimension.length == 0) {
    return 0;
  }
  final double cellRangePerDimension[]=indexStrategy.getHighestPrecisionIdRangePerDimension();
  final double bitsPerDimension[]=getBitsPerDimension(indexStrategy,cellRangePerDimension);
  for (int d=0; d < dataRangePerDimension.length; d++) {
    final double bitsUsed=bitsPerDimension[d] - log2(Math.ceil(dataRangePerDimension[d] / cellRangePerDimension[d]));
    if (bitsUsed <= 0) {
      return 0;
    }
    result=Math.min(bitsUsed,result);
  }
  return result * cellRangePerDimension.length;
}
Program: 113078
Project: 113078
Buggy source:
public void addRangeVariables(String start,String end){
  validParamRanges.add(new String[]{start,end});
}

Fixed version (ground truth):
public void addRangeVariables(final String start,final String end){
  validParamRanges.add(new String[]{start,end});
}
Program: 113081
Project: 113081
Buggy source:
public GDELTIngestPlugin(){
  setIncludeSupplementalFields(false);
  eventKey=new ByteArrayId(StringUtils.stringToBinary(GDELTUtils.GDELT_EVENT_FEATURE));
  try {
    crs=CRS.decode(CRS_AUTHORITY);
  }
 catch (  final FactoryException e) {
    LOGGER.error("String_Node_Str",e);
  }
}

Fixed version (ground truth):
public GDELTIngestPlugin(){
  setIncludeSupplementalFields(false);
  eventKey=new ByteArrayId(StringUtils.stringToBinary(GDELTUtils.GDELT_EVENT_FEATURE));
}
Program: 113082
Project: 113082
Buggy source:
public static Pair<Double,Double> parseLatLon(final String[] vals,final CoordinateReferenceSystem crs){
  String latString=vals[GDELTUtils.GDELT_ACTION_LATITUDE_COLUMN_ID];
  String lonString=vals[GDELTUtils.GDELT_ACTION_LONGITUDE_COLUMN_ID];
  if ((latString == null) || (lonString == null) || (latString.length() < 1)|| (lonString.length() < 1)) {
    latString=vals[GDELTUtils.GDELT_ACTOR1_LATITUDE_COLUMN_ID];
    lonString=vals[GDELTUtils.GDELT_ACTOR1_LONGITUDE_COLUMN_ID];
  }
  if ((latString == null) || (lonString == null) || (latString.length() < 1)|| (lonString.length() < 1)) {
    latString=vals[GDELTUtils.GDELT_ACTOR2_LATITUDE_COLUMN_ID];
    lonString=vals[GDELTUtils.GDELT_ACTOR2_LONGITUDE_COLUMN_ID];
  }
  final Double lat=GeometryUtils.adjustCoordinateDimensionToRange(Double.parseDouble(latString),crs,1);
  final Double lon=GeometryUtils.adjustCoordinateDimensionToRange(Double.parseDouble(lonString),crs,0);
  return Pair.of(lat,lon);
}

Fixed version (ground truth):
public static Pair<Double,Double> parseLatLon(final String[] vals){
  String latString=vals[GDELTUtils.GDELT_ACTION_LATITUDE_COLUMN_ID];
  String lonString=vals[GDELTUtils.GDELT_ACTION_LONGITUDE_COLUMN_ID];
  if ((latString == null) || (lonString == null) || latString.trim().isEmpty()|| lonString.trim().isEmpty()) {
    latString=vals[GDELTUtils.GDELT_ACTOR1_LATITUDE_COLUMN_ID];
    lonString=vals[GDELTUtils.GDELT_ACTOR1_LONGITUDE_COLUMN_ID];
  }
  if ((latString == null) || (lonString == null) || latString.trim().isEmpty()|| lonString.trim().isEmpty()) {
    latString=vals[GDELTUtils.GDELT_ACTOR2_LATITUDE_COLUMN_ID];
    lonString=vals[GDELTUtils.GDELT_ACTOR2_LONGITUDE_COLUMN_ID];
  }
  if ((latString == null) || (lonString == null) || latString.trim().isEmpty()|| lonString.trim().isEmpty()) {
    return null;
  }
  final Double lat=Double.parseDouble(latString);
  final Double lon=Double.parseDouble(lonString);
  return Pair.of(lat,lon);
}
Program: 113083
Project: 113083
Buggy source:
@Override public IngestFormatOptionProvider getIngestFormatOptionProvider(){
  return new MultiOptionProvider((IngestFormatOptionProvider[])getIngestFormatOptionProviders().toArray());
}

Fixed version (ground truth):
@Override public IngestFormatOptionProvider getIngestFormatOptionProvider(){
  return new MultiOptionProvider(getIngestFormatOptionProviders().toArray(new IngestFormatOptionProvider[]{}));
}
Program: 113086
Project: 113086
Buggy source:
public static IngestCommandLineOptions parseOptions(final CommandLine commandLine) throws ParseException {
  final boolean success=true;
  boolean clearNamespace=false;
  final int randomPartitions=-1;
  if (commandLine.hasOption("String_Node_Str")) {
    clearNamespace=true;
  }
  String visibility=null;
  if (commandLine.hasOption("String_Node_Str")) {
    visibility=commandLine.getOptionValue("String_Node_Str");
  }
  final String dimensionalityType=commandLine.getOptionValue("String_Node_Str",IngestUtils.getDefaultDimensionalityType());
  if (!success) {
    throw new ParseException("String_Node_Str");
  }
  return new IngestCommandLineOptions(visibility,clearNamespace,dimensionalityType);
}

Fixed version (ground truth):
public static IngestCommandLineOptions parseOptions(final CommandLine commandLine) throws ParseException {
  final boolean success=true;
  boolean clearNamespace=false;
  if (commandLine.hasOption("String_Node_Str")) {
    clearNamespace=true;
  }
  String visibility=null;
  if (commandLine.hasOption("String_Node_Str")) {
    visibility=commandLine.getOptionValue("String_Node_Str");
  }
  final String dimensionalityType=commandLine.getOptionValue("String_Node_Str",IngestUtils.getDefaultDimensionalityType());
  if (!success) {
    throw new ParseException("String_Node_Str");
  }
  return new IngestCommandLineOptions(visibility,clearNamespace,dimensionalityType);
}
Program: 113087
Project: 113087
Buggy source:
public void setTrackPointData(final byte[] geometry,final byte[] image,final String missionUUID,final String trackNumber,final String trackUUID,final String trackStatus,final String trackClassification,final String trackItemUUID,final String trackPointSource,final long timeStamp,final long endTimeStamp,final double speed,final double course,final String trackItemClassification,final double latitude,final double longitude,final double elevation,final int pixelRow,final int pixelColumn,final int frameNumber){
  EventType=new IntWritable(0);
  Geometry=new BytesWritable(geometry);
  Image=new BytesWritable(image);
  MissionUUID=new Text(missionUUID);
  TrackNumber=new Text(trackNumber);
  TrackUUID=new Text(trackUUID);
  TrackStatus=new Text(trackStatus);
  TrackClassification=new Text(trackClassification);
  TrackItemUUID=new Text(trackItemUUID);
  TrackPointSource=new Text(trackPointSource);
  TimeStamp=new LongWritable(timeStamp);
  EndTimeStamp=new LongWritable(endTimeStamp);
  Speed=new DoubleWritable(speed);
  Course=new DoubleWritable(course);
  TrackItemClassification=new Text(trackItemClassification);
  Latitude=new DoubleWritable(latitude);
  Longitude=new DoubleWritable(longitude);
  Elevation=new DoubleWritable(elevation);
  PixelRow=new IntWritable(pixelRow);
  PixelColumn=new IntWritable(pixelColumn);
  FrameNumber=new IntWritable(frameNumber);
}

Fixed version (ground truth):
public void setTrackPointData(final byte[] geometry,final byte[] image,final String missionUUID,final String trackNumber,final String trackUUID,final String trackStatus,final String trackClassification,final String trackItemUUID,final String trackPointSource,final long timeStamp,final long endTimeStamp,final double speed,final double course,final String trackItemClassification,final double latitude,final double longitude,final double elevation,final int pixelRow,final int pixelColumn,final int frameNumber){
  EventType=new IntWritable(0);
  Geometry=new BytesWritable(geometry);
  if (image != null) {
    Image=new BytesWritable(image);
  }
  MissionUUID=new Text(missionUUID);
  TrackNumber=new Text(trackNumber);
  TrackUUID=new Text(trackUUID);
  TrackStatus=new Text(trackStatus);
  TrackClassification=new Text(trackClassification);
  TrackItemUUID=new Text(trackItemUUID);
  TrackPointSource=new Text(trackPointSource);
  TimeStamp=new LongWritable(timeStamp);
  EndTimeStamp=new LongWritable(endTimeStamp);
  Speed=new DoubleWritable(speed);
  Course=new DoubleWritable(course);
  TrackItemClassification=new Text(trackItemClassification);
  Latitude=new DoubleWritable(latitude);
  Longitude=new DoubleWritable(longitude);
  Elevation=new DoubleWritable(elevation);
  PixelRow=new IntWritable(pixelRow);
  PixelColumn=new IntWritable(pixelColumn);
  FrameNumber=new IntWritable(frameNumber);
}
Program: 113088
Project: 113088
Buggy source:
public void setMotionPointData(final byte[] geometry,final byte[] image,final String missionUUID,final String trackNumber,final String trackUUID,final String trackStatus,final String trackClassification,final String trackItemUUID,final String trackPointSource,final long timeStamp,final long endTimeStamp,final double speed,final double course,final String trackItemClassification,final double latitude,final double longitude,final double elevation,final int pixelRow,final int pixelColumn,final int frameNumber,final String motionEvent){
  EventType=new IntWritable(1);
  Geometry=new BytesWritable(geometry);
  Image=new BytesWritable(image);
  MissionUUID=new Text(missionUUID);
  TrackNumber=new Text(trackNumber);
  TrackUUID=new Text(trackUUID);
  TrackStatus=new Text(trackStatus);
  TrackClassification=new Text(trackClassification);
  TrackItemUUID=new Text(trackItemUUID);
  TrackPointSource=new Text(trackPointSource);
  TimeStamp=new LongWritable(timeStamp);
  EndTimeStamp=new LongWritable(endTimeStamp);
  Speed=new DoubleWritable(speed);
  Course=new DoubleWritable(course);
  TrackItemClassification=new Text(trackItemClassification);
  Latitude=new DoubleWritable(latitude);
  Longitude=new DoubleWritable(longitude);
  Elevation=new DoubleWritable(elevation);
  PixelRow=new IntWritable(pixelRow);
  PixelColumn=new IntWritable(pixelColumn);
  FrameNumber=new IntWritable(frameNumber);
  MotionEvent=new Text(motionEvent);
}

Fixed version (ground truth):
public void setMotionPointData(final byte[] geometry,final byte[] image,final String missionUUID,final String trackNumber,final String trackUUID,final String trackStatus,final String trackClassification,final String trackItemUUID,final String trackPointSource,final long timeStamp,final long endTimeStamp,final double speed,final double course,final String trackItemClassification,final double latitude,final double longitude,final double elevation,final int pixelRow,final int pixelColumn,final int frameNumber,final String motionEvent){
  EventType=new IntWritable(1);
  Geometry=new BytesWritable(geometry);
  if (image != null) {
    Image=new BytesWritable(image);
  }
  MissionUUID=new Text(missionUUID);
  TrackNumber=new Text(trackNumber);
  TrackUUID=new Text(trackUUID);
  TrackStatus=new Text(trackStatus);
  TrackClassification=new Text(trackClassification);
  TrackItemUUID=new Text(trackItemUUID);
  TrackPointSource=new Text(trackPointSource);
  TimeStamp=new LongWritable(timeStamp);
  EndTimeStamp=new LongWritable(endTimeStamp);
  Speed=new DoubleWritable(speed);
  Course=new DoubleWritable(course);
  TrackItemClassification=new Text(trackItemClassification);
  Latitude=new DoubleWritable(latitude);
  Longitude=new DoubleWritable(longitude);
  Elevation=new DoubleWritable(elevation);
  PixelRow=new IntWritable(pixelRow);
  PixelColumn=new IntWritable(pixelColumn);
  FrameNumber=new IntWritable(frameNumber);
  MotionEvent=new Text(motionEvent);
}
Program: 113089
Project: 113089
Buggy source:
public void setMissionSummaryData(final byte[] geometry,final String missionUUID,final String missionName,final int missionNumFrames,final long timeStamp,final long endTimeStamp,final String classification,final String objectClass){
  EventType=new IntWritable(4);
  Geometry=new BytesWritable(geometry);
  MissionUUID=new Text(missionUUID);
  MissionName=new Text(missionName);
  MissionNumFrames=new IntWritable(missionNumFrames);
  TimeStamp=new LongWritable(timeStamp);
  EndTimeStamp=new LongWritable(timeStamp);
  TrackClassification=new Text(classification);
  ObjectClass=new Text(objectClass);
}

Fixed version (ground truth):
public void setMissionSummaryData(final byte[] geometry,final String missionUUID,final String missionName,final int missionNumFrames,final long timeStamp,final long endTimeStamp,final String classification,final String objectClass){
  EventType=new IntWritable(4);
  Geometry=new BytesWritable(geometry);
  MissionUUID=new Text(missionUUID);
  MissionName=new Text(missionName);
  MissionNumFrames=new IntWritable(missionNumFrames);
  TimeStamp=new LongWritable(timeStamp);
  EndTimeStamp=new LongWritable(endTimeStamp);
  TrackClassification=new Text(classification);
  ObjectClass=new Text(objectClass);
}
Program: 113093
Project: 113093
Buggy source:
/** 
 * Convenience constructor used to construct a simple latitude dimension object which sits on a Cartesian plane.
 */
public LatitudeDefinition(){
  super(-90,90);
}

Fixed version (ground truth):
/** 
 * Convenience constructor used to construct a simple latitude dimension object which sits on a Cartesian plane. You can pass in a flag to use half the range if you want square SFC IDs in decimal degree latitudes and longitudes
 */
public LatitudeDefinition(final boolean useHalfRange){
  super(useHalfRange ? -180 : -90,useHalfRange ? 180 : 90);
}
Program: 113094
Project: 113094
Buggy source:
@Override public byte[] toBinary(){
  return new byte[]{};
}

Fixed version (ground truth):
@Override public byte[] toBinary(){
  return new byte[]{(byte)(((min > -180) && (max < 180)) ? 0 : 1)};
}
Program: 113095
Project: 113095
Buggy source:
@Override public void fromBinary(byte[] bytes){
}

Fixed version (ground truth):
@Override public void fromBinary(final byte[] bytes){
  if ((bytes != null) && (bytes.length > 0)) {
    if (bytes[0] == (byte)1) {
      min=-180;
      max=180;
    }
  }
}
Program: 113096
Project: 113096
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: 113099
Project: 113099
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: 113100
Project: 113100
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: 113101
Project: 113101
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: 113102
Project: 113102
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: 113103
Project: 113103
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: 113104
Project: 113104
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: 113105
Project: 113105
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: 113106
Project: 113106
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);
}