Program: 58486
Project: 58486
Buggy source:
public void createPartnerAddress(ActionRequest request,ActionResponse response){
  Context context=request.getContext();
  Context parentContext=context.getParent();
  if (parentContext.isEmpty()) {
    return;
  }
  String parentModel=(String)parentContext.get("String_Node_Str");
  String partnerField=IPartner.modelPartnerFieldMap.get(parentModel);
  Partner partner=null;
  if (parentContext.get(partnerField) instanceof Partner) {
    partner=(Partner)parentContext.get(partnerField);
  }
 else   if (parentContext.get(partnerField) instanceof Map) {
    partner=Mapper.toBean(Partner.class,(Map<String,Object>)parentContext.get(partnerField));
  }
  if (partner == null || partner.getId() == null) {
    return;
  }
  Address address=context.asType(Address.class);
  PartnerAddress partnerAddress=Beans.get(PartnerAddressRepository.class).all().filter("String_Node_Str",partner.getId(),address.getId()).fetchOne();
  if (partnerAddress == null) {
    partner=Beans.get(PartnerRepository.class).find(partner.getId());
    address=Beans.get(AddressRepository.class).find(address.getId());
    Boolean invoicing=(Boolean)context.get("String_Node_Str");
    Boolean delivery=(Boolean)context.get("String_Node_Str");
    Boolean isDefault=(Boolean)context.get("String_Node_Str");
    PartnerService partnerService=Beans.get(PartnerService.class);
    partnerService.addPartnerAddress(partner,address,isDefault,invoicing,delivery);
    partnerService.savePartner(partner);
  }
}

Fixed version (ground truth):
public void createPartnerAddress(ActionRequest request,ActionResponse response){
  Context context=request.getContext();
  Context parentContext=context.getParent();
  if (parentContext.isEmpty()) {
    return;
  }
  String parentModel=(String)parentContext.get("String_Node_Str");
  LOG.debug("String_Node_Str",parentModel);
  String partnerField=PartnerAddressRepository.modelPartnerFieldMap.get(parentModel);
  LOG.debug("String_Node_Str",partnerField);
  Partner partner=null;
  if (parentContext.get(partnerField) instanceof Partner) {
    partner=(Partner)parentContext.get(partnerField);
  }
 else   if (parentContext.get(partnerField) instanceof Map) {
    partner=Mapper.toBean(Partner.class,(Map<String,Object>)parentContext.get(partnerField));
  }
  LOG.debug("String_Node_Str",partner);
  if (partner == null || partner.getId() == null) {
    return;
  }
  Address address=context.asType(Address.class);
  PartnerAddress partnerAddress=Beans.get(PartnerAddressRepository.class).all().filter("String_Node_Str",partner.getId(),address.getId()).fetchOne();
  LOG.debug("String_Node_Str",partnerAddress);
  if (partnerAddress == null) {
    partner=Beans.get(PartnerRepository.class).find(partner.getId());
    address=Beans.get(AddressRepository.class).find(address.getId());
    Boolean invoicing=(Boolean)context.get("String_Node_Str");
    if (invoicing == null) {
      invoicing=false;
    }
    Boolean delivery=(Boolean)context.get("String_Node_Str");
    if (delivery == null) {
      delivery=false;
    }
    Boolean isDefault=(Boolean)context.get("String_Node_Str");
    if (isDefault == null) {
      isDefault=false;
    }
    PartnerService partnerService=Beans.get(PartnerService.class);
    partnerService.addPartnerAddress(partner,address,isDefault,invoicing,delivery);
    partnerService.savePartner(partner);
  }
}