Program: 144494
Project: 144494
Buggy source:
private Orders transformToOrderEntityBean(OrderBean formBean){
  Orders entity=new Orders();
  Client client=clientService.findClientById(getClientId().toString());
  entity.setClient(client);
  entity.setOrderDate(new Date());
  entity.setServiceRequirement(formBean.getServiceRequirement());
  Customer customerEntity=customerService.findCustomerById(formBean.getCustomerId());
  custName=customerEntity.getCustomerName();
  custCode=customerEntity.getCustomerCode();
  orderNum=orderService.findNextBookingNo(getClientId(),custCode);
  if (formBean.getOrderNumber() != null) {
    entity.setOrderNumber(new String(formBean.getOrderNumber()));
  }
 else {
    entity.setOrderNumber(orderNum);
  }
  if (formBean.getOrderId() != null)   entity.setOrderId(new Integer(formBean.getOrderId()));
  entity.setServiceType(formBean.getFreightType());
  entity.setServiceMode(formBean.getModeOfService());
  entity.setNotificationType(formBean.getNotifyBy());
  entity.setPaymentMode(formBean.getModeOfPayment());
  entity.setOriginationPort(formBean.getOriginationPort());
  entity.setDestinationPort(formBean.getDestinationPort());
  entity.setComments(formBean.getComments());
  entity.setOrderStatus("String_Node_Str");
  entity.setRates(99.99);
  entity.setCreatedBy(commonUtils.getUserNameFromSession());
  entity.setAccountRep(commonUtils.getUserNameFromSession());
  entity.setModifiedBy(commonUtils.getUserNameFromSession());
  entity.setCreatedTimestamp(new Date());
  entity.setModifiedTimestamp(new Date());
  entity.setShipperAddressId(formBean.getShipperAddressId());
  entity.setShipperContactId(formBean.getShipperContactId());
  entity.setConsigneeAddressId(formBean.getConsigneeAddressId());
  entity.setConsigneeContactId(formBean.getConsigneeContactId());
  entity.setDeliveryDate(formBean.getDeliveryDate());
  entity.setPickupDate(formBean.getPickupDate());
  Contacts contactShipperName=customerService.findContactById(order.getShipperContactId());
  Customer shipperName=customerService.findCustomerById(contactShipperName.getReferenceId());
  entity.setCustomerId(shipperName.getCustomerId());
  return entity;
}

Fixed version (ground truth):
private Orders transformToOrderEntityBean(OrderBean formBean){
  Orders entity=new Orders();
  Client client=clientService.findClientById(getClientId().toString());
  entity.setClient(client);
  entity.setOrderDate(new Date());
  entity.setServiceRequirement(formBean.getServiceRequirement());
  Customer customerEntity=customerService.findCustomerById(formBean.getCustomerId());
  custName=customerEntity.getCustomerName();
  custCode=customerEntity.getCustomerCode();
  orderNum=orderService.findNextBookingNo(getClientId(),custCode);
  if (formBean.getOrderNumber() != null) {
    entity.setOrderNumber(new String(formBean.getOrderNumber()));
  }
 else {
    entity.setOrderNumber(orderNum);
  }
  if (formBean.getOrderId() != null) {
    entity.setOrderId(new Integer(formBean.getOrderId()));
  }
  entity.setServiceType(formBean.getFreightType());
  entity.setServiceMode(formBean.getModeOfService());
  entity.setNotificationType(formBean.getNotifyBy());
  entity.setPaymentMode(formBean.getModeOfPayment());
  entity.setOriginationPort(formBean.getOriginationPort());
  entity.setDestinationPort(formBean.getDestinationPort());
  entity.setComments(formBean.getComments());
  entity.setOrderStatus("String_Node_Str");
  entity.setRates(99.99);
  entity.setCreatedBy(commonUtils.getUserNameFromSession());
  entity.setAccountRep(commonUtils.getUserNameFromSession());
  entity.setModifiedBy(commonUtils.getUserNameFromSession());
  entity.setCreatedTimestamp(new Date());
  entity.setModifiedTimestamp(new Date());
  entity.setShipperAddressId(formBean.getShipperAddressId());
  entity.setShipperContactId(formBean.getShipperContactId());
  entity.setConsigneeAddressId(formBean.getConsigneeAddressId());
  entity.setConsigneeContactId(formBean.getConsigneeContactId());
  entity.setDeliveryDate(formBean.getDeliveryDate());
  entity.setPickupDate(formBean.getPickupDate());
  Contacts contactShipperName=customerService.findContactById(order.getShipperContactId());
  Customer shipperName=customerService.findCustomerById(contactShipperName.getReferenceId());
  entity.setCustomerId(shipperName.getCustomerId());
  return entity;
}