nus-yam/ex-repair huggingface dataset:
Program: 8094
Project: 8094
Buggy source:
/** 
 * @return Returns an instance of {@link LocalManager}
 */
public static Manager<Location,ApplicationWithPrograms> getLocalManager(CConfiguration configuration){
  LocationFactory lf=new LocalLocationFactory();
  PipelineFactory pf=new SynchronousPipelineFactory();
  final Injector injector=Guice.createInjector(new AbstractModule(){
    @Override protected void configure(){
      bind(OperationExecutor.class).to(NoOperationExecutor.class);
      bind(MetaDataStore.class).to(SerializingMetaDataStore.class);
      bind(ManagerFactory.class).to(SyncManagerFactory.class);
      bind(LocationFactory.class).to(LocalLocationFactory.class);
      bind(PipelineFactory.class).to(SynchronousPipelineFactory.class);
      bind(StoreFactory.class).to(MDSStoreFactory.class);
    }
  }
);
  ManagerFactory factory=injector.getInstance(ManagerFactory.class);
  return (Manager<Location,ApplicationWithPrograms>)factory.create(configuration);
}

Fixed version (ground truth):
/** 
 * @return Returns an instance of {@link LocalManager}
 */
public static Manager<Location,ApplicationWithPrograms> getLocalManager(CConfiguration configuration){
  LocationFactory lf=new LocalLocationFactory();
  PipelineFactory pf=new SynchronousPipelineFactory();
  final Injector injector=Guice.createInjector(new AbstractModule(){
    @Override protected void configure(){
      bind(OperationExecutor.class).to(NoOperationExecutor.class);
      bind(MetaDataStore.class).to(SerializingMetaDataStore.class);
      bind(ManagerFactory.class).to(SyncManagerFactory.class);
      bind(LocationFactory.class).to(LocalLocationFactory.class);
      bind(PipelineFactory.class).to(SynchronousPipelineFactory.class);
      bind(StoreFactory.class).to(MDSStoreFactory.class);
      bind(MetadataService.Iface.class).to(com.continuuity.metadata.MetadataService.class);
      bind(new TypeLiteral<PipelineFactory<?>>(){
      }
).to(new TypeLiteral<SynchronousPipelineFactory<?>>(){
      }
);
    }
  }
);
  ManagerFactory factory=injector.getInstance(ManagerFactory.class);
  return (Manager<Location,ApplicationWithPrograms>)factory.create(configuration);
}
Program: 8095
Project: 8095
Buggy source:
@Override protected void configure(){
  bind(OperationExecutor.class).to(NoOperationExecutor.class);
  bind(MetaDataStore.class).to(SerializingMetaDataStore.class);
  bind(ManagerFactory.class).to(SyncManagerFactory.class);
  bind(LocationFactory.class).to(LocalLocationFactory.class);
  bind(PipelineFactory.class).to(SynchronousPipelineFactory.class);
  bind(StoreFactory.class).to(MDSStoreFactory.class);
}

Fixed version (ground truth):
@Override protected void configure(){
  bind(OperationExecutor.class).to(NoOperationExecutor.class);
  bind(MetaDataStore.class).to(SerializingMetaDataStore.class);
  bind(ManagerFactory.class).to(SyncManagerFactory.class);
  bind(LocationFactory.class).to(LocalLocationFactory.class);
  bind(PipelineFactory.class).to(SynchronousPipelineFactory.class);
  bind(StoreFactory.class).to(MDSStoreFactory.class);
  bind(MetadataService.Iface.class).to(com.continuuity.metadata.MetadataService.class);
  bind(new TypeLiteral<PipelineFactory<?>>(){
  }
).to(new TypeLiteral<SynchronousPipelineFactory<?>>(){
  }
);
}
Program: 8096
Project: 8096
Buggy source:
@Override public long incrementAtomicDirtily(byte[] row,byte[] column,long amount) throws OperationException {
  try {
    Increment increment=new Increment(row);
    increment.addColumn(this.family,column,amount);
    Result result=this.readTable.increment(increment);
    if (result.isEmpty())     return 0L;
    return Bytes.toLong(result.value());
  }
 catch (  IOException e) {
    this.exceptionHandler.handle(e);
    return -1L;
  }
}

Fixed version (ground truth):
@Override public long incrementAtomicDirtily(byte[] row,byte[] column,long amount) throws OperationException {
  try {
    Increment increment=new Increment(row);
    increment.addColumn(this.family,column,amount);
    Result result=this.readTable.increment(increment);
    return Bytes.toLong(result.value());
  }
 catch (  IOException e) {
    this.exceptionHandler.handle(e);
    return -1L;
  }
}
Program: 8098
Project: 8098
Buggy source:
/** 
 * @deprecated
 */
public void setData(byte[] data){
  this.entry.setData(data);
}

Fixed version (ground truth):
/** 
 * @deprecated
 */
public void setData(byte[] data){
  assert(this.entry != null);
  this.entry.setData(data);
}
Program: 8099
Project: 8099
Buggy source:
/** 
 * @deprecated
 */
public byte[] getData(){
  return this.entry.getData();
}

Fixed version (ground truth):
/** 
 * @deprecated
 */
public byte[] getData(){
  return this.entry == null ? null : this.entry.getData();
}
Program: 8100
Project: 8100
Buggy source:
/** 
 * Sets the authenticator to be used for all requests to this connector.
 * @param authenticator the authenticator to use for requests
 */
void setAuthenticator(GatewayAuthenticator authenticator){
  this.authenticator=authenticator;
}

Fixed version (ground truth):
/** 
 * Sets the authenticator to be used for all requests to this connector.
 * @param authenticator the authenticator to use for requests
 */
public void setAuthenticator(GatewayAuthenticator authenticator){
  this.authenticator=authenticator;
}
Program: 8101
Project: 8101
Buggy source:
/** 
 * Authenticates the specified HTTP request.
 * @param request http request
 * @return true if authentication succeeds, false if not
 */
public boolean authenticateRequest(AvroFlumeEvent flumeEvent);

Fixed version (ground truth):
/** 
 * Authenticates the specified Stream Event.
 * @param event stream event to authenticate
 * @return true if authentication succeeds, false if not
 */
public boolean authenticateRequest(Event event);
Program: 8102
Project: 8102
Buggy source:
@Override public boolean authenticateRequest(AvroFlumeEvent flumeEvent){
  return true;
}

