nus-yam/ex-repair huggingface dataset:
Program: 47909
Project: 47909
Buggy source:
@Before public void setUp(){
  configuration=new Configuration();
  tableFactory=mock(HBaseTableFactory.class);
  tableManager=new RepositoryTableManagerImpl(configuration,tableFactory);
}

Fixed version (ground truth):
@Before public void setUp(){
  configuration=new Configuration();
  tableFactory=mock(HBaseTableFactory.class);
  tableManager=new RepositoryTableManagerImpl("String_Node_Str",configuration,tableFactory);
}
Program: 47912
Project: 47912
Buggy source:
/** 
 * Refreshes the whole cache to contain the given list of record types.
 * @param recordTypes
 * @throws InterruptedException
 */
public void refreshRecordTypes(List<RecordType> recordTypes) throws InterruptedException {
synchronized (monitor) {
    while (count > 0) {
      monitor.wait();
    }
    nameCacheOutOfDate=true;
    childRecordTypesOutOfDate=true;
    for (    RecordType recordType : recordTypes) {
      String bucketId=AbstractSchemaCache.encodeHex(recordType.getId().getBytes());
      if (!removeFromLocalUpdateBucket(recordType.getId(),bucketId)) {
        Map<SchemaId,RecordType> bucket=buckets.get(bucketId);
        if (bucket == null) {
          bucket=new ConcurrentHashMap<SchemaId,RecordType>();
          buckets.put(bucketId,bucket);
        }
        bucket.put(recordType.getId(),recordType);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Refreshes the whole cache to contain the given list of record types.
 * @param recordTypes
 * @throws InterruptedException
 */
public void refreshRecordTypes(List<RecordType> recordTypes) throws InterruptedException {
synchronized (monitor) {
    while (count > 0) {
      monitor.wait();
    }
    nameCacheOutOfDate=true;
    childRecordTypesOutOfDate=true;
    for (    RecordType recordType : recordTypes) {
      String bucketId=AbstractSchemaCache.encodeHex(recordType.getId().getBytes());
      if (!removeFromLocalUpdateBucket(recordType,bucketId)) {
        Map<SchemaId,RecordType> bucket=buckets.get(bucketId);
        if (bucket == null) {
          bucket=new ConcurrentHashMap<SchemaId,RecordType>();
          buckets.put(bucketId,bucket);
        }
        bucket.put(recordType.getId(),recordType);
      }
    }
  }
}
Program: 47913
Project: 47913
Buggy source:
private boolean removeFromLocalUpdateBucket(SchemaId id,String bucketId){
  Set<SchemaId> localUpdateBucket=localUpdateBuckets.get(bucketId);
  if (localUpdateBucket == null) {
    return false;
  }
  return localUpdateBucket.remove(id);
}

Fixed version (ground truth):
private boolean removeFromLocalUpdateBucket(RecordType recordType,String bucketId){
  Map<SchemaId,RecordType> localUpdateBucket=localUpdateBuckets.get(bucketId);
  if (localUpdateBucket == null) {
    return false;
  }
  RecordType localRt=localUpdateBucket.remove(recordType.getId());
  if (localRt == null) {
    return false;
  }
  return localRt.getVersion() > recordType.getVersion();
}
Program: 47914
Project: 47914
Buggy source:
public void clear(){
  nameCache.clear();
  for (  Map bucket : buckets.values()) {
    bucket.clear();
  }
  for (  Set<SchemaId> bucket : localUpdateBuckets.values()) {
    bucket.clear();
  }
}

Fixed version (ground truth):
public void clear(){
  nameCache.clear();
  for (  Map bucket : buckets.values()) {
    bucket.clear();
  }
  for (  Map<SchemaId,RecordType> bucket : localUpdateBuckets.values()) {
    bucket.clear();
  }
}
Program: 47915
Project: 47915
Buggy source:
/** 
 * Refresh one bucket with the record types contained in the TypeBucket
 * @param typeBucket
 */
public void refreshRecordTypeBucket(TypeBucket typeBucket){
  String bucketId=typeBucket.getBucketId();
  incCount();
synchronized (getBucketMonitor(bucketId)) {
    List<RecordType> recordTypes=typeBucket.getRecordTypes();
    Map<SchemaId,RecordType> bucket=buckets.get(bucketId);
    if (bucket == null) {
      bucket=new ConcurrentHashMap<SchemaId,RecordType>(Math.min(recordTypes.size(),8),.75f,1);
      buckets.put(bucketId,bucket);
    }
    for (    RecordType recordType : recordTypes) {
      if (!removeFromLocalUpdateBucket(recordType.getId(),bucketId)) {
        bucket.put(recordType.getId(),recordType);
      }
    }
  }
  decCount();
}

Fixed version (ground truth):
/** 
 * Refresh one bucket with the record types contained in the TypeBucket
 * @param typeBucket
 */
public void refreshRecordTypeBucket(TypeBucket typeBucket){
  String bucketId=typeBucket.getBucketId();
  incCount();
synchronized (getBucketMonitor(bucketId)) {
    List<RecordType> recordTypes=typeBucket.getRecordTypes();
    Map<SchemaId,RecordType> bucket=buckets.get(bucketId);
    if (bucket == null) {
      bucket=new ConcurrentHashMap<SchemaId,RecordType>(Math.min(recordTypes.size(),8),.75f,1);
      buckets.put(bucketId,bucket);
    }
    for (    RecordType recordType : recordTypes) {
      if (!removeFromLocalUpdateBucket(recordType,bucketId)) {
        bucket.put(recordType.getId(),recordType);
      }
    }
  }
  decCount();
}
Program: 47916
Project: 47916
Buggy source:
/** 
 * Update the cache to contain the new recordType
 * @param recordType
 */
public void update(RecordType recordType){
  RecordType rtToCache=recordType.clone();
  SchemaId id=rtToCache.getId();
  String bucketId=AbstractSchemaCache.encodeHex(id.getBytes());
  incCount();
synchronized (getBucketMonitor(bucketId)) {
    Map<SchemaId,RecordType> bucket=buckets.get(bucketId);
    if (bucket == null) {
      bucket=new ConcurrentHashMap<SchemaId,RecordType>(8,.75f,1);
      buckets.put(bucketId,bucket);
    }
    bucket.put(id,rtToCache);
    addToLocalUpdateBucket(id,bucketId);
  }
  decCount();
}

Fixed version (ground truth):
/** 
 * Update the cache to contain the new recordType
 * @param recordType
 */
public void update(RecordType recordType){
  RecordType rtToCache=recordType.clone();
  SchemaId id=rtToCache.getId();
  String bucketId=AbstractSchemaCache.encodeHex(id.getBytes());
  incCount();
synchronized (getBucketMonitor(bucketId)) {
    Map<SchemaId,RecordType> bucket=buckets.get(bucketId);
    if (bucket == null) {
      bucket=new ConcurrentHashMap<SchemaId,RecordType>(8,.75f,1);
      buckets.put(bucketId,bucket);
    }
    bucket.put(id,rtToCache);
    addToLocalUpdateBucket(recordType,bucketId);
  }
  decCount();
}
Program: 47917
Project: 47917
Buggy source:
private void addToLocalUpdateBucket(SchemaId id,String bucketId){
  Set<SchemaId> localUpdateBucket=localUpdateBuckets.get(bucketId);
  if (localUpdateBucket == null) {
    localUpdateBucket=new HashSet<SchemaId>();
    localUpdateBuckets.put(bucketId,localUpdateBucket);
  }
  localUpdateBucket.add(id);
}

Fixed version (ground truth):
private void addToLocalUpdateBucket(RecordType recordType,String bucketId){
  Map<SchemaId,RecordType> localUpdateBucket=localUpdateBuckets.get(bucketId);
  if (localUpdateBucket == null) {
    localUpdateBucket=new HashMap<SchemaId,RecordType>();
    localUpdateBuckets.put(bucketId,localUpdateBucket);
  }
  localUpdateBucket.put(recordType.getId(),recordType);
}
Program: 47918
Project: 47918
Buggy source:
public static BlobManager getBlobManager(ZooKeeperItf zk,Configuration configuration) throws IOException {
  HBaseTableFactory hbaseTableFactory=new HBaseTableFactoryImpl(configuration);
  URI dfsUri=getDfsUri(zk);
  FileSystem fs=FileSystem.get(DfsUri.getBaseDfsUri(dfsUri),configuration);
  Path blobRootPath=new Path(DfsUri.getDfsPath(dfsUri));
  BlobStoreAccess dfsBlobStoreAccess=new DFSBlobStoreAccess(fs,blobRootPath);
  BlobStoreAccess hbaseBlobStoreAccess=new HBaseBlobStoreAccess(configuration,true);
  BlobStoreAccess inlineBlobStoreAccess=new InlineBlobStoreAccess();
  List<BlobStoreAccess> blobStoreAccesses=Arrays.asList(dfsBlobStoreAccess,hbaseBlobStoreAccess,inlineBlobStoreAccess);
  SizeBasedBlobStoreAccessFactory blobStoreAccessFactory=new SizeBasedBlobStoreAccessFactory(blobStoreAccesses,getBlobStoreAccessConfig(zk));
  return new BlobManagerImpl(hbaseTableFactory,blobStoreAccessFactory,true);
}

Fixed version (ground truth):
public static BlobManager getBlobManager(ZooKeeperItf zk,Configuration configuration) throws IOException, InterruptedException {
  HBaseTableFactory hbaseTableFactory=new HBaseTableFactoryImpl(configuration);
  URI dfsUri=getDfsUri(zk);
  FileSystem fs=FileSystem.get(DfsUri.getBaseDfsUri(dfsUri),configuration);
  Path blobRootPath=new Path(DfsUri.getDfsPath(dfsUri));
  BlobStoreAccess dfsBlobStoreAccess=new DFSBlobStoreAccess(fs,blobRootPath);
  BlobStoreAccess hbaseBlobStoreAccess=new HBaseBlobStoreAccess(configuration,true);
  BlobStoreAccess inlineBlobStoreAccess=new InlineBlobStoreAccess();
  List<BlobStoreAccess> blobStoreAccesses=Arrays.asList(dfsBlobStoreAccess,hbaseBlobStoreAccess,inlineBlobStoreAccess);
  SizeBasedBlobStoreAccessFactory blobStoreAccessFactory=new SizeBasedBlobStoreAccessFactory(blobStoreAccesses,getBlobStoreAccessConfig(zk));
  return new BlobManagerImpl(hbaseTableFactory,blobStoreAccessFactory,true);
}
Program: 47919
Project: 47919
Buggy source:
public BlobIncubatorMonitor(ZooKeeperItf zk,HBaseTableFactory tableFactory,BlobManager blobManager,TypeManager typeManager,long minimalAge,long monitorDelay,long runDelay) throws IOException {
  this.zk=zk;
  this.blobManager=blobManager;
  this.typeManager=typeManager;
  this.minimalAge=minimalAge;
  this.monitorDelay=monitorDelay;
  this.runDelay=runDelay;
  this.blobIncubatorTable=LilyHBaseSchema.getBlobIncubatorTable(tableFactory,false);
  this.recordTable=LilyHBaseSchema.getRecordTable(tableFactory);
}

Fixed version (ground truth):
public BlobIncubatorMonitor(ZooKeeperItf zk,HBaseTableFactory tableFactory,BlobManager blobManager,TypeManager typeManager,long minimalAge,long monitorDelay,long runDelay) throws IOException, InterruptedException {
  this.zk=zk;
  this.blobManager=blobManager;
  this.typeManager=typeManager;
  this.minimalAge=minimalAge;
  this.monitorDelay=monitorDelay;
  this.runDelay=runDelay;
  this.blobIncubatorTable=LilyHBaseSchema.getBlobIncubatorTable(tableFactory,false);
  this.recordTable=LilyHBaseSchema.getRecordTable(tableFactory);
}
Program: 47920
Project: 47920
Buggy source:
public BlobManagerImpl(HBaseTableFactory hbaseTableFactory,BlobStoreAccessFactory blobStoreAccessFactory,boolean clientMode) throws IOException {
  blobIncubatorTable=LilyHBaseSchema.getBlobIncubatorTable(hbaseTableFactory,clientMode);
  registry=new BlobStoreAccessRegistry(this);
  registry.setBlobStoreAccessFactory(blobStoreAccessFactory);
}

Fixed version (ground truth):
public BlobManagerImpl(HBaseTableFactory hbaseTableFactory,BlobStoreAccessFactory blobStoreAccessFactory,boolean clientMode) throws IOException, InterruptedException {
  blobIncubatorTable=LilyHBaseSchema.getBlobIncubatorTable(hbaseTableFactory,clientMode);
  registry=new BlobStoreAccessRegistry(this);
  registry.setBlobStoreAccessFactory(blobStoreAccessFactory);
}
Program: 47921
Project: 47921
Buggy source:
public HBaseBlobStoreAccess(HBaseTableFactory tableFactory,boolean clientMode) throws IOException {
  HTableDescriptor tableDescriptor=new HTableDescriptor(BLOB_TABLE);
  tableDescriptor.addFamily(new HColumnDescriptor(BLOBS_COLUMN_FAMILY));
  table=tableFactory.getTable(tableDescriptor,!clientMode);
}

Fixed version (ground truth):
public HBaseBlobStoreAccess(HBaseTableFactory tableFactory,boolean clientMode) throws IOException, InterruptedException {
  HTableDescriptor tableDescriptor=new HTableDescriptor(BLOB_TABLE);
  tableDescriptor.addFamily(new HColumnDescriptor(BLOBS_COLUMN_FAMILY));
  table=tableFactory.getTable(tableDescriptor,!clientMode);
}
Program: 47922
Project: 47922
Buggy source:
public HBaseRepository(TypeManager typeManager,IdGenerator idGenerator,RowLog wal,HBaseTableFactory hbaseTableFactory,BlobManager blobManager,RowLocker rowLocker) throws IOException {
  super(typeManager,blobManager,idGenerator,LilyHBaseSchema.getRecordTable(hbaseTableFactory),new RepositoryMetrics("String_Node_Str"));
  this.wal=wal;
  this.rowLocker=rowLocker;
}

Fixed version (ground truth):
public HBaseRepository(TypeManager typeManager,IdGenerator idGenerator,RowLog wal,HBaseTableFactory hbaseTableFactory,BlobManager blobManager,RowLocker rowLocker) throws IOException, InterruptedException {
  super(typeManager,blobManager,idGenerator,LilyHBaseSchema.getRecordTable(hbaseTableFactory),new RepositoryMetrics("String_Node_Str"));
  this.wal=wal;
  this.rowLocker=rowLocker;
}
Program: 47923
Project: 47923
Buggy source:
public RemoteRepository(InetSocketAddress address,AvroConverter converter,RemoteTypeManager typeManager,IdGenerator idGenerator,BlobManager blobManager,Configuration hbaseConf) throws IOException {
  super(typeManager,blobManager,idGenerator,LilyHBaseSchema.getRecordTable(new HBaseTableFactoryImpl(hbaseConf),true),null);
  this.converter=converter;
  client=NettyTransceiverFactory.create(address);
  lilyProxy=SpecificRequestor.getClient(AvroLily.class,client);
}

Fixed version (ground truth):
public RemoteRepository(InetSocketAddress address,AvroConverter converter,RemoteTypeManager typeManager,IdGenerator idGenerator,BlobManager blobManager,Configuration hbaseConf) throws IOException, InterruptedException {
  super(typeManager,blobManager,idGenerator,LilyHBaseSchema.getRecordTable(new HBaseTableFactoryImpl(hbaseConf),true),null);
  this.converter=converter;
  client=NettyTransceiverFactory.create(address);
  lilyProxy=SpecificRequestor.getClient(AvroLily.class,client);
}
Program: 47924
Project: 47924
Buggy source:
@Override public void handleBlobReferences(RecordId recordId,Set<BlobReference> referencedBlobs,Set<BlobReference> unReferencedBlobs){
  if (referencedBlobs != null) {
    try {
      for (      BlobReference blobReference : referencedBlobs) {
        blobIncubatorTable.delete(new Delete(blobReference.getBlob().getValue()));
      }
    }
 catch (    IOException e) {
      log.info("String_Node_Str" + recordId + "String_Node_Str",e);
    }
  }
  if (unReferencedBlobs != null) {
    Set<Blob> blobsToDelete=new HashSet<Blob>();
    for (    BlobReference blobReference : unReferencedBlobs) {
      blobsToDelete.add(blobReference.getBlob());
    }
    for (    Blob blobToDelete : blobsToDelete) {
      try {
        registry.delete(blobToDelete);
      }
 catch (      BlobException e) {
        log.warn("String_Node_Str" + recordId + "String_Node_Str",e);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void handleBlobReferences(RecordId recordId,Set<BlobReference> referencedBlobs,Set<BlobReference> unReferencedBlobs){
  if (referencedBlobs != null) {
    try {
      for (      BlobReference blobReference : referencedBlobs) {
        try {
          BlobStoreAccess blobStoreAccess=registry.getBlobStoreAccess(blobReference.getBlob());
          if (blobStoreAccess.incubate()) {
            blobIncubatorTable.delete(new Delete(blobReference.getBlob().getValue()));
          }
        }
 catch (        BlobNotFoundException bnfe) {
        }
catch (        BlobException be) {
        }
      }
    }
 catch (    IOException e) {
      log.info("String_Node_Str" + recordId + "String_Node_Str",e);
    }
  }
  if (unReferencedBlobs != null) {
    Set<Blob> blobsToDelete=new HashSet<Blob>();
    for (    BlobReference blobReference : unReferencedBlobs) {
      blobsToDelete.add(blobReference.getBlob());
    }
    for (    Blob blobToDelete : blobsToDelete) {
      try {
        registry.delete(blobToDelete);
      }
 catch (      BlobException e) {
        log.warn("String_Node_Str" + recordId + "String_Node_Str",e);
      }
    }
  }
}
Program: 47925
Project: 47925
Buggy source:
@Override public Set<BlobReference> reserveBlobs(Set<BlobReference> blobs) throws IOException {
  Set<BlobReference> failedBlobs=new HashSet<BlobReference>();
  for (  BlobReference referencedBlob : blobs) {
    if (!reserveBlob(referencedBlob))     failedBlobs.add(referencedBlob);
  }
  return failedBlobs;
}

Fixed version (ground truth):
@Override public Set<BlobReference> reserveBlobs(Set<BlobReference> blobs) throws IOException {
  Set<BlobReference> failedBlobs=new HashSet<BlobReference>();
  for (  BlobReference referencedBlob : blobs) {
    try {
      if (!reserveBlob(referencedBlob))       failedBlobs.add(referencedBlob);
    }
 catch (    BlobNotFoundException bnfe) {
      failedBlobs.add(referencedBlob);
    }
catch (    BlobException be) {
      failedBlobs.add(referencedBlob);
    }
  }
  return failedBlobs;
}
Program: 47926
Project: 47926
Buggy source:
public BlobManagerImpl(HBaseTableFactory hbaseTableFactory,BlobStoreAccessFactory blobStoreAccessFactory,boolean clientMode) throws IOException {
  this.factory=blobStoreAccessFactory;
  blobIncubatorTable=LilyHBaseSchema.getBlobIncubatorTable(hbaseTableFactory,clientMode);
  registry=new BlobStoreAccessRegistry(this);
  registry.setBlobStoreAccessFactory(blobStoreAccessFactory);
}

Fixed version (ground truth):
public BlobManagerImpl(HBaseTableFactory hbaseTableFactory,BlobStoreAccessFactory blobStoreAccessFactory,boolean clientMode) throws IOException {
  blobIncubatorTable=LilyHBaseSchema.getBlobIncubatorTable(hbaseTableFactory,clientMode);
  registry=new BlobStoreAccessRegistry(this);
  registry.setBlobStoreAccessFactory(blobStoreAccessFactory);
}
Program: 47927
Project: 47927
Buggy source:
private boolean reserveBlob(BlobReference referencedBlob) throws IOException {
  BlobStoreAccess blobStoreAccess=factory.get(referencedBlob.getBlob());
  if (!blobStoreAccess.incubate()) {
    return true;
  }
  byte[] row=referencedBlob.getBlob().getValue();
  byte[] family=BlobIncubatorCf.REF.bytes;
  byte[] recordQualifier=BlobIncubatorColumn.RECORD.bytes;
  byte[] fieldQualifier=BlobIncubatorColumn.FIELD.bytes;
  Put put=new Put(row);
  put.add(family,recordQualifier,referencedBlob.getRecordId().toBytes());
  put.add(family,fieldQualifier,referencedBlob.getFieldType().getId().getBytes());
  return blobIncubatorTable.checkAndPut(row,family,recordQualifier,INCUBATE,put);
}

Fixed version (ground truth):
private boolean reserveBlob(BlobReference referencedBlob) throws BlobNotFoundException, BlobException, IOException {
  BlobStoreAccess blobStoreAccess=registry.getBlobStoreAccess(referencedBlob.getBlob());
  if (!blobStoreAccess.incubate()) {
    return true;
  }
  byte[] row=referencedBlob.getBlob().getValue();
  byte[] family=BlobIncubatorCf.REF.bytes;
  byte[] recordQualifier=BlobIncubatorColumn.RECORD.bytes;
  byte[] fieldQualifier=BlobIncubatorColumn.FIELD.bytes;
  Put put=new Put(row);
  put.add(family,recordQualifier,referencedBlob.getRecordId().toBytes());
  put.add(family,fieldQualifier,referencedBlob.getFieldType().getId().getBytes());
  return blobIncubatorTable.checkAndPut(row,family,recordQualifier,INCUBATE,put);
}
Program: 47928
Project: 47928
Buggy source:
@Override public void addDependency(SchemaId field){
  RecordContext ctx=contexts.peek();
  try {
    if (!ctx.dep.id.equals(recordId)) {
      dependencies.get(DerefMapUtil.newEntry(ctx.dep.id,ctx.dep.vprops)).add(field);
    }
  }
 catch (  ExecutionException ee) {
    throw new RuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void addDependency(SchemaId field){
  RecordContext ctx=contexts.peek();
  try {
    if (!ctx.dep.vprops.isEmpty() || !ctx.dep.id.equals(recordId)) {
      dependencies.get(DerefMapUtil.newEntry(ctx.dep.id,ctx.dep.vprops)).add(field);
    }
  }
 catch (  ExecutionException ee) {
    throw new RuntimeException("String_Node_Str");
  }
}
Program: 47929
Project: 47929
Buggy source:
/** 
 * Private constructor. Clients should use static factory methods   {@link #delete(String,org.apache.hadoop.conf.Configuration)} and {@link #create(String,org.apache.hadoop.conf.Configuration,org.lilyproject.repository.api.IdGenerator)}
 */
private DerefMapHbaseImpl(final String indexName,final Configuration hbaseConfiguration,final IdGenerator idGenerator) throws IndexNotFoundException, IOException, InterruptedException {
  this.idGenerator=idGenerator;
  final IndexManager indexManager=new IndexManager(hbaseConfiguration);
  IndexDefinition forwardIndexDef=new IndexDefinition(forwardIndexName(indexName));
  forwardIndexDef.addVariableLengthByteField("String_Node_Str",2);
  forwardIndexDef.addByteField("String_Node_Str",SCHEMA_ID_BYTE_LENGTH);
  forwardDerefIndex=indexManager.getIndex(forwardIndexDef);
  IndexDefinition backwardIndexDef=new IndexDefinition(backwardIndexName(indexName));
  backwardIndexDef.addVariableLengthByteField("String_Node_Str",2);
  backwardIndexDef.addByteField("String_Node_Str",SCHEMA_ID_BYTE_LENGTH);
  backwardDerefIndex=indexManager.getIndex(backwardIndexDef);
}

Fixed version (ground truth):
/** 
 * Private constructor. Clients should use static factory methods   {@link #delete(String,org.apache.hadoop.conf.Configuration)} and {@link #create(String,org.apache.hadoop.conf.Configuration,org.lilyproject.repository.api.IdGenerator)}
 */
private DerefMapHbaseImpl(final String indexName,final Configuration hbaseConfiguration,final IdGenerator idGenerator) throws IndexNotFoundException, IOException, InterruptedException {
  this.idGenerator=idGenerator;
  final IndexManager indexManager=new IndexManager(hbaseConfiguration);
  IndexDefinition forwardIndexDef=new IndexDefinition(forwardIndexName(indexName));
  forwardIndexDef.addVariableLengthByteField("String_Node_Str",2);
  forwardIndexDef.addByteField("String_Node_Str",SCHEMA_ID_BYTE_LENGTH);
  forwardDerefIndex=indexManager.getIndex(forwardIndexDef);
  IndexDefinition backwardIndexDef=new IndexDefinition(backwardIndexName(indexName));
  backwardIndexDef.addVariableLengthByteField("String_Node_Str",2);
  backwardIndexDef.addByteField("String_Node_Str",SCHEMA_ID_BYTE_LENGTH);
  backwardIndexDef.addVariableLengthByteField("String_Node_Str");
  backwardDerefIndex=indexManager.getIndex(backwardIndexDef);
}
Program: 47930
Project: 47930
Buggy source:
private Collection<DependencyEntry> figureOutAddedDependencies(Set<DependencyEntry> newDependencyEntries,Set<Dependency> existingDependencies){
  final Map<Dependency,DependencyEntry> added=new HashMap<Dependency,DependencyEntry>();
  for (  DependencyEntry newMoreDimensionedDependency : newDependencyEntries) {
    added.put(newMoreDimensionedDependency.getDependency(),newMoreDimensionedDependency);
  }
  for (  Dependency existingDependency : existingDependencies) {
    added.remove(existingDependency);
  }
  return added.values();
}

Fixed version (ground truth):
private Collection<DependencyEntry> figureOutAddedDependencies(Set<DependencyEntry> newDependencyEntries,Set<DependencyEntry> existingDependencies){
  final Set<DependencyEntry> added=new HashSet<DerefMap.DependencyEntry>();
  added.addAll(newDependencyEntries);
  added.removeAll(existingDependencies);
  return added;
}
Program: 47931
Project: 47931
Buggy source:
@Override public void updateDependencies(RecordId dependantRecordId,SchemaId dependantVtagId,Map<DependencyEntry,Set<SchemaId>> newDependencyEntries) throws IOException {
  final Set<Dependency> existingEntries=findDependencies(dependantRecordId,dependantVtagId);
  final Collection<Dependency> newDependencies=toSetOfDependencies(newDependencyEntries.keySet());
  final Set<Dependency> removedDependencies=figureOutRemovedDependencies(newDependencies,existingEntries);
  final Collection<DependencyEntry> addedDependencies=figureOutAddedDependencies(newDependencyEntries.keySet(),existingEntries);
  for (  Dependency removed : removedDependencies) {
    final IndexEntry backwardEntry=createBackwardEntry(removed,dependantRecordId,null,null);
    backwardDerefIndex.removeEntry(backwardEntry);
  }
  final IndexEntry fwdEntry=createForwardEntry(dependantRecordId,dependantVtagId,newDependencies);
  forwardDerefIndex.addEntry(fwdEntry);
  for (  DependencyEntry added : addedDependencies) {
    final Dependency dependency=added.getDependency();
    final Set<SchemaId> fields=newDependencyEntries.get(added);
    final IndexEntry backwardEntry=createBackwardEntry(dependency,dependantRecordId,fields,added.getMoreDimensionedVariants());
    backwardDerefIndex.addEntry(backwardEntry);
  }
}

Fixed version (ground truth):
@Override public void updateDependencies(RecordId dependantRecordId,SchemaId dependantVtagId,Map<DependencyEntry,Set<SchemaId>> newDependencyEntries) throws IOException {
  final Set<DependencyEntry> existingEntries=findDependencies(dependantRecordId,dependantVtagId);
  final Set<DependencyEntry> removedDependencies=figureOutRemovedDependencies(newDependencyEntries.keySet(),existingEntries);
  final Collection<DependencyEntry> addedDependencies=figureOutAddedDependencies(newDependencyEntries.keySet(),existingEntries);
  for (  DependencyEntry removed : removedDependencies) {
    final Dependency dependency=removed.getDependency();
    final IndexEntry backwardEntry=createBackwardEntry(dependency,dependantRecordId,null,removed.getMoreDimensionedVariants());
    backwardDerefIndex.removeEntry(backwardEntry);
  }
  final IndexEntry fwdEntry=createForwardEntry(dependantRecordId,dependantVtagId,newDependencyEntries.keySet());
  forwardDerefIndex.addEntry(fwdEntry);
  for (  DependencyEntry added : addedDependencies) {
    final Dependency dependency=added.getDependency();
    final Set<SchemaId> fields=newDependencyEntries.get(added);
    final IndexEntry backwardEntry=createBackwardEntry(dependency,dependantRecordId,fields,added.getMoreDimensionedVariants());
    backwardDerefIndex.addEntry(backwardEntry);
  }
}
Program: 47932
Project: 47932
Buggy source:
private Set<Dependency> figureOutRemovedDependencies(Collection<Dependency> newDependencies,Set<Dependency> existingDependencies){
  final Set<Dependency> removed=new HashSet<Dependency>();
  removed.addAll(existingDependencies);
  removed.removeAll(newDependencies);
  return removed;
}

Fixed version (ground truth):
private Set<DependencyEntry> figureOutRemovedDependencies(Collection<DependencyEntry> newDependencies,Set<DependencyEntry> existingDependencies){
  final Set<DependencyEntry> removed=new HashSet<DependencyEntry>();
  removed.addAll(existingDependencies);
  removed.removeAll(newDependencies);
  return removed;
}
Program: 47933
Project: 47933
Buggy source:
/** 
 * Serializes a list of   {@link Dependency}s into a byte array for usage in the forward index table. It uses a variable length byte array encoding schema.
 * @param dependencies list of dependencies to serialize
 * @return byte array with the serialized format
 */
byte[] serializeDependenciesForward(Collection<Dependency> dependencies) throws IOException {
  final StructRowKey singleEntryRowKey=entrySerializationRowKey();
  int totalLength=0;
  final Map<Object[],Integer> entriesWithSerializedLength=new HashMap<Object[],Integer>();
  for (  Dependency dependency : dependencies) {
    final Object[] toSerialize={dependency.getRecordId().getMaster().toBytes(),dependency.getVtag().getBytes()};
    final int serializedLength=singleEntryRowKey.getSerializedLength(toSerialize);
    entriesWithSerializedLength.put(toSerialize,serializedLength);
    totalLength+=serializedLength;
  }
  final byte[] serialized=new byte[totalLength];
  int offset=0;
  for (  Map.Entry<Object[],Integer> mapEntry : entriesWithSerializedLength.entrySet()) {
    final Object[] toSerialize=mapEntry.getKey();
    singleEntryRowKey.serialize(toSerialize,serialized,offset);
    final Integer length=mapEntry.getValue();
    offset+=length;
  }
  return serialized;
}

Fixed version (ground truth):
/** 
 * Serializes a list of   {@link Dependency}s into a byte array for usage in the forward index table. It uses a variable length byte array encoding schema.
 * @param dependencies list of dependencies to serialize
 * @return byte array with the serialized format
 */
byte[] serializeDependenciesForward(Collection<DependencyEntry> dependencies) throws IOException {
  final StructRowKey singleEntryRowKey=entrySerializationRowKey();
  int totalLength=0;
  final Map<Object[],Integer> entriesWithSerializedLength=new HashMap<Object[],Integer>();
  for (  DependencyEntry dependencyEntry : dependencies) {
    final Object[] toSerialize={dependencyEntry.getDependency().getRecordId().getMaster().toBytes(),dependencyEntry.getDependency().getVtag().getBytes(),serializeVariantPropertiesPattern(createVariantPropertiesPattern(dependencyEntry.getDependency().getRecordId().getVariantProperties(),dependencyEntry.getMoreDimensionedVariants()))};
    final int serializedLength=singleEntryRowKey.getSerializedLength(toSerialize);
    entriesWithSerializedLength.put(toSerialize,serializedLength);
    totalLength+=serializedLength;
  }
  final byte[] serialized=new byte[totalLength];
  int offset=0;
  for (  Map.Entry<Object[],Integer> mapEntry : entriesWithSerializedLength.entrySet()) {
    final Object[] toSerialize=mapEntry.getKey();
    singleEntryRowKey.serialize(toSerialize,serialized,offset);
    final Integer length=mapEntry.getValue();
    offset+=length;
  }
  return serialized;
}
Program: 47934
Project: 47934
Buggy source:
public Set<Dependency> deserializeDependenciesForward(byte[] serialized) throws IOException {
  final StructRowKey singleEntryRowKey=entrySerializationRowKey();
  final Set<Dependency> result=new HashSet<Dependency>();
  final ImmutableBytesWritable bw=new ImmutableBytesWritable(serialized);
  while (bw.getSize() > 0) {
    final Object[] deserializedEntry=(Object[])singleEntryRowKey.deserialize(bw);
    result.add(new Dependency(idGenerator.fromBytes((byte[])deserializedEntry[0]),idGenerator.getSchemaId((byte[])deserializedEntry[1])));
  }
  return result;
}

Fixed version (ground truth):
public Set<DependencyEntry> deserializeDependenciesForward(byte[] serialized) throws IOException {
  final StructRowKey singleEntryRowKey=entrySerializationRowKey();
  final Set<DependencyEntry> result=new HashSet<DependencyEntry>();
  final ImmutableBytesWritable bw=new ImmutableBytesWritable(serialized);
  while (bw.getSize() > 0) {
    final Object[] deserializedEntry=(Object[])singleEntryRowKey.deserialize(bw);
    final VariantPropertiesPattern variantPropertiesPattern=deserializeVariantPropertiesPattern((byte[])deserializedEntry[2]);
    result.add(new DependencyEntry(new Dependency(idGenerator.newRecordId(idGenerator.fromBytes((byte[])deserializedEntry[0]),variantPropertiesPattern.getConcreteProperties()),idGenerator.getSchemaId((byte[])deserializedEntry[1])),variantPropertiesPattern.getPatternProperties()));
  }
  return result;
}
Program: 47935
Project: 47935
Buggy source:
private IndexEntry createForwardEntry(RecordId dependantRecordId,SchemaId dependantVtagId,Collection<Dependency> newDependencies) throws IOException {
  final IndexEntry fwdEntry=new IndexEntry(forwardDerefIndex.getDefinition());
  fwdEntry.addField("String_Node_Str",dependantRecordId.toBytes());
  fwdEntry.addField("String_Node_Str",dependantVtagId.getBytes());
  fwdEntry.setIdentifier(DUMMY_IDENTIFIER);
  fwdEntry.addData(DEPENDENCIES_KEY,serializeDependenciesForward(newDependencies));
  return fwdEntry;
}

Fixed version (ground truth):
private IndexEntry createForwardEntry(RecordId dependantRecordId,SchemaId dependantVtagId,Collection<DependencyEntry> newDependencies) throws IOException {
  final IndexEntry fwdEntry=new IndexEntry(forwardDerefIndex.getDefinition());
  fwdEntry.addField("String_Node_Str",dependantRecordId.toBytes());
  fwdEntry.addField("String_Node_Str",dependantVtagId.getBytes());
  fwdEntry.setIdentifier(DUMMY_IDENTIFIER);
  fwdEntry.addData(DEPENDENCIES_KEY,serializeDependenciesForward(newDependencies));
  return fwdEntry;
}
Program: 47936
Project: 47936
Buggy source:
/** 
 * Find the set of record ids (and corresponding version tags) on which a given record (in a given version tag) depends.
 * @param recordId record id of the record to find dependencies for
 * @param vtag     vtag of the record to find dependencies for
 * @return the record ids and vtags on which the given record depends
 */
Set<Dependency> findDependencies(RecordId recordId,SchemaId vtag) throws IOException {
  final Query query=new Query();
  query.addEqualsCondition("String_Node_Str",recordId.toBytes());
  query.addEqualsCondition("String_Node_Str",vtag.getBytes());
  final Set<Dependency> result;
  final QueryResult queryResult=forwardDerefIndex.performQuery(query);
  if (queryResult.next() != null) {
    final byte[] serializedEntries=queryResult.getData(DEPENDENCIES_KEY);
    result=deserializeDependenciesForward(serializedEntries);
    if (queryResult.next() != null) {
      throw new IllegalStateException("String_Node_Str" + forwardDerefIndex.getDefinition().getName());
    }
  }
 else {
    result=new HashSet<Dependency>();
  }
  Closer.close(queryResult);
  return result;
}

Fixed version (ground truth):
/** 
 * Find the set of record ids (and corresponding version tags) on which a given record (in a given version tag) depends.
 * @param recordId record id of the record to find dependencies for
 * @param vtag     vtag of the record to find dependencies for
 * @return the record ids and vtags on which the given record depends
 */
Set<DependencyEntry> findDependencies(RecordId recordId,SchemaId vtag) throws IOException {
  final Query query=new Query();
  query.addEqualsCondition("String_Node_Str",recordId.toBytes());
  query.addEqualsCondition("String_Node_Str",vtag.getBytes());
  final Set<DependencyEntry> result;
  final QueryResult queryResult=forwardDerefIndex.performQuery(query);
  if (queryResult.next() != null) {
    final byte[] serializedEntries=queryResult.getData(DEPENDENCIES_KEY);
    result=deserializeDependenciesForward(serializedEntries);
    if (queryResult.next() != null) {
      throw new IllegalStateException("String_Node_Str" + forwardDerefIndex.getDefinition().getName());
    }
  }
 else {
    result=new HashSet<DependencyEntry>();
  }
  Closer.close(queryResult);
  return result;
}
Program: 47937
Project: 47937
Buggy source:
private IndexEntry createBackwardEntry(Dependency dependency,RecordId dependantRecordId,Set<SchemaId> fields,Set<String> moreDimensionedVariantProperties) throws IOException {
  final IndexEntry bwdEntry=new IndexEntry(backwardDerefIndex.getDefinition());
  bwdEntry.addField("String_Node_Str",dependency.getRecordId().getMaster().toBytes());
  bwdEntry.addField("String_Node_Str",dependency.getVtag().getBytes());
  bwdEntry.setIdentifier(dependantRecordId.toBytes());
  if (fields != null)   bwdEntry.addData(FIELDS_KEY,serializeFields(fields));
  if (moreDimensionedVariantProperties != null)   bwdEntry.addData(VARIANT_PROPERTIES_PATTERN_KEY,serializeVariantPropertiesPattern(createVariantPropertiesPattern(dependency.getRecordId().getVariantProperties(),moreDimensionedVariantProperties)));
  return bwdEntry;
}

Fixed version (ground truth):
private IndexEntry createBackwardEntry(Dependency dependency,RecordId dependantRecordId,Set<SchemaId> fields,Set<String> moreDimensionedVariantProperties) throws IOException {
  final byte[] serializedVariantPropertiesPattern=serializeVariantPropertiesPattern(createVariantPropertiesPattern(dependency.getRecordId().getVariantProperties(),moreDimensionedVariantProperties));
  final IndexEntry bwdEntry=new IndexEntry(backwardDerefIndex.getDefinition());
  bwdEntry.addField("String_Node_Str",dependency.getRecordId().getMaster().toBytes());
  bwdEntry.addField("String_Node_Str",dependency.getVtag().getBytes());
  bwdEntry.addField("String_Node_Str",serializedVariantPropertiesPattern);
  bwdEntry.setIdentifier(dependantRecordId.toBytes());
  if (fields != null)   bwdEntry.addData(FIELDS_KEY,serializeFields(fields));
  bwdEntry.addData(VARIANT_PROPERTIES_PATTERN_KEY,serializedVariantPropertiesPattern);
  return bwdEntry;
}
Program: 47938
Project: 47938
Buggy source:
private StructRowKey entrySerializationRowKey(){
  final StructRowKey singleEntryRowKey=new StructBuilder().add(new VariableLengthByteArrayRowKey()).add(new FixedByteArrayRowKey(SCHEMA_ID_BYTE_LENGTH)).toRowKey();
  singleEntryRowKey.setTermination(Termination.MUST);
  return singleEntryRowKey;
}

Fixed version (ground truth):
private StructRowKey entrySerializationRowKey(){
  final StructRowKey singleEntryRowKey=new StructBuilder().add(new VariableLengthByteArrayRowKey()).add(new FixedByteArrayRowKey(SCHEMA_ID_BYTE_LENGTH)).add(new VariableLengthByteArrayRowKey()).toRowKey();
  singleEntryRowKey.setTermination(Termination.MUST);
  return singleEntryRowKey;
}
Program: 47940
Project: 47940
Buggy source:
public RemoteSchemaCache(ZooKeeperItf zooKeeper,LilyClient lilyClient){
  super(zooKeeper);
  this.lilyClient=lilyClient;
  log=LogFactory.getLog(getClass());
}

Fixed version (ground truth):
public RemoteSchemaCache(ZooKeeperItf zooKeeper,LilyClient lilyClient){
  super(zooKeeper);
  this.lilyClient=lilyClient;
}
Program: 47941
Project: 47941
Buggy source:
public RemoteTestSchemaCache(ZooKeeperItf zooKeeper){
  super(zooKeeper);
  log=LogFactory.getLog(getClass());
}

Fixed version (ground truth):
public RemoteTestSchemaCache(ZooKeeperItf zooKeeper){
  super(zooKeeper);
}
Program: 47942
Project: 47942
Buggy source:
public AbstractSchemaCache(ZooKeeperItf zooKeeper){
  this.zooKeeper=zooKeeper;
  cacheRefresher.start();
}

Fixed version (ground truth):
public AbstractSchemaCache(ZooKeeperItf zooKeeper){
  this.zooKeeper=zooKeeper;
}
Program: 47943
Project: 47943
Buggy source:
public LocalSchemaCache(ZooKeeperItf zooKeeper,TypeManager typeManager){
  super(zooKeeper);
  this.typeManager=typeManager;
  log=LogFactory.getLog(getClass());
}

Fixed version (ground truth):
public LocalSchemaCache(ZooKeeperItf zooKeeper,TypeManager typeManager){
  super(zooKeeper);
  this.typeManager=typeManager;
}
Program: 47944
Project: 47944
Buggy source:
/** 
 * Starts up mini hbase cluster.  Usually used after call to  {@link #startMiniCluster(int,int)} when doing stepped startup of clusters.Usually you won't want this.  You'll usually want  {@link #startMiniCluster()}.
 * @param numMasters
 * @param numSlaves
 * @return Reference to the hbase mini hbase cluster.
 * @throws IOException
 * @throws InterruptedException 
 * @see {@link #startMiniCluster()}
 */
public MiniHBaseCluster startMiniHBaseCluster(final int numMasters,final int numSlaves) throws IOException, InterruptedException {
  createRootDir();
  Configuration c=new Configuration(this.conf);
  this.hbaseCluster=new MiniHBaseCluster(c,numMasters,numSlaves);
  HTable t=new HTable(c,HConstants.META_TABLE_NAME);
  ResultScanner s=t.getScanner(new Scan());
  while (s.next() != null) {
    continue;
  }
  s.close();
  LOG.info("String_Node_Str");
  return this.hbaseCluster;
}

Fixed version (ground truth):
/** 
 * Starts up mini hbase cluster.  Usually used after call to  {@link #startMiniCluster(int,int)} when doing stepped startup of clusters.Usually you won't want this.  You'll usually want  {@link #startMiniCluster()}.
 * @param numMasters
 * @param numSlaves
 * @return Reference to the hbase mini hbase cluster.
 * @throws IOException
 * @throws InterruptedException 
 * @see {@link #startMiniCluster()}
 */
public MiniHBaseCluster startMiniHBaseCluster(final int numMasters,final int numSlaves) throws IOException, InterruptedException {
  createRootDir();
  Configuration c=new Configuration(this.conf);
  this.hbaseCluster=new MiniHBaseCluster(c,numMasters,numSlaves);
  HTable t;
  int regionAvailableTries=0;
  while (true) {
    regionAvailableTries++;
    try {
      t=new HTable(c,HConstants.META_TABLE_NAME);
      break;
    }
 catch (    NotServingRegionException e) {
      if (regionAvailableTries > 10) {
        throw new RuntimeException("String_Node_Str" + regionAvailableTries + "String_Node_Str");
      }
 else {
        Thread.sleep(50);
      }
    }
  }
  ResultScanner s=t.getScanner(new Scan());
  while (s.next() != null) {
    continue;
  }
  s.close();
  LOG.info("String_Node_Str");
  return this.hbaseCluster;
}
Program: 47945
Project: 47945
Buggy source:
protected abstract boolean processMessage(String context,RowLogMessage message) throws RowLogException, InterruptedException ;

Fixed version (ground truth):
boolean processMessage(RowLogMessage message) throws RowLogException, InterruptedException ;
Program: 47946
Project: 47946
Buggy source:
public void stop() throws InterruptedException {
  stop=true;
  thread.interrupt();
  Logs.logThreadJoin(thread);
  thread.join();
}

Fixed version (ground truth):
public void stop() throws InterruptedException {
  stop=true;
  thread.interrupt();
  Logs.logThreadJoin(thread);
  thread.join();
  delegate.close();
}
Program: 47947
Project: 47947
Buggy source:
public Worker(String subscriptionId,String listener){
  this.subscriptionId=subscriptionId;
  this.listener=listener;
}

Fixed version (ground truth):
public Worker(String subscriptionId,String listener){
  this.subscriptionId=subscriptionId;
  this.listener=listener;
  this.delegate=createWorkerDelegate(listener);
}
Program: 47948
Project: 47948
Buggy source:
public void run(){
  while (!stop && !Thread.interrupted()) {
    RowLogMessage message;
    try {
      metrics.queueSize.set(messagesWorkQueue.size());
      message=messagesWorkQueue.take();
      if (message != null) {
        try {
          Object lock=rowLog.lockMessage(message,subscriptionId);
          if (lock != null) {
            if (!rowLog.isMessageAvailable(message,subscriptionId)) {
              rowLog.unlockMessage(message,subscriptionId,lock);
            }
 else {
              boolean processMessageResult=false;
              try {
                processMessageResult=processMessage(listener,message);
              }
 catch (              RemoteListenerIOException e) {
                metrics.ioExceptionRate.inc();
                log.info(String.format("String_Node_Str",message,subscriptionId,rowLogId),e);
                break;
              }
              if (processMessageResult) {
                metrics.successRate.inc();
                rowLog.messageDone(message,subscriptionId,lock);
              }
 else {
                metrics.failureRate.inc();
                rowLog.unlockMessage(message,subscriptionId,lock);
              }
            }
          }
        }
 catch (        InterruptedException e) {
          break;
        }
catch (        Throwable e) {
          log.warn(String.format("String_Node_Str",message,subscriptionId,rowLogId),e);
        }
 finally {
          messagesWorkQueue.done(message);
        }
      }
    }
 catch (    InterruptedException e) {
      break;
    }
  }
}

Fixed version (ground truth):
public void run(){
  while (!stop && !Thread.interrupted()) {
    RowLogMessage message;
    try {
      metrics.queueSize.set(messagesWorkQueue.size());
      message=messagesWorkQueue.take();
      if (message != null) {
        try {
          Object lock=rowLog.lockMessage(message,subscriptionId);
          if (lock != null) {
            if (!rowLog.isMessageAvailable(message,subscriptionId)) {
              rowLog.unlockMessage(message,subscriptionId,lock);
            }
 else {
              boolean processMessageResult=false;
              try {
                processMessageResult=delegate.processMessage(message);
              }
 catch (              RemoteListenerIOException e) {
                metrics.ioExceptionRate.inc();
                log.info(String.format("String_Node_Str",message,subscriptionId,rowLogId),e);
                break;
              }
              if (processMessageResult) {
                metrics.successRate.inc();
                rowLog.messageDone(message,subscriptionId,lock);
              }
 else {
                metrics.failureRate.inc();
                rowLog.unlockMessage(message,subscriptionId,lock);
              }
            }
          }
        }
 catch (        InterruptedException e) {
          break;
        }
catch (        Throwable e) {
          log.warn(String.format("String_Node_Str",message,subscriptionId,rowLogId),e);
        }
 finally {
          messagesWorkQueue.done(message);
        }
      }
    }
 catch (    InterruptedException e) {
      break;
    }
  }
}
Program: 47949
Project: 47949
Buggy source:
protected boolean processMessage(String listenerId,RowLogMessage message) throws InterruptedException {
  RowLogMessageListener listener=RowLogMessageListenerMapping.INSTANCE.get(subscriptionId);
  if (listener == null)   return false;
  return listener.processMessage(message);
}

Fixed version (ground truth):
@Override public boolean processMessage(RowLogMessage message) throws RowLogException, InterruptedException {
  RowLogMessageListener listener=RowLogMessageListenerMapping.INSTANCE.get(subscriptionId);
  if (listener == null)   return false;
  return listener.processMessage(message);
}
Program: 47950
Project: 47950
Buggy source:
private void initBootstrap(){
  if (bootstrap == null) {
    if (channelFactory == null) {
      channelFactory=new NioClientSocketChannelFactory(Executors.newCachedThreadPool(),Executors.newCachedThreadPool());
    }
    bootstrap=new ClientBootstrap(channelFactory);
    bootstrap.setPipelineFactory(new ChannelPipelineFactoryImplementation(this));
    bootstrap.setOption("String_Node_Str",true);
    bootstrap.setOption("String_Node_Str",true);
  }
}

Fixed version (ground truth):
private void initBootstrap(){
  if (bootstrap == null) {
    if (channelFactory == null) {
      channelFactory=new NioClientSocketChannelFactory(Executors.newCachedThreadPool(),Executors.newCachedThreadPool());
    }
    bootstrap=new ClientBootstrap(channelFactory);
    bootstrap.setPipelineFactory(new ChannelPipelineFactoryImplementation());
    bootstrap.setOption("String_Node_Str",true);
    bootstrap.setOption("String_Node_Str",true);
  }
}
Program: 47951
Project: 47951
Buggy source:
private boolean processMessage(String host,RowLogMessage message,int triesRemaining) throws RemoteListenerIOException, InterruptedException {
  remoteProcessMessageResult=null;
  resultHandlerException=null;
  try {
    if (channel == null || (!channel.isConnected())) {
      channel=getListenerChannel(host);
    }
    ChannelFuture writeFuture=channel.write(message);
    writeFuture.await();
    semaphore.acquire();
    if (remoteProcessMessageResult == null || resultHandlerException != null) {
      if (triesRemaining > 0) {
        log.info("String_Node_Str" + triesRemaining,resultHandlerException);
        Thread.sleep(10);
        return processMessage(host,message,triesRemaining - 1);
      }
 else {
        throw new RemoteListenerIOException("String_Node_Str" + message + "String_Node_Str"+ host+ "String_Node_Str",resultHandlerException);
      }
    }
    return remoteProcessMessageResult;
  }
 catch (  InterruptedException e) {
    if (channel != null) {
      channel.close().awaitUninterruptibly();
    }
    throw e;
  }
}

Fixed version (ground truth):
public boolean processMessage(RowLogMessage message,int triesRemaining) throws RowLogException, InterruptedException {
  remoteProcessMessageResult=null;
  resultHandlerException=null;
  try {
    if (channel == null || (!channel.isConnected())) {
      channel=getListenerChannel(host);
    }
    workerDelegates.put(channel.getId(),this);
    ChannelFuture writeFuture=channel.write(message);
    writeFuture.await();
    semaphore.acquire();
    if (remoteProcessMessageResult == null || resultHandlerException != null) {
      if (triesRemaining > 0) {
        if (log.isInfoEnabled()) {
          log.info("String_Node_Str" + triesRemaining,resultHandlerException);
        }
        Thread.sleep(10);
        return processMessage(message,triesRemaining - 1);
      }
 else {
        throw new RemoteListenerIOException("String_Node_Str" + message + "String_Node_Str"+ host+ "String_Node_Str",resultHandlerException);
      }
    }
    return remoteProcessMessageResult;
  }
 catch (  InterruptedException e) {
    if (channel != null) {
      channel.close().awaitUninterruptibly();
    }
    throw e;
  }
 finally {
    if (channel != null) {
      workerDelegates.remove(channel.getId());
    }
  }
}
Program: 47952
Project: 47952
Buggy source:
public ChannelPipeline getPipeline(){
  ChannelPipeline pipeline=Channels.pipeline();
  pipeline.addLast("String_Node_Str",RESULT_DECODER);
  pipeline.addLast("String_Node_Str",remoteListenersSubscriptionHandler.new ResultHandler());
  pipeline.addLast("String_Node_Str",MESSAGE_ENCODER);
  return pipeline;
}

Fixed version (ground truth):
public ChannelPipeline getPipeline(){
  ChannelPipeline pipeline=Channels.pipeline();
  pipeline.addLast("String_Node_Str",RESULT_DECODER);
  pipeline.addLast("String_Node_Str",new ResultHandler());
  pipeline.addLast("String_Node_Str",MESSAGE_ENCODER);
  return pipeline;
}