Program: 106051
Project: 106051
Buggy source:
@Override public OpenDaylightControllerVO addController(AddOpenDaylightControllerCmd cmd){
  ServerResource odlController=new OpenDaylightControllerResource();
  final String deviceName=NetworkDevice.OpenDaylightController.getName();
  NetworkDevice networkDevice=NetworkDevice.getNetworkDevice(deviceName);
  final Long physicalNetworkId=cmd.getPhysicalNetworkId();
  PhysicalNetworkVO physicalNetwork=physicalNetworkDao.findById(physicalNetworkId);
  if (physicalNetwork == null) {
    throw new InvalidParameterValueException("String_Node_Str" + physicalNetworkId);
  }
  long zoneId=physicalNetwork.getDataCenterId();
  final PhysicalNetworkServiceProviderVO ntwkSvcProvider=physicalNetworkServiceProviderDao.findByServiceProvider(physicalNetwork.getId(),networkDevice.getNetworkServiceProvder());
  if (ntwkSvcProvider == null) {
    throw new CloudRuntimeException("String_Node_Str" + networkDevice.getNetworkServiceProvder() + "String_Node_Str"+ physicalNetworkId+ "String_Node_Str");
  }
 else   if (ntwkSvcProvider.getState() == PhysicalNetworkServiceProvider.State.Shutdown) {
    throw new CloudRuntimeException("String_Node_Str" + ntwkSvcProvider.getProviderName() + "String_Node_Str"+ physicalNetworkId+ "String_Node_Str");
  }
  final Map<String,String> hostParams=new HashMap<String,String>();
  hostParams.put("String_Node_Str",UUID.randomUUID().toString());
  hostParams.put("String_Node_Str",String.valueOf(physicalNetwork.getDataCenterId()));
  hostParams.put("String_Node_Str",String.valueOf(physicalNetwork.getId()));
  hostParams.put("String_Node_Str","String_Node_Str" + hostParams.get("String_Node_Str"));
  hostParams.put("String_Node_Str",cmd.getUrl());
  hostParams.put("String_Node_Str",cmd.getUsername());
  hostParams.put("String_Node_Str",cmd.getPassword());
  Map<String,Object> hostdetails=new HashMap<String,Object>();
  hostdetails.putAll(hostParams);
  try {
    odlController.configure(hostParams.get("String_Node_Str"),hostdetails);
    final Host host=resourceManager.addHost(zoneId,odlController,Host.Type.L2Networking,hostParams);
    if (host != null) {
      return Transaction.execute(new TransactionCallback<OpenDaylightControllerVO>(){
        @Override public OpenDaylightControllerVO doInTransaction(        TransactionStatus status){
          OpenDaylightControllerVO controller=new OpenDaylightControllerVO(host.getId(),physicalNetworkId,ntwkSvcProvider.getProviderName(),hostParams.get("String_Node_Str"));
          openDaylightControllerMappingDao.persist(controller);
          return controller;
        }
      }
);
    }
 else {
      throw new CloudRuntimeException("String_Node_Str");
    }
  }
 catch (  ConfigurationException e) {
    throw new CloudRuntimeException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
@Override public OpenDaylightControllerVO addController(AddOpenDaylightControllerCmd cmd){
  ServerResource odlController=new OpenDaylightControllerResource();
  final String deviceName=NetworkDevice.OpenDaylightController.getName();
  NetworkDevice networkDevice=NetworkDevice.getNetworkDevice(deviceName);
  if (networkDevice == null) {
    throw new CloudRuntimeException("String_Node_Str" + deviceName);
  }
  final Long physicalNetworkId=cmd.getPhysicalNetworkId();
  PhysicalNetworkVO physicalNetwork=physicalNetworkDao.findById(physicalNetworkId);
  if (physicalNetwork == null) {
    throw new InvalidParameterValueException("String_Node_Str" + physicalNetworkId);
  }
  long zoneId=physicalNetwork.getDataCenterId();
  final PhysicalNetworkServiceProviderVO ntwkSvcProvider=physicalNetworkServiceProviderDao.findByServiceProvider(physicalNetwork.getId(),networkDevice.getNetworkServiceProvder());
  if (ntwkSvcProvider == null) {
    throw new CloudRuntimeException("String_Node_Str" + networkDevice.getNetworkServiceProvder() + "String_Node_Str"+ physicalNetworkId+ "String_Node_Str");
  }
 else   if (ntwkSvcProvider.getState() == PhysicalNetworkServiceProvider.State.Shutdown) {
    throw new CloudRuntimeException("String_Node_Str" + ntwkSvcProvider.getProviderName() + "String_Node_Str"+ physicalNetworkId+ "String_Node_Str");
  }
  final Map<String,String> hostParams=new HashMap<String,String>();
  hostParams.put("String_Node_Str",UUID.randomUUID().toString());
  hostParams.put("String_Node_Str",String.valueOf(physicalNetwork.getDataCenterId()));
  hostParams.put("String_Node_Str",String.valueOf(physicalNetwork.getId()));
  hostParams.put("String_Node_Str","String_Node_Str" + hostParams.get("String_Node_Str"));
  hostParams.put("String_Node_Str",cmd.getUrl());
  hostParams.put("String_Node_Str",cmd.getUsername());
  hostParams.put("String_Node_Str",cmd.getPassword());
  Map<String,Object> hostdetails=new HashMap<String,Object>();
  hostdetails.putAll(hostParams);
  try {
    odlController.configure(hostParams.get("String_Node_Str"),hostdetails);
    final Host host=resourceManager.addHost(zoneId,odlController,Host.Type.L2Networking,hostParams);
    if (host != null) {
      return Transaction.execute(new TransactionCallback<OpenDaylightControllerVO>(){
        @Override public OpenDaylightControllerVO doInTransaction(        TransactionStatus status){
          OpenDaylightControllerVO controller=new OpenDaylightControllerVO(host.getId(),physicalNetworkId,ntwkSvcProvider.getProviderName(),hostParams.get("String_Node_Str"));
          openDaylightControllerMappingDao.persist(controller);
          return controller;
        }
      }
);
    }
 else {
      throw new CloudRuntimeException("String_Node_Str");
    }
  }
 catch (  ConfigurationException e) {
    throw new CloudRuntimeException("String_Node_Str",e);
  }
}