Fixed version (ground truth):
@Override public boolean authenticateRequest(Event event){
  return true;
}
Program: 8103
Project: 8103
Buggy source:
@Override public boolean authenticateRequest(AvroFlumeEvent flumeEvent){
  CharSequence apiKeyCS=flumeEvent.getHeaders().get(CONTINUUITY_API_KEY);
  if (apiKeyCS == null || apiKeyCS.length() == 0)   return false;
  String apiKey=apiKeyCS.toString();
  return authenticate(apiKey);
}

Fixed version (ground truth):
@Override public boolean authenticateRequest(Event event){
  String apiKey=event.getHeader(CONTINUUITY_API_KEY);
  if (apiKey == null)   return false;
  return authenticate(apiKey);
}
Program: 8104
Project: 8104
Buggy source:
@Override public final Status appendBatch(List<AvroFlumeEvent> events){
  MetricsHelper helper=new MetricsHelper(this.getClass(),this.metrics,this.collector.getMetricsQualifier(),"String_Node_Str");
  LOG.trace("String_Node_Str" + events);
  if (!collector.getAuthenticator().authenticateRequest(events.get(0))) {
    LOG.warn("String_Node_Str");
    helper.finish(Error);
    return Status.FAILED;
  }
  try {
    this.collector.getConsumer().consumeEvents(convertFlume2Event(events,helper));
    helper.finish(Success);
    return Status.OK;
  }
 catch (  Exception e) {
    LOG.warn("String_Node_Str" + e.getMessage());
    helper.finish(Error);
    return Status.FAILED;
  }
}

Fixed version (ground truth):
@Override public final Status appendBatch(List<AvroFlumeEvent> events){
  MetricsHelper helper=new MetricsHelper(this.getClass(),this.metrics,this.collector.getMetricsQualifier(),"String_Node_Str");
  LOG.trace("String_Node_Str" + events);
  try {
    List<Event> convertedEvents=convertFlume2Event(events,helper);
    if (!collector.getAuthenticator().authenticateRequest(convertedEvents.get(0))) {
      LOG.warn("String_Node_Str");
      helper.finish(Error);
      return Status.FAILED;
    }
    this.collector.getConsumer().consumeEvents(convertedEvents);
    helper.finish(Success);
    return Status.OK;
  }
 catch (  Exception e) {
    LOG.warn("String_Node_Str" + e.getMessage());
    helper.finish(Error);
    return Status.FAILED;
  }
}
Program: 8105
Project: 8105
Buggy source:
@Override public final Status append(AvroFlumeEvent event){
  MetricsHelper helper=new MetricsHelper(this.getClass(),this.metrics,this.collector.getMetricsQualifier(),"String_Node_Str");
  LOG.trace("String_Node_Str" + event);
  if (!collector.getAuthenticator().authenticateRequest(event)) {
    LOG.debug("String_Node_Str");
    helper.finish(Error);
    return Status.FAILED;
  }
  try {
    this.collector.getConsumer().consumeEvent(convertFlume2Event(event,helper));
    helper.finish(MetricsHelper.Status.Success);
    return Status.OK;
  }
 catch (  Exception e) {
    LOG.warn("String_Node_Str" + e.getMessage());
    helper.finish(Error);
    return Status.FAILED;
  }
}

Fixed version (ground truth):
@Override public final Status append(AvroFlumeEvent event){
  MetricsHelper helper=new MetricsHelper(this.getClass(),this.metrics,this.collector.getMetricsQualifier(),"String_Node_Str");
  LOG.trace("String_Node_Str" + event);
  try {
    Event convertedEvent=convertFlume2Event(event,helper);
    if (!collector.getAuthenticator().authenticateRequest(convertedEvent)) {
      LOG.debug("String_Node_Str");
      helper.finish(Error);
      return Status.FAILED;
    }
    this.collector.getConsumer().consumeEvent(convertedEvent);
    helper.finish(MetricsHelper.Status.Success);
    return Status.OK;
  }
 catch (  Exception e) {
    LOG.warn("String_Node_Str" + e.getMessage());
    helper.finish(Error);
    return Status.FAILED;
  }
}
Program: 8106
Project: 8106
Buggy source:
/** 
 * verify that collector does not bind to port until start()
 */
@Test public void testStartStop() throws Exception {
  String name="String_Node_Str";
  int port=PortDetector.findFreePort();
  String stream="String_Node_Str";
  CConfiguration configuration=new CConfiguration();
  configuration.setInt(Constants.buildConnectorPropertyName(name,Constants.CONFIG_PORT),port);
  Collector collector=newCollector(name);
  collector.configure(configuration);
  collector.setConsumer(new TestUtil.NoopConsumer());
  SimpleEvent event=TestUtil.createFlumeEvent(42,stream);
  try {
    TestUtil.sendFlumeEvent(port,event);
    Assert.fail("String_Node_Str");
  }
 catch (  Exception e) {
  }
  collector.start();
  TestUtil.sendFlumeEvent(port,event);
  collector.stop();
  try {
    TestUtil.sendFlumeEvent(port,event);
    Assert.fail("String_Node_Str");
  }
 catch (  Exception e) {
  }
  collector.start();
  TestUtil.sendFlumeEvent(port,event);
  collector.stop();
}

Fixed version (ground truth):
/** 
 * verify that collector does not bind to port until start()
 */
@Test public void testStartStop() throws Exception {
  String name="String_Node_Str";
  int port=PortDetector.findFreePort();
  String stream="String_Node_Str";
  CConfiguration configuration=new CConfiguration();
  configuration.setInt(Constants.buildConnectorPropertyName(name,Constants.CONFIG_PORT),port);
  Collector collector=newCollector(name);
  collector.configure(configuration);
  collector.setConsumer(new TestUtil.NoopConsumer());
  collector.setAuthenticator(new NoAuthenticator());
  SimpleEvent event=TestUtil.createFlumeEvent(42,stream);
  try {
    TestUtil.sendFlumeEvent(port,event);
    Assert.fail("String_Node_Str");
  }
 catch (  Exception e) {
  }
  collector.start();
  TestUtil.sendFlumeEvent(port,event);
  collector.stop();
  try {
    TestUtil.sendFlumeEvent(port,event);
    Assert.fail("String_Node_Str");
  }
 catch (  Exception e) {
  }
  collector.start();
  TestUtil.sendFlumeEvent(port,event);
  collector.stop();
}
Program: 8107
Project: 8107
Buggy source:
/** 
 * verify that flume events get transformed and annotated correctly
 */
