Program: 115493
Project: 115493
Buggy source:
/** 
 * Update Cartridge
 * @param cartridgeBean Cartridge Definition
 * @throws RestAPIException
 */
public static void updateCartridge(CartridgeBean cartridgeBean) throws RestAPIException {
  try {
    PrivilegedCarbonContext carbonContext=PrivilegedCarbonContext.getThreadLocalCarbonContext();
    CloudControllerServiceClient cloudControllerServiceClient=CloudControllerServiceClient.getInstance();
    Cartridge existingCartridge=cloudControllerServiceClient.getCartridgeByTenant(cartridgeBean.getType(),carbonContext.getTenantId());
    Cartridge cartridgeConfig=createCartridgeConfig(cartridgeBean,existingCartridge.getUuid(),existingCartridge.getTenantId());
    cartridgeConfig.setUuid(existingCartridge.getUuid());
    if (log.isDebugEnabled()) {
      log.debug(String.format("String_Node_Str",existingCartridge.getUuid(),cartridgeBean.getType(),existingCartridge.getTenantId()));
    }
    List<IaasProviderBean> iaasProviders=cartridgeBean.getIaasProvider();
    if ((iaasProviders == null) || iaasProviders.size() == 0) {
      throw new RestAPIException(String.format("String_Node_Str" + "String_Node_Str",existingCartridge.getUuid(),cartridgeBean.getType(),existingCartridge.getTenantId()));
    }
    cloudControllerServiceClient.updateCartridge(cartridgeConfig);
    if (log.isDebugEnabled()) {
      log.debug(String.format("String_Node_Str" + "String_Node_Str",existingCartridge.getUuid(),cartridgeBean.getType(),existingCartridge.getTenantId()));
    }
  }
 catch (  CloudControllerServiceCartridgeDefinitionNotExistsExceptionException e) {
    String msg="String_Node_Str";
    log.error(msg,e);
    throw new RestAPIException(msg);
  }
catch (  CloudControllerServiceInvalidCartridgeDefinitionExceptionException e) {
    String msg="String_Node_Str";
    log.error(msg,e);
    throw new RestAPIException(msg);
  }
catch (  RemoteException e) {
    String msg="String_Node_Str";
    log.error(msg,e);
    throw new RestAPIException(msg);
  }
catch (  CloudControllerServiceInvalidIaasProviderExceptionException e) {
    String msg="String_Node_Str";
    log.error(msg,e);
    throw new RestAPIException(msg);
  }
catch (  CloudControllerServiceCartridgeNotFoundExceptionException e) {
    String msg="String_Node_Str";
    log.error(msg,e);
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * Update Cartridge
 * @param cartridgeBean Cartridge Definition
 * @throws RestAPIException
 */
public static void updateCartridge(CartridgeBean cartridgeBean) throws RestAPIException {
  try {
    PrivilegedCarbonContext carbonContext=PrivilegedCarbonContext.getThreadLocalCarbonContext();
    CloudControllerServiceClient cloudControllerServiceClient=CloudControllerServiceClient.getInstance();
    Cartridge existingCartridge=cloudControllerServiceClient.getCartridgeByTenant(cartridgeBean.getType(),carbonContext.getTenantId());
    Cartridge cartridgeConfig=createCartridgeConfig(cartridgeBean,existingCartridge.getUuid(),existingCartridge.getTenantId());
    cartridgeConfig.setUuid(existingCartridge.getUuid());
    if (log.isDebugEnabled()) {
      log.debug(String.format("String_Node_Str",existingCartridge.getUuid(),cartridgeBean.getType(),existingCartridge.getTenantId()));
    }
    List<IaasProviderBean> iaasProviders=cartridgeBean.getIaasProvider();
    if ((iaasProviders == null) || iaasProviders.size() == 0) {
      throw new RestAPIException(String.format("String_Node_Str" + "String_Node_Str",existingCartridge.getUuid(),cartridgeBean.getType(),existingCartridge.getTenantId()));
    }
    cloudControllerServiceClient.updateCartridge(cartridgeConfig);
    if (log.isDebugEnabled()) {
      log.debug(String.format("String_Node_Str" + "String_Node_Str",existingCartridge.getUuid(),cartridgeBean.getType(),existingCartridge.getTenantId()));
    }
  }
 catch (  CloudControllerServiceCartridgeDefinitionNotExistsExceptionException e) {
    String msg="String_Node_Str";
    log.error(msg,e);
    throw new RestAPIException(msg);
  }
catch (  CloudControllerServiceInvalidCartridgeDefinitionExceptionException e) {
    String msg="String_Node_Str";
    log.error(msg,e);
    throw new RestAPIException(msg);
  }
catch (  RemoteException e) {
    String msg="String_Node_Str";
    log.error(msg,e);
    throw new RestAPIException(msg);
  }
catch (  CloudControllerServiceInvalidIaasProviderExceptionException e) {
    String msg="String_Node_Str";
    log.error(msg,e);
    throw new RestAPIException(msg);
  }
catch (  CloudControllerServiceCartridgeNotFoundExceptionException e) {
    String msg="String_Node_Str";
    log.error(msg,e);
  }
}