Program: 89856
Project: 89856
Buggy source:
@Override public ServiceOffering updateServiceOffering(UpdateServiceOfferingCmd cmd){
  String displayText=cmd.getDisplayText();
  Long id=cmd.getId();
  String name=cmd.getServiceOfferingName();
  Boolean ha=cmd.getOfferHa();
  Long userId=UserContext.current().getCallerUserId();
  Long domainId=cmd.getDomainId();
  if (userId == null) {
    userId=Long.valueOf(User.UID_SYSTEM);
  }
  ServiceOfferingVO offeringHandle=_serviceOfferingDao.findById(id);
  ;
  if (offeringHandle == null) {
    throw new ServerApiException(BaseCmd.PARAM_ERROR,"String_Node_Str" + id);
  }
  boolean updateNeeded=(name != null || displayText != null || ha != null || domainId != null);
  if (!updateNeeded) {
    return _serviceOfferingDao.findById(id);
  }
  ServiceOfferingVO offering=_serviceOfferingDao.createForUpdate(id);
  if (name != null) {
    offering.setName(name);
  }
  if (displayText != null) {
    offering.setDisplayText(displayText);
  }
  if (ha != null) {
    offering.setOfferHA(ha);
  }
  if (domainId != null) {
    offering.setDomainId(domainId);
  }
  if (_serviceOfferingDao.update(id,offering)) {
    offering=_serviceOfferingDao.findById(id);
    saveConfigurationEvent(userId,null,EventTypes.EVENT_SERVICE_OFFERING_EDIT,"String_Node_Str" + offering.getName() + "String_Node_Str","String_Node_Str" + offering.getId(),"String_Node_Str" + offering.getName(),"String_Node_Str" + offering.getDisplayText(),"String_Node_Str" + offering.getOfferHA(),"String_Node_Str" + (offering.getGuestIpType() == NetworkOffering.GuestIpType.Virtual),"String_Node_Str" + offering.getTags(),"String_Node_Str" + offering.getDomainId());
    return offering;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@Override public ServiceOffering updateServiceOffering(UpdateServiceOfferingCmd cmd){
  String displayText=cmd.getDisplayText();
  Long id=cmd.getId();
  String name=cmd.getServiceOfferingName();
  Boolean ha=cmd.getOfferHa();
  Long userId=UserContext.current().getCallerUserId();
  Long domainId=cmd.getDomainId();
  if (userId == null) {
    userId=Long.valueOf(User.UID_SYSTEM);
  }
  ServiceOfferingVO offeringHandle=_serviceOfferingDao.findById(id);
  ;
  if (offeringHandle == null) {
    throw new ServerApiException(BaseCmd.PARAM_ERROR,"String_Node_Str" + id);
  }
  boolean updateNeeded=(name != null || displayText != null || ha != null || domainId != null);
  if (!updateNeeded) {
    return _serviceOfferingDao.findById(id);
  }
  ServiceOfferingVO offering=_serviceOfferingDao.createForUpdate(id);
  if (name != null) {
    offering.setName(name);
  }
  if (displayText != null) {
    offering.setDisplayText(displayText);
  }
  if (ha != null) {
    offering.setOfferHA(ha);
  }
  if (domainId != null) {
    offering.setDomainId(domainId);
  }
  if (_serviceOfferingDao.update(id,offering)) {
    offering=_serviceOfferingDao.findById(id);
    saveConfigurationEvent(userId,null,EventTypes.EVENT_SERVICE_OFFERING_EDIT,"String_Node_Str" + offering.getName() + "String_Node_Str","String_Node_Str" + offering.getId(),"String_Node_Str" + offering.getName(),"String_Node_Str" + offering.getDisplayText(),"String_Node_Str" + offering.getOfferHA(),"String_Node_Str" + (offering.getGuestIpType() == Network.GuestIpType.Virtual),"String_Node_Str" + offering.getTags(),"String_Node_Str" + offering.getDomainId());
    return offering;
  }
 else {
    return null;
  }
}