@Test public void testTransformEvent() throws Exception {
  String name="String_Node_Str";
  int port=PortDetector.findFreePort();
  String stream="String_Node_Str";
  int eventsToSend=10;
  CConfiguration configuration=new CConfiguration();
  configuration.setInt(Constants.buildConnectorPropertyName(name,Constants.CONFIG_PORT),port);
  Collector collector=newCollector(name);
  collector.configure(configuration);
  collector.setConsumer(new TestUtil.VerifyConsumer(17,name,stream));
  collector.start();
  TestUtil.sendFlumeEvent(port,TestUtil.createFlumeEvent(17,stream));
  collector.stop();
  collector.setConsumer(new TestUtil.VerifyConsumer(name,stream));
  collector.start();
  TestUtil.sendFlumeEvents(port,stream,eventsToSend,4);
  collector.stop();
  Assert.assertEquals(eventsToSend,collector.getConsumer().eventsReceived());
  Assert.assertEquals(eventsToSend,collector.getConsumer().eventsSucceeded());
  Assert.assertEquals(0,collector.getConsumer().eventsFailed());
}

Fixed version (ground truth):
/** 
 * verify that flume events get transformed and annotated correctly
 */
@Test public void testTransformEvent() throws Exception {
  String name="String_Node_Str";
  int port=PortDetector.findFreePort();
  String stream="String_Node_Str";
  int eventsToSend=10;
  CConfiguration configuration=new CConfiguration();
  configuration.setInt(Constants.buildConnectorPropertyName(name,Constants.CONFIG_PORT),port);
  Collector collector=newCollector(name);
  collector.configure(configuration);
  collector.setConsumer(new TestUtil.VerifyConsumer(17,name,stream));
  collector.setAuthenticator(new NoAuthenticator());
  collector.start();
  TestUtil.sendFlumeEvent(port,TestUtil.createFlumeEvent(17,stream));
  collector.stop();
  collector.setConsumer(new TestUtil.VerifyConsumer(name,stream));
  collector.start();
  TestUtil.sendFlumeEvents(port,stream,eventsToSend,4);
  collector.stop();
  Assert.assertEquals(eventsToSend,collector.getConsumer().eventsReceived());
  Assert.assertEquals(eventsToSend,collector.getConsumer().eventsSucceeded());
  Assert.assertEquals(0,collector.getConsumer().eventsFailed());
}
Program: 8108
Project: 8108
Buggy source:
/** 
 * Test that we can send simulated Flume events to a Queue using EventWritingConsumer. NOTE: This has been seperated out from the above test till we figure out how OMID can handle multiple write format that gets on queue. No Ignore is added for test on purpose.
 * @throws Exception If any exceptions happen during the test
 */
public void testFlumeToQueueWithEventWritingConsumer() throws Exception {
  EventWritingConsumer eventWritingConsumer=new EventWritingConsumer();
  eventWritingConsumer.setExecutor(this.executor);
  theGateway.setConsumer(eventWritingConsumer);
  try {
    theGateway.start(null,myConfiguration);
  }
 catch (  ServerException e) {
    LOG.debug(e.getMessage());
  }
  TestUtil.enableAuth(apiKey);
  TestUtil.sendFlumeEvents(port,destination,eventsToSend,batchSize);
  Assert.assertEquals(eventsToSend,eventWritingConsumer.eventsReceived());
  Assert.assertEquals(eventsToSend,eventWritingConsumer.eventsSucceeded());
  Assert.assertEquals(0,eventWritingConsumer.eventsFailed());
  TestUtil.consumeQueueAsEvents(this.executor,destination,name,eventsToSend);
  TestUtil.disableAuth();
  try {
    TestUtil.sendFlumeEvents(port,destination,eventsToSend,batchSize);
    Assert.assertTrue("String_Node_Str",false);
  }
 catch (  Exception e) {
  }
  theGateway.stop(false);
}

Fixed version (ground truth):
/** 
 * Test that we can send simulated Flume events to a Queue using EventWritingConsumer. NOTE: This has been seperated out from the above test till we figure out how OMID can handle multiple write format that gets on queue. No Ignore is added for test on purpose.
 * @throws Exception If any exceptions happen during the test
 */
public void testFlumeToQueueWithEventWritingConsumer() throws Exception {
  EventWritingConsumer eventWritingConsumer=new EventWritingConsumer();
  eventWritingConsumer.setExecutor(this.executor);
  theGateway.setConsumer(eventWritingConsumer);
  try {
    theGateway.start(null,myConfiguration);
  }
 catch (  ServerException e) {
    LOG.debug(e.getMessage());
  }
  TestUtil.enableAuth(apiKey);
  TestUtil.sendFlumeEvents(port,destination,eventsToSend,batchSize);
  Assert.assertEquals(eventsToSend,eventWritingConsumer.eventsReceived());
  Assert.assertEquals(eventsToSend,eventWritingConsumer.eventsSucceeded());
  Assert.assertEquals(0,eventWritingConsumer.eventsFailed());
  TestUtil.consumeQueueAsEvents(this.executor,destination,name,eventsToSend);
  TestUtil.disableAuth();
  theGateway.stop(false);
}
Program: 8109
Project: 8109
Buggy source:
/** 
 * Test that we can send simulated Flume events to a Queue using TupleWritingConsumer
 * @throws Exception If any exceptions happen during the test
 */
@Test public void testFlumeToQueueTupleWritingConsumer() throws Exception {
  TupleWritingConsumer tupleWritingConsumer=new TupleWritingConsumer();
  tupleWritingConsumer.setExecutor(this.executor);
  theGateway.setConsumer(tupleWritingConsumer);
  try {
    theGateway.start(null,myConfiguration);
  }
 catch (  ServerException e) {
    LOG.debug(e.getMessage());
  }
  TestUtil.enableAuth(apiKey);
  TestUtil.sendFlumeEvents(port,destination,eventsToSend,batchSize);
  Assert.assertEquals(eventsToSend,tupleWritingConsumer.eventsReceived());
  Assert.assertEquals(eventsToSend,tupleWritingConsumer.eventsSucceeded());
  Assert.assertEquals(0,tupleWritingConsumer.eventsFailed());
  TestUtil.consumeQueueAsTuples(this.executor,destination,name,eventsToSend);
  TestUtil.disableAuth();
  theGateway.stop(false);
}

Fixed version (ground truth):
/** 
 * Test that we can send simulated Flume events to a Queue using TupleWritingConsumer
 * @throws Exception If any exceptions happen during the test
 */
