Program: 105639
Project: 105639
Buggy source:
private Object dispatchToStateAdapters(ResourceStateAdapter.Event event,boolean singleTaker,Object... args){
synchronized (_resourceStateAdapters) {
    Iterator<Map.Entry<String,ResourceStateAdapter>> it=_resourceStateAdapters.entrySet().iterator();
    Object result=null;
    while (it.hasNext()) {
      Map.Entry<String,ResourceStateAdapter> item=it.next();
      ResourceStateAdapter adapter=item.getValue();
      String msg=new String("String_Node_Str" + event + "String_Node_Str"+ item.getKey());
      s_logger.debug(msg);
      if (event == ResourceStateAdapter.Event.CREATE_HOST_VO_FOR_CONNECTED) {
        result=adapter.createHostVOForConnectedAgent((HostVO)args[0],(StartupCommand[])args[1]);
        if (result != null && singleTaker) {
          break;
        }
      }
 else       if (event == ResourceStateAdapter.Event.CREATE_HOST_VO_FOR_DIRECT_CONNECT) {
        result=adapter.createHostVOForDirectConnectAgent((HostVO)args[0],(StartupCommand[])args[1],(ServerResource)args[2],(Map<String,String>)args[3],(List<String>)args[4]);
        if (result != null && singleTaker) {
          break;
        }
      }
 else       if (event == ResourceStateAdapter.Event.DELETE_HOST) {
        try {
          result=adapter.deleteHost((HostVO)args[0],(Boolean)args[1],(Boolean)args[2]);
          if (result != null) {
            break;
          }
        }
 catch (        UnableDeleteHostException e) {
          s_logger.debug("String_Node_Str" + adapter.getName() + "String_Node_Str",e);
          result=new ResourceStateAdapter.DeleteHostAnswer(false,true);
        }
      }
 else {
        throw new CloudRuntimeException("String_Node_Str" + event);
      }
    }
    return result;
  }
}

Fixed version (ground truth):
private Object dispatchToStateAdapters(ResourceStateAdapter.Event event,boolean singleTaker,Object... args){
synchronized (_resourceStateAdapters) {
    Iterator<Map.Entry<String,ResourceStateAdapter>> it=_resourceStateAdapters.entrySet().iterator();
    Object result=null;
    while (it.hasNext()) {
      Map.Entry<String,ResourceStateAdapter> item=it.next();
      ResourceStateAdapter adapter=item.getValue();
      String msg="String_Node_Str" + event + "String_Node_Str"+ item.getKey();
      s_logger.debug(msg);
      if (event == ResourceStateAdapter.Event.CREATE_HOST_VO_FOR_CONNECTED) {
        result=adapter.createHostVOForConnectedAgent((HostVO)args[0],(StartupCommand[])args[1]);
        if (result != null && singleTaker) {
          break;
        }
      }
 else       if (event == ResourceStateAdapter.Event.CREATE_HOST_VO_FOR_DIRECT_CONNECT) {
        result=adapter.createHostVOForDirectConnectAgent((HostVO)args[0],(StartupCommand[])args[1],(ServerResource)args[2],(Map<String,String>)args[3],(List<String>)args[4]);
        if (result != null && singleTaker) {
          break;
        }
      }
 else       if (event == ResourceStateAdapter.Event.DELETE_HOST) {
        try {
          result=adapter.deleteHost((HostVO)args[0],(Boolean)args[1],(Boolean)args[2]);
          if (result != null) {
            break;
          }
        }
 catch (        UnableDeleteHostException e) {
          s_logger.debug("String_Node_Str" + adapter.getName() + "String_Node_Str",e);
          result=new ResourceStateAdapter.DeleteHostAnswer(false,true);
        }
      }
 else {
        throw new CloudRuntimeException("String_Node_Str" + event);
      }
    }
    return result;
  }
}