Program: 144344
Project: 144344
Buggy source:
public String addItemsInTable(){
  if (hasFieldErrors()) {
    return INPUT;
  }
  Map sessionAttributes=ActionContext.getContext().getSession();
  Orders orderEntityForm=orderService.findOrdersById((Integer)sessionAttributes.get("String_Node_Str"));
  order=transformToOrderFormBean(orderEntityForm);
  String orderLimit=orderEntityForm.getServiceRequirement();
  List<OrderItems> orderItemNumberList=orderService.findAllItemByOrderId((Integer)sessionAttributes.get("String_Node_Str"));
  if (orderEntityForm.getServiceRequirement().equals("String_Node_Str") || orderEntityForm.getServiceRequirement().equals("String_Node_Str") || orderEntityForm.getServiceRequirement().equals("String_Node_Str")|| orderEntityForm.getServiceRequirement().equals("String_Node_Str")) {
    List<Items> allItemsList=customerService.findAllItemsInTable();
    Integer itemCheck=0;
    for (    Items itemsElem : allItemsList) {
      if (itemsElem.getItemCode().equals(item.getItemCode())) {
        itemCheck=itemCheck + 1;
      }
    }
    if (itemCheck == 0) {
      Items itemEntity=transformToEntityBeanItem(item);
      itemEntity.setModifiedBy(commonUtils.getUserNameFromSession());
      itemEntity.setCreatedBy(commonUtils.getUserNameFromSession());
      itemEntity.setCreatedTimeStamp(new Date());
      customerService.addItem(itemEntity);
    }
  }
  Integer orderItemQuantityTotal=0;
  for (int i=0; i < orderItemNumberList.size(); i++) {
    orderItemQuantityTotal=orderItemQuantityTotal + orderItemNumberList.get(i).getQuantity();
  }
  OrderItems orderItemEntity=transformToOrderItemsEntityBean(orderItem);
  if (orderEntityForm.getOrderStatus().equals("String_Node_Str") || orderEntityForm.getOrderStatus().equals("String_Node_Str")) {
    orderEntityForm.setOrderStatus("String_Node_Str");
  }
 else {
    orderEntityForm.setOrderStatus(orderEntityForm.getOrderStatus());
  }
  orderService.updateOrder(orderEntityForm);
  Integer orderItemEntityQuantity=orderItem.getQuantity();
  Integer orderItemQuantityGrandTotal=orderItemQuantityTotal + orderItemEntityQuantity;
  if (orderLimit.equals("String_Node_Str") || orderLimit.equals("String_Node_Str")) {
    if (orderItemQuantityGrandTotal > 5) {
      String messageFlag="String_Node_Str";
      sessionAttributes.put("String_Node_Str",messageFlag);
    }
 else {
      if (orderItem.getQuantity() == 1) {
        orderItemEntity.setQuantity(1);
        orderItemEntity.setNameSize(orderItem.getNameSize());
        orderService.addItem(orderItemEntity);
      }
 else {
        Integer saveLoop=orderItem.getQuantity();
        for (int i=0; i < saveLoop; i++) {
          orderItemEntity.setQuantity(1);
          orderItemEntity.setNameSize(orderItem.getNameSize());
          orderService.addItem(orderItemEntity);
        }
      }
      String messageFlag="String_Node_Str";
      sessionAttributes.put("String_Node_Str",messageFlag);
    }
  }
 else {
    if (orderItemQuantityGrandTotal > 250) {
      String messageFlag="String_Node_Str";
      sessionAttributes.put("String_Node_Str",messageFlag);
    }
 else {
      orderItemEntity.setQuantity(orderItem.getQuantity());
      Items itemEntity=customerService.findItemByCode(item.getItemCode());
      Double dblVolume=(orderItem.getQuantity() * (itemEntity.getLength() * itemEntity.getWidth() * itemEntity.getHeight()));
      String strVolume=dblVolume.toString();
      orderItemEntity.setVolume(Float.parseFloat(strVolume));
      orderItemEntity.setNameSize(item.getItemCode());
      orderService.addItem(orderItemEntity);
      String messageFlag="String_Node_Str";
      sessionAttributes.put("String_Node_Str",messageFlag);
    }
  }
  sessionAttributes.put("String_Node_Str",customerItems);
  Integer idOrder=orderItemEntity.getOrderId();
  sessionAttributes.put("String_Node_Str",idOrder);
  return SUCCESS;
}