@Test public void testFlumeToQueueTupleWritingConsumer() throws Exception {
  TupleWritingConsumer tupleWritingConsumer=new TupleWritingConsumer();
  tupleWritingConsumer.setExecutor(this.executor);
  theGateway.setConsumer(tupleWritingConsumer);
  try {
    theGateway.start(null,myConfiguration);
  }
 catch (  ServerException e) {
    LOG.debug(e.getMessage());
  }
  TestUtil.enableAuth(apiKey);
  TestUtil.sendFlumeEvents(port,destination,eventsToSend,batchSize);
  Assert.assertEquals(eventsToSend,tupleWritingConsumer.eventsReceived());
  Assert.assertEquals(eventsToSend,tupleWritingConsumer.eventsSucceeded());
  Assert.assertEquals(0,tupleWritingConsumer.eventsFailed());
  TestUtil.consumeQueueAsTuples(this.executor,destination,name,eventsToSend);
  TestUtil.disableAuth();
  try {
    TestUtil.sendFlumeEvents(port,destination,eventsToSend,batchSize);
    Assert.assertTrue("String_Node_Str",false);
  }
 catch (  Exception e) {
  }
  theGateway.stop(false);
}
Program: 8110
Project: 8110
Buggy source:
/** 
 * Create a new rest accessor with a given name and parameters
 * @param name   The name for the accessor
 * @param prefix The path prefix for the URI
 * @param middle The path middle for the URI
 * @return the accessor's base URL for REST requests
 */
String setupAccessor(String name,String prefix,String middle) throws Exception {
  DataRestAccessor restAccessor=new DataRestAccessor();
  restAccessor.setName(name);
  int port=PortDetector.findFreePort();
  CConfiguration configuration=new CConfiguration();
  configuration.setInt(Constants.buildConnectorPropertyName(name,Constants.CONFIG_PORT),port);
  configuration.set(Constants.buildConnectorPropertyName(name,Constants.CONFIG_PATH_PREFIX),prefix);
  configuration.set(Constants.buildConnectorPropertyName(name,Constants.CONFIG_PATH_MIDDLE),middle);
  restAccessor.configure(configuration);
  restAccessor.setExecutor(this.executor);
  restAccessor.start();
  this.accessor=restAccessor;
  return "String_Node_Str" + port + prefix+ middle;
}

Fixed version (ground truth):
/** 
 * Create a new rest accessor with a given name and parameters
 * @param name   The name for the accessor
 * @param prefix The path prefix for the URI
 * @param middle The path middle for the URI
 * @return the accessor's base URL for REST requests
 */
String setupAccessor(String name,String prefix,String middle) throws Exception {
  DataRestAccessor restAccessor=new DataRestAccessor();
  restAccessor.setName(name);
  restAccessor.setAuthenticator(new NoAuthenticator());
  int port=PortDetector.findFreePort();
  CConfiguration configuration=new CConfiguration();
  configuration.setInt(Constants.buildConnectorPropertyName(name,Constants.CONFIG_PORT),port);
  configuration.set(Constants.buildConnectorPropertyName(name,Constants.CONFIG_PATH_PREFIX),prefix);
  configuration.set(Constants.buildConnectorPropertyName(name,Constants.CONFIG_PATH_MIDDLE),middle);
  restAccessor.configure(configuration);
  restAccessor.setExecutor(this.executor);
  restAccessor.start();
  this.accessor=restAccessor;
  return "String_Node_Str" + port + prefix+ middle;
}
Program: 8111
Project: 8111
Buggy source:
String setupCollector(String name,String prefix,String middle) throws Exception {
  RestCollector restCollector=new RestCollector();
  restCollector.setName(name);
  int port=PortDetector.findFreePort();
  CConfiguration configuration=new CConfiguration();
  configuration.setInt(Constants.buildConnectorPropertyName(name,Constants.CONFIG_PORT),port);
  configuration.set(Constants.buildConnectorPropertyName(name,Constants.CONFIG_PATH_PREFIX),prefix);
  configuration.set(Constants.buildConnectorPropertyName(name,Constants.CONFIG_PATH_MIDDLE),middle);
  restCollector.configure(configuration);
  TupleWritingConsumer consumer=new TupleWritingConsumer();
  consumer.setExecutor(this.executor);
  restCollector.setConsumer(consumer);
  restCollector.setExecutor(this.executor);
  restCollector.setMetadataService(new DummyMDS());
  restCollector.start();
  this.collector=restCollector;
  return "String_Node_Str" + port + prefix+ middle;
}

Fixed version (ground truth):
String setupCollector(String name,String prefix,String middle) throws Exception {
  RestCollector restCollector=new RestCollector();
  restCollector.setName(name);
  restCollector.setAuthenticator(new NoAuthenticator());
  int port=PortDetector.findFreePort();
  CConfiguration configuration=new CConfiguration();
  configuration.setInt(Constants.buildConnectorPropertyName(name,Constants.CONFIG_PORT),port);
  configuration.set(Constants.buildConnectorPropertyName(name,Constants.CONFIG_PATH_PREFIX),prefix);
  configuration.set(Constants.buildConnectorPropertyName(name,Constants.CONFIG_PATH_MIDDLE),middle);
  restCollector.configure(configuration);
  TupleWritingConsumer consumer=new TupleWritingConsumer();
  consumer.setExecutor(this.executor);
  restCollector.setConsumer(consumer);
  restCollector.setExecutor(this.executor);
  restCollector.setMetadataService(new DummyMDS());
  restCollector.start();
  this.collector=restCollector;
  return "String_Node_Str" + port + prefix+ middle;
}
Program: 8113
Project: 8113
Buggy source:
/** 
 * verify that rest events get transformed and annotated correctly
 */
@Test public void testTransformEvent() throws Exception {
  String name="String_Node_Str";
  String prefix="String_Node_Str";
  String path="String_Node_Str";
  String destination="String_Node_Str";
  int eventsToSend=10;
  int port=PortDetector.findFreePort();
  CConfiguration configuration=new CConfiguration();
  configuration.setInt(Constants.buildConnectorPropertyName(name,Constants.CONFIG_PORT),port);
  configuration.set(Constants.buildConnectorPropertyName(name,Constants.CONFIG_PATH_PREFIX),prefix);
  configuration.set(Constants.buildConnectorPropertyName(name,Constants.CONFIG_PATH_MIDDLE),path);
  Collector collector=newCollector(name);
  collector.configure(configuration);
  collector.setConsumer(new TestUtil.VerifyConsumer(15,name,destination));
  collector.start();
  TestUtil.sendRestEvent(TestUtil.createHttpPost(port,prefix,path,destination,15));
  collector.stop();
  collector.setConsumer(new TestUtil.VerifyConsumer(name,destination));
  collector.start();
  TestUtil.sendRestEvents(port,prefix,path,destination,eventsToSend);
  collector.stop();
  Assert.assertEquals(eventsToSend,collector.getConsumer().eventsReceived());
  Assert.assertEquals(eventsToSend,collector.getConsumer().eventsSucceeded());
  Assert.assertEquals(0,collector.getConsumer().eventsFailed());
}

