Program: 14374
Project: 14374
Buggy source:
@Override public void fireEvent(ClockTick event){
  List<LoadBalancerServoInstance> outOfService=null;
  final EntityTransaction db=Entities.get(LoadBalancerServoInstance.class);
  try {
    LoadBalancerServoInstance sample=LoadBalancerServoInstance.withState(LoadBalancerServoInstance.STATE.OutOfService.name());
    outOfService=Entities.query(sample);
  }
 catch (  NoSuchElementException ex) {
    ;
  }
catch (  Exception ex) {
    LOG.warn("String_Node_Str",ex);
  }
 finally {
    db.commit();
  }
  if (outOfService == null || outOfService.size() <= 0)   return;
  final List<String> param=Lists.newArrayList();
  final Map<String,String> latestState=Maps.newHashMap();
  for (  final LoadBalancerServoInstance instance : outOfService) {
    String instanceId=instance.getInstanceId();
    if (instanceId == null)     continue;
    param.clear();
    param.add(instanceId);
    String instanceState=null;
    try {
      final List<RunningInstancesItemType> result=EucalyptusActivityTasks.getInstance().describeInstances(param);
      if (result.isEmpty())       instanceState="String_Node_Str";
 else       instanceState=result.get(0).getStateName();
    }
 catch (    final Exception ex) {
      LOG.warn("String_Node_Str",ex);
      continue;
    }
    latestState.put(instanceId,instanceState);
  }
  for (  String instanceId : latestState.keySet()) {
    String state=latestState.get(instanceId);
    if (state.equals("String_Node_Str")) {
      final EntityTransaction db2=Entities.get(LoadBalancerServoInstance.class);
      try {
        LoadBalancerServoInstance toDelete=Entities.uniqueResult(LoadBalancerServoInstance.named(instanceId));
        Entities.delete(toDelete);
        db2.commit();
      }
 catch (      Exception ex) {
        db2.rollback();
      }
    }
  }
}

Fixed version (ground truth):
@Override public void fireEvent(ClockTick event){
  List<LoadBalancerServoInstance> outOfService=null;
  final EntityTransaction db=Entities.get(LoadBalancerServoInstance.class);
  try {
    LoadBalancerServoInstance sample=LoadBalancerServoInstance.withState(LoadBalancerServoInstance.STATE.OutOfService.name());
    outOfService=Entities.query(sample);
    db.commit();
  }
 catch (  NoSuchElementException ex) {
    db.rollback();
  }
catch (  Exception ex) {
    db.rollback();
    LOG.warn("String_Node_Str",ex);
  }
  if (outOfService == null || outOfService.size() <= 0)   return;
  final List<String> param=Lists.newArrayList();
  final Map<String,String> latestState=Maps.newHashMap();
  for (  final LoadBalancerServoInstance instance : outOfService) {
    String instanceId=instance.getInstanceId();
    if (instanceId == null)     continue;
    param.clear();
    param.add(instanceId);
    String instanceState=null;
    try {
      final List<RunningInstancesItemType> result=EucalyptusActivityTasks.getInstance().describeInstances(param);
      if (result.isEmpty())       instanceState="String_Node_Str";
 else       instanceState=result.get(0).getStateName();
    }
 catch (    final Exception ex) {
      LOG.warn("String_Node_Str",ex);
      continue;
    }
    latestState.put(instanceId,instanceState);
  }
  for (  String instanceId : latestState.keySet()) {
    String state=latestState.get(instanceId);
    if (state.equals("String_Node_Str")) {
      final EntityTransaction db2=Entities.get(LoadBalancerServoInstance.class);
      try {
        LoadBalancerServoInstance toDelete=Entities.uniqueResult(LoadBalancerServoInstance.named(instanceId));
        Entities.delete(toDelete);
        db2.commit();
      }
 catch (      Exception ex) {
        db2.rollback();
      }
    }
  }
}