Fixed version (ground truth):
public String addItemsInTable(){
  if (hasFieldErrors()) {
    return INPUT;
  }
  Map sessionAttributes=ActionContext.getContext().getSession();
  Orders orderEntityForm=orderService.findOrdersById((Integer)sessionAttributes.get("String_Node_Str"));
  order=transformToOrderFormBean(orderEntityForm);
  Integer contactIdParam=orderEntityForm.getShipperContactId();
  Contacts contactEntity=customerService.findContactById(contactIdParam);
  Customer customerEntity=customerService.findCustomerById(contactEntity.getReferenceId());
  customerItems=customerService.findItemByCustomerId(customerEntity.getCustomerId());
  List<OrderItems> orderItemEntityList=orderService.findAllItemByOrderId((Integer)sessionAttributes.get("String_Node_Str"));
  for (  OrderItems orderItemElem : orderItemEntityList) {
    orderItems.add(transformToOrderItemsFormBean(orderItemElem));
  }
  sessionAttributes.put("String_Node_Str",customerItems);
  String orderLimit=orderEntityForm.getServiceRequirement();
  List<OrderItems> orderItemNumberList=orderService.findAllItemByOrderId((Integer)sessionAttributes.get("String_Node_Str"));
  Integer checkItems=0;
  for (  OrderItems orderItemsElem : orderItemNumberList) {
    List<OrderStatusLogs> statusLogsEntity=orderStatusLogsService.findAllShipmentLogs(orderItemsElem.getOrderItemId());
    for (    OrderStatusLogs statusLogsElem : statusLogsEntity) {
      if (statusLogsElem.getStatus().equals("String_Node_Str") || statusLogsElem.getStatus().equals("String_Node_Str")) {
        checkItems=checkItems + 1;
      }
    }
  }
  if (checkItems >= 1) {
    clearErrorsAndMessages();
    addActionError("String_Node_Str");
    return "String_Node_Str";
  }
  if (orderEntityForm.getServiceRequirement().equals("String_Node_Str") || orderEntityForm.getServiceRequirement().equals("String_Node_Str") || orderEntityForm.getServiceRequirement().equals("String_Node_Str")|| orderEntityForm.getServiceRequirement().equals("String_Node_Str")) {
    List<Items> allItemsList=customerService.findAllItemsInTable();
    Integer itemCheck=0;
    for (    Items itemsElem : allItemsList) {
      if (itemsElem.getItemCode().equals(item.getItemCode())) {
        itemCheck=itemCheck + 1;
      }
    }
    if (itemCheck == 0) {
      Items itemEntity=transformToEntityBeanItem(item);
      itemEntity.setModifiedBy(commonUtils.getUserNameFromSession());
      itemEntity.setCreatedBy(commonUtils.getUserNameFromSession());
      itemEntity.setCreatedTimeStamp(new Date());
      customerService.addItem(itemEntity);
    }
  }
  Integer orderItemQuantityTotal=0;
  for (int i=0; i < orderItemNumberList.size(); i++) {
    orderItemQuantityTotal=orderItemQuantityTotal + orderItemNumberList.get(i).getQuantity();
  }
  OrderItems orderItemEntity=transformToOrderItemsEntityBean(orderItem);
  if (orderEntityForm.getOrderStatus().equals("String_Node_Str") || orderEntityForm.getOrderStatus().equals("String_Node_Str")) {
    orderEntityForm.setOrderStatus("String_Node_Str");
  }
 else {
    orderEntityForm.setOrderStatus(orderEntityForm.getOrderStatus());
  }
  orderService.updateOrder(orderEntityForm);
  Integer orderItemEntityQuantity=orderItem.getQuantity();
  Integer orderItemQuantityGrandTotal=orderItemQuantityTotal + orderItemEntityQuantity;
  if (orderLimit.equals("String_Node_Str") || orderLimit.equals("String_Node_Str")) {
    if (orderItemQuantityGrandTotal > 5) {
      String messageFlag="String_Node_Str";
      sessionAttributes.put("String_Node_Str",messageFlag);
    }
 else {
      if (orderItem.getQuantity() == 1) {
        orderItemEntity.setQuantity(1);
        orderItemEntity.setNameSize(orderItem.getNameSize());
        orderService.addItem(orderItemEntity);
      }
 else {
        Integer saveLoop=orderItem.getQuantity();
        for (int i=0; i < saveLoop; i++) {
          orderItemEntity.setQuantity(1);
          orderItemEntity.setNameSize(orderItem.getNameSize());
          orderService.addItem(orderItemEntity);
        }
      }
      String messageFlag="String_Node_Str";
      sessionAttributes.put("String_Node_Str",messageFlag);
    }
  }
 else {
    if (orderItemQuantityGrandTotal > 250) {
      String messageFlag="String_Node_Str";
      sessionAttributes.put("String_Node_Str",messageFlag);
    }
 else {
      orderItemEntity.setQuantity(orderItem.getQuantity());
      Items itemEntity=customerService.findItemByCode(item.getItemCode());
      Double dblVolume=(orderItem.getQuantity() * (itemEntity.getLength() * itemEntity.getWidth() * itemEntity.getHeight()));
      String strVolume=dblVolume.toString();
      orderItemEntity.setVolume(Float.parseFloat(strVolume));
      orderItemEntity.setNameSize(item.getItemCode());
      orderService.addItem(orderItemEntity);
      String messageFlag="String_Node_Str";
      sessionAttributes.put("String_Node_Str",messageFlag);
    }
  }
  sessionAttributes.put("String_Node_Str",customerItems);
  Integer idOrder=orderItemEntity.getOrderId();
  sessionAttributes.put("String_Node_Str",idOrder);
  return SUCCESS;
}