Fixed version (ground truth):
/** 
 * verify that rest events get transformed and annotated correctly
 */
@Test public void testTransformEvent() throws Exception {
  String name="String_Node_Str";
  String prefix="String_Node_Str";
  String path="String_Node_Str";
  String destination="String_Node_Str";
  int eventsToSend=10;
  int port=PortDetector.findFreePort();
  CConfiguration configuration=new CConfiguration();
  configuration.setInt(Constants.buildConnectorPropertyName(name,Constants.CONFIG_PORT),port);
  configuration.set(Constants.buildConnectorPropertyName(name,Constants.CONFIG_PATH_PREFIX),prefix);
  configuration.set(Constants.buildConnectorPropertyName(name,Constants.CONFIG_PATH_MIDDLE),path);
  Collector collector=newCollector(name);
  collector.configure(configuration);
  collector.setConsumer(new TestUtil.VerifyConsumer(15,name,destination));
  collector.setAuthenticator(new NoAuthenticator());
  collector.start();
  TestUtil.sendRestEvent(TestUtil.createHttpPost(port,prefix,path,destination,15));
  collector.stop();
  collector.setConsumer(new TestUtil.VerifyConsumer(name,destination));
  collector.start();
  TestUtil.sendRestEvents(port,prefix,path,destination,eventsToSend);
  collector.stop();
  Assert.assertEquals(eventsToSend,collector.getConsumer().eventsReceived());
  Assert.assertEquals(eventsToSend,collector.getConsumer().eventsSucceeded());
  Assert.assertEquals(0,collector.getConsumer().eventsFailed());
}
Program: 8114
Project: 8114
Buggy source:
private void executeDeferred() throws OperationException {
  if (this.state != State.Running) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (!this.deferred.isEmpty()) {
    try {
      this.xaction=this.opex.execute(this.context,null,this.deferred);
      this.deferred.clear();
    }
 catch (    OperationException e) {
      this.xaction=null;
      this.deferred.clear();
      this.state=State.Aborted;
      throw e;
    }
  }
 else   if (this.xaction == null) {
    this.xaction=opex.startTransaction(this.context);
  }
}

Fixed version (ground truth):
private void executeDeferred() throws OperationException {
  if (this.state != State.Running) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (!this.deferred.isEmpty()) {
    try {
      this.xaction=this.opex.execute(this.context,this.xaction,this.deferred);
      this.deferred.clear();
    }
 catch (    OperationException e) {
      this.xaction=null;
      this.deferred.clear();
      this.state=State.Aborted;
      throw e;
    }
  }
 else   if (this.xaction == null) {
    this.xaction=opex.startTransaction(this.context);
  }
}
Program: 8115
Project: 8115
Buggy source:
public void testBundler() throws Exception {
  Manifest manifest=new Manifest();
  manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION,"String_Node_Str");
  manifest.getMainAttributes().put(Attributes.Name.MAIN_CLASS,"String_Node_Str");
  manifest.getMainAttributes().put(new Attributes.Name("String_Node_Str"),"String_Node_Str");
  manifest.getMainAttributes().put(new Attributes.Name("String_Node_Str"),"String_Node_Str");
  ArchiveBundler bundler=new ArchiveBundler(new File("String_Node_Str"));
  bundler.clone(new File("String_Node_Str"),manifest,new File[]{new File("String_Node_Str")});
}

Fixed version (ground truth):
public void testBundler() throws Exception {
  Manifest manifest=new Manifest();
  manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION,"String_Node_Str");
  manifest.getMainAttributes().put(Attributes.Name.MAIN_CLASS,"String_Node_Str");
  manifest.getMainAttributes().put(new Attributes.Name("String_Node_Str"),"String_Node_Str");
  manifest.getMainAttributes().put(new Attributes.Name("String_Node_Str"),"String_Node_Str");
  LocationFactory lf=new LocalLocationFactory();
  ArchiveBundler bundler=new ArchiveBundler(lf.create("String_Node_Str"));
  bundler.clone(lf.create("String_Node_Str"),manifest,new Location[]{lf.create("String_Node_Str")});
}
Program: 8121
Project: 8121
Buggy source:
/** 
 * Returns the time-bucketed timestamp of the specified timestamp in milliseconds (timestamp modulo 60*60*1000).
 * @param timestamp stamp in milliseconds
 * @return hour time bucket of specified timestamp in milliseconds
 */
public static Long hour(Long timestamp){
  return timestamp % 3600000;
}

Fixed version (ground truth):
/** 
 * Returns the time-bucketed timestamp of the specified timestamp in milliseconds (timestamp modulo 60*60*1000).
 * @param timestamp stamp in milliseconds
 * @return hour time bucket of specified timestamp in milliseconds
 */
public static Long hour(Long timestamp){
  return timestamp - (timestamp % 3600000);
}
Program: 8122
Project: 8122
Buggy source:
/** 
 * Returns the time-bucketed timestamp of the specified timestamp in milliseconds (timestamp modulo 60*60*1000).
 * @param timestamp stamp in milliseconds
 * @return hour time bucket of specified timestamp in milliseconds
 */
public static Long hour(Long timestamp){
  return timestamp - (timestamp % 3600000);
}

Fixed version (ground truth):
/** 
 * Returns the time-bucketed timestamp of the specified timestamp in milliseconds: timestamp - (timestamp modulo 60*60*1000).
 * @param timestamp stamp in milliseconds
 * @return hour time bucket of specified timestamp in milliseconds
 */
public static Long hour(Long timestamp){
  return timestamp - (timestamp % 3600000);
}
Program: 8123
Project: 8123
Buggy source:
/** 
 * Constructs and initializes   {@link MetricsClient}.
 * @param configuration object.
 * @throws ServiceDiscoveryClientException thrown when the client isunable to discovery the service or unable to connect to zookeeper.
 */
public MetricsClient(CConfiguration configuration) throws ServiceDiscoveryClientException {
  this.queue=new LinkedBlockingDeque<String>(10000);
  connector=new NioSocketConnector();
  connector.setConnectTimeoutMillis(CONNECT_TIMEOUT);
  ProtocolCodecFilter protocolFilter=new ProtocolCodecFilter(new MetricCodecFactory(true));
  connector.getFilterChain().addLast("String_Node_Str",protocolFilter);
  connector.getSessionConfig().setKeepAlive(true);
  connector.getSessionConfig().setTcpNoDelay(true);
  connector.setHandler(new MetricsClientProtocolHandler());
  Runtime.getRuntime().addShutdownHook(new Thread(){
    public void run(){
      if (dispatcher != null) {
        dispatcher.stop();
      }
      if (connector != null) {
        connector.dispose();
        connector=null;
      }
      executorService.shutdown();
      if (session != null) {
        session.close(true).awaitUninterruptibly(CONNECT_TIMEOUT);
        session=null;
      }
    }
  }
);
  serviceDiscovery=new ServiceDiscoveryClient(configuration.get(Constants.CFG_ZOOKEEPER_ENSEMBLE,Constants.DEFAULT_ZOOKEEPER_ENSEMBLE));
  executorService.submit(dispatcher);
}

Fixed version (ground truth):
/** 
 * Constructs and initializes   {@link MetricsClient}.
 * @param configuration object.
 * @throws ServiceDiscoveryClientException thrown when the client isunable to discovery the service or unable to connect to zookeeper.
 */
public MetricsClient(CConfiguration configuration) throws ServiceDiscoveryClientException {
  this.queue=new LinkedBlockingDeque<String>(10000);
  connector=new NioSocketConnector();
  connector.setConnectTimeoutMillis(CONNECT_TIMEOUT);
  ProtocolCodecFilter protocolFilter=new ProtocolCodecFilter(new MetricCodecFactory(true));
  connector.getFilterChain().addLast("String_Node_Str",protocolFilter);
  connector.getSessionConfig().setKeepAlive(true);
  connector.getSessionConfig().setTcpNoDelay(true);
  connector.setHandler(new MetricsClientProtocolHandler());
  Runtime.getRuntime().addShutdownHook(new Thread(){
    public void run(){
      if (dispatcher != null) {
        dispatcher.stop();
      }
      if (connector != null) {
        connector.dispose();
        connector=null;
      }
      executorService.shutdown();
      if (serviceDiscovery != null) {
        try {
          serviceDiscovery.close();
        }
 catch (        IOException e) {
          Log.warn("String_Node_Str",e.getMessage());
          Log.debug(StackTraceUtil.toStringStackTrace(e));
        }
      }
      if (session != null) {
        session.close(true).awaitUninterruptibly(CONNECT_TIMEOUT);
        session=null;
      }
    }
  }
);
  serviceDiscovery=new ServiceDiscoveryClient(configuration.get(Constants.CFG_ZOOKEEPER_ENSEMBLE,Constants.DEFAULT_ZOOKEEPER_ENSEMBLE));
  executorService.submit(dispatcher);
}
Program: 8124
Project: 8124
Buggy source:
public void run(){
  if (dispatcher != null) {
    dispatcher.stop();
  }
  if (connector != null) {
    connector.dispose();
    connector=null;
  }
  executorService.shutdown();
  if (session != null) {
    session.close(true).awaitUninterruptibly(CONNECT_TIMEOUT);
    session=null;
  }
}

Fixed version (ground truth):
public void run(){
  if (dispatcher != null) {
    dispatcher.stop();
  }
  if (connector != null) {
    connector.dispose();
    connector=null;
  }
  executorService.shutdown();
  if (serviceDiscovery != null) {
    try {
      serviceDiscovery.close();
    }
 catch (    IOException e) {
      Log.warn("String_Node_Str",e.getMessage());
      Log.debug(StackTraceUtil.toStringStackTrace(e));
    }
  }
  if (session != null) {
    session.close(true).awaitUninterruptibly(CONNECT_TIMEOUT);
    session=null;
  }
}
Program: 8125
Project: 8125
Buggy source:
/** 
 * Run one iteration of the scheduled task. If any invocation of this method throws an exception, the service will transition to the   {@link com.google.common.util.concurrent.Service.State#FAILED} state and this method will nolonger be called.
 */
@Override protected void runOneIteration() throws Exception {
  for (  Future<MetricResponse.Status> future : futureList) {
    try {
      Await.ready(future,Duration.parse("String_Node_Str"));
    }
 catch (    TimeoutException e) {
      future.failed();
    }
    if (future.isCompleted()) {
      futureList.remove(future);
    }
  }
}

Fixed version (ground truth):
/** 
 * Run one iteration of the scheduled task. If any invocation of this method throws an exception, the service will transition to the   {@link com.google.common.util.concurrent.Service.State#FAILED} state and this method will nolonger be called.
 */
@Override protected void runOneIteration() throws Exception {
  Log.debug("String_Node_Str",reapFutures.size());
  if (reapFutures.size() < 1) {
    return;
  }
  for (  Future<MetricResponse.Status> future : reapFutures) {
    try {
      Await.ready(future,Duration.parse("String_Node_Str"));
    }
 catch (    TimeoutException e) {
      future.failed();
    }
    reapFutures.remove(future);
  }
  Log.debug("String_Node_Str",reapFutures.size());
}
Program: 8127
Project: 8127
Buggy source:
/** 
 * Provides a new session or selects from one of the available session.
 * @return Instance of session or null if cannot find or create one.
 */
private IoSession connect(){
  if (session != null && session.isConnected()) {
    return session;
  }
  ConnectFuture connectFuture=connector.connect(new InetSocketAddress(hostname,port));
  connectFuture.awaitUninterruptibly();
  try {
    return connectFuture.getSession();
  }
 catch (  RuntimeIoException e) {
    Log.warn("String_Node_Str",e.getMessage());
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Provides a new session or selects from one of the available session.
 * @return Instance of session or null if cannot find or create one.
 */
private IoSession connect(){
  if (session != null && session.isConnected()) {
    return session;
  }
  Log.info("String_Node_Str",hostname,port);
  ConnectFuture connectFuture=connector.connect(new InetSocketAddress(hostname,port));
  connectFuture.awaitUninterruptibly();
  try {
    return connectFuture.getSession();
  }
 catch (  RuntimeIoException e) {
    Log.warn("String_Node_Str",e.getMessage());
  }
  return null;
}
Program: 8128
Project: 8128
Buggy source:
public OpenTSDBInMemoryServer(int port) throws IOException {
  this.server=new ServerSocket(port);
  Log.debug("String_Node_Str",port);
  this.server.setSoTimeout(1000);
  this.running=true;
}

Fixed version (ground truth):
public OpenTSDBInMemoryServer(int port) throws IOException {
  this.server=new ServerSocket(port);
  Log.debug("String_Node_Str",port);
  this.server.setSoTimeout(5000);
  this.running=true;
}
Program: 8129
Project: 8129
Buggy source:
@Override public void run(){
  while (running) {
    try {
      Socket connected=server.accept();
      BufferedReader fromClient=new BufferedReader(new InputStreamReader(connected.getInputStream()));
      String command=fromClient.readLine();
      connected.close();
      commands.add(command);
    }
 catch (    SocketTimeoutException e) {
      if (!running) {
        break;
      }
    }
catch (    IOException e) {
      Log.error(e.getMessage());
      break;
    }
  }
  try {
    server.close();
  }
 catch (  IOException e) {
    Log.error("String_Node_Str",e.getMessage());
  }
}

Fixed version (ground truth):
@Override public void run(){
  while (running) {
    try {
      System.out.println("String_Node_Str");
      Socket connected=server.accept();
      BufferedReader fromClient=new BufferedReader(new InputStreamReader(connected.getInputStream()));
      System.out.println("String_Node_Str");
      String command=fromClient.readLine();
      System.out.println("String_Node_Str" + command);
      connected.close();
      commands.add(command);
    }
 catch (    SocketTimeoutException e) {
      if (!running) {
        break;
      }
    }
catch (    IOException e) {
      Log.error(e.getMessage());
      break;
    }
  }
  try {
    server.close();
  }
 catch (  IOException e) {
    Log.error("String_Node_Str",e.getMessage());
  }
}
Program: 8131
Project: 8131
Buggy source:
@BeforeClass public static void beforeClass() throws Exception {
  connectionUrl="String_Node_Str";
  configuration=CConfiguration.create();
  zookeeper=new InMemoryZookeeper();
  if (zookeeper.getConnectionString() == null) {
    throw new Exception("String_Node_Str");
  }
  configuration.set(Constants.CFG_ZOOKEEPER_ENSEMBLE,zookeeper.getConnectionString());
  client=new MetricsFrontendServiceImpl(configuration);
  Assert.assertNotNull(client);
}

Fixed version (ground truth):
@BeforeClass public static void beforeClass() throws Exception {
  connectionUrl="String_Node_Str";
  configuration=CConfiguration.create();
  zookeeper=new InMemoryZookeeper();
  if (zookeeper.getConnectionString() == null) {
    throw new Exception("String_Node_Str");
  }
  configuration.set(Constants.CFG_ZOOKEEPER_ENSEMBLE,zookeeper.getConnectionString());
  configuration.set(Constants.CFG_METRICS_CONNECTION_URL,connectionUrl);
  client=new MetricsFrontendServiceImpl(configuration);
  Assert.assertNotNull(client);
}
Program: 8134
Project: 8134
Buggy source:
/** 
 * Clears
 */
public static synchronized void clear(String name){
  for (  Map.Entry<MetricName,Metric> entry : Metrics.defaultRegistry().allMetrics().entrySet()) {
    if (entry.getKey().getGroup().contains(name)) {
      Metrics.defaultRegistry().removeMetric(entry.getKey());
    }
  }
}

Fixed version (ground truth):
/** 
 * Clears metrics for a given name.
 */
public static synchronized void clear(String name){
  for (  Map.Entry<MetricName,Metric> entry : Metrics.defaultRegistry().allMetrics().entrySet()) {
    if (entry.getKey().getGroup().contains(name)) {
      Metrics.defaultRegistry().removeMetric(entry.getKey());
    }
  }
}
Program: 8135
Project: 8135
Buggy source:
/** 
 * Creates a new AbstractPollingReporter instance
 * @param registry the MetricRegistry containing the metrics this reporter willreport
 * @param configuration instance of configuration object.
 */
protected OverlordMetricsReporter(MetricsRegistry registry,CConfiguration configuration){
  super(registry,"String_Node_Str");
  Preconditions.checkNotNull(configuration);
  Preconditions.checkNotNull(registry);
  this.configuration=configuration;
  this.vm=VirtualMachineMetrics.getInstance();
  this.hostname=getDefaultHostLabel();
  try {
    this.client=new MetricsClient(configuration);
  }
 catch (  ServiceDiscoveryClientException e) {
    Log.error("String_Node_Str");
    this.client=null;
  }
}

Fixed version (ground truth):
/** 
 * Creates a new AbstractPollingReporter instance
 * @param registry the MetricRegistry containing the metrics this reporter willreport
 * @param configuration instance of configuration object.
 */
protected OverlordMetricsReporter(MetricsRegistry registry,CConfiguration configuration){
  super(registry,"String_Node_Str");
  Preconditions.checkNotNull(configuration);
  Preconditions.checkNotNull(registry);
  this.vm=VirtualMachineMetrics.getInstance();
  this.hostname=getDefaultHostLabel();
  try {
    this.client=new MetricsClient(configuration);
  }
 catch (  ServiceDiscoveryClientException e) {
    Log.error("String_Node_Str");
    this.client=null;
  }
}
Program: 8136
Project: 8136
Buggy source:
public static synchronized void disable(){
  if (reporter != null) {
    reporter.shutdown();
    reporter=null;
  }
}

Fixed version (ground truth):
/** 
 * Disables the overlord metric reporter.
 */
public static synchronized void disable(){
  if (reporter != null) {
    reporter.shutdown();
    reporter=null;
  }
}
Program: 8137
Project: 8137
Buggy source:
public FlowMetricsProcessor(CConfiguration configuration) throws Exception {
  this.connectionUrl=configuration.get(Constants.CFG_METRICS_CONNECTION_URL,Constants.DEFAULT_METIRCS_CONNECTION_URL);
  this.type=DBUtils.loadDriver(connectionUrl);
  CommonDataSource dataSource;
  if (this.type == DBUtils.DBType.MYSQL) {
    MysqlConnectionPoolDataSource mysqlDataSource=new MysqlConnectionPoolDataSource();
    mysqlDataSource.setUrl(connectionUrl);
    poolManager=new DBConnectionPoolManager(mysqlDataSource,40);
  }
 else   if (this.type == DBUtils.DBType.HSQLDB) {
    JDBCPooledDataSource jdbcDataSource=new JDBCPooledDataSource();
    jdbcDataSource.setUrl(connectionUrl);
    poolManager=new DBConnectionPoolManager(jdbcDataSource,40);
  }
  DBUtils.createMetricsTables(getConnection(),this.type);
}

Fixed version (ground truth):
public FlowMetricsProcessor(CConfiguration configuration) throws Exception {
  this.connectionUrl=configuration.get(Constants.CFG_METRICS_CONNECTION_URL,Constants.DEFAULT_METIRCS_CONNECTION_URL);
  this.type=DBUtils.loadDriver(connectionUrl);
  if (this.type == DBUtils.DBType.MYSQL) {
    MysqlConnectionPoolDataSource mysqlDataSource=new MysqlConnectionPoolDataSource();
    mysqlDataSource.setUrl(connectionUrl);
    poolManager=new DBConnectionPoolManager(mysqlDataSource,40);
  }
 else   if (this.type == DBUtils.DBType.HSQLDB) {
    JDBCPooledDataSource jdbcDataSource=new JDBCPooledDataSource();
    jdbcDataSource.setUrl(connectionUrl);
    poolManager=new DBConnectionPoolManager(jdbcDataSource,40);
  }
  DBUtils.createMetricsTables(getConnection(),this.type);
}
Program: 8138
Project: 8138
Buggy source:
/** 
 * @return true if all tables created; false otherwise
 */
public static boolean createMetricsTables(Connection connection,DBType type){
  if (type != DBUtils.DBType.HSQLDB) {
    return true;
  }
  String metricsTableCreateDDL="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  try {
    connection.prepareStatement("String_Node_Str").execute();
    connection.prepareStatement(metricsTableCreateDDL).execute();
  }
 catch (  SQLException e) {
    if (!e.getSQLState().equalsIgnoreCase("String_Node_Str")) {
      Log.warn("String_Node_Str",e.getMessage());
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * @return true if all tables created; false otherwise
 */
public static boolean createMetricsTables(Connection connection,DBType type){
  if (type != DBUtils.DBType.HSQLDB) {
    return true;
  }
  String metricsTableCreateDDL="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  PreparedStatement stmt=null;
  try {
    stmt=connection.prepareStatement("String_Node_Str" + "String_Node_Str");
    stmt.execute();
    connection.prepareStatement(metricsTableCreateDDL).execute();
  }
 catch (  SQLException e) {
    if (!e.getSQLState().equalsIgnoreCase("String_Node_Str")) {
      Log.warn("String_Node_Str",e.getMessage());
      return false;
    }
  }
 finally {
    try {
      if (stmt != null) {
        stmt.close();
      }
      if (connection != null) {
        connection.close();
      }
    }
 catch (    SQLException e) {
      Log.warn("String_Node_Str",e.getMessage());
    }
  }
  return true;
}
Program: 8140
Project: 8140
Buggy source:
/** 
 * @return a {@link java.sql.Connection} based on the <code>connectionUrl</code>
 * @throws java.sql.SQLException thrown in case of any error.
 */
private synchronized Connection getConnection() throws SQLException {
  if (connection == null) {
    connection=DriverManager.getConnection(connectionUrl);
  }
  return connection;
}

Fixed version (ground truth):
/** 
 * @return a {@link java.sql.Connection} based on the <code>connectionUrl</code>
 * @throws java.sql.SQLException thrown in case of any error.
 */
private synchronized Connection getConnection() throws SQLException {
  if (poolManager != null) {
    return poolManager.getValidConnection();
  }
  return null;
}
Program: 8141
Project: 8141
Buggy source:
public MetricsFrontendServiceImpl(CConfiguration configuration) throws ClassNotFoundException, SQLException {
  this.connectionUrl=configuration.get(Constants.CFG_METRICS_CONNECTION_URL,Constants.DEFAULT_METIRCS_CONNECTION_URL);
  this.type=DBUtils.loadDriver(connectionUrl);
  DBUtils.createMetricsTables(getConnection(),this.type);
}

Fixed version (ground truth):
public MetricsFrontendServiceImpl(CConfiguration configuration) throws ClassNotFoundException, SQLException {
  this.connectionUrl=configuration.get(Constants.CFG_METRICS_CONNECTION_URL,Constants.DEFAULT_METIRCS_CONNECTION_URL);
  this.type=DBUtils.loadDriver(connectionUrl);
  if (this.type == DBUtils.DBType.MYSQL) {
    MysqlConnectionPoolDataSource mysqlDataSource=new MysqlConnectionPoolDataSource();
    mysqlDataSource.setUrl(connectionUrl);
    poolManager=new DBConnectionPoolManager(mysqlDataSource,40);
  }
 else   if (this.type == DBUtils.DBType.HSQLDB) {
    JDBCPooledDataSource jdbcDataSource=new JDBCPooledDataSource();
    jdbcDataSource.setUrl(connectionUrl);
    poolManager=new DBConnectionPoolManager(jdbcDataSource,40);
  }
  DBUtils.createMetricsTables(getConnection(),this.type);
}
Program: 8142
Project: 8142
Buggy source:
/** 
 * Load Configuration looks for all of the config xml files in the resources directory, and loads all of the properties into those files.
 */
private void loadConfiguration(){
}

Fixed version (ground truth):
/** 
 * Load Configuration looks for all of the config xml files in the resources directory, and loads all of the properties into those files.
 */
private void loadConfiguration(){
  myConfiguration=CConfiguration.create();
}
Program: 8143
Project: 8143
Buggy source:
/** 
 * Sends the metric request to openTSDB. <p> If connection is not established, then it attempts to connect N times before bailing out. </p>
 * @param request
 * @return
 * @throws IOException
 */
public WriteFuture send(String request) throws IOException {
  IoSession session=connect();
  if (session == null) {
    int attempts=RETRY_ATTEMPTS;
    while (attempts > 0) {
      try {
        Thread.sleep(INTRA_CONNECT_SLEEP_MS);
      }
 catch (      InterruptedException e) {
      }
      attempts--;
      session=connect();
    }
    if (attempts < 1) {
      throw new IOException("String_Node_Str" + "String_Node_Str");
    }
  }
  return session.write(request);
}

Fixed version (ground truth):
/** 
 * Sends the metric request to openTSDB. <p> If connection is not established, then it attempts to connect N times before bailing out. </p>
 * @param request
 * @return
 * @throws IOException
 */
public WriteFuture send(String request) throws IOException {
  session=connect();
  if (session == null) {
    int attempts=RETRY_ATTEMPTS;
    while (attempts > 0) {
      try {
        Thread.sleep(INTRA_CONNECT_SLEEP_MS);
      }
 catch (      InterruptedException e) {
      }
      attempts--;
      session=connect();
    }
    if (attempts < 1) {
      throw new IOException("String_Node_Str" + "String_Node_Str");
    }
  }
  return session.write(request);
}