Program: 5948
Project: 5948
Buggy source:
/** 
 * This is the action called from the Struts framework.
 * @param mapping The ActionMapping used to select this instance.
 * @param form The optional ActionForm bean for this request.
 * @param request The HTTP Request we are processing.
 * @param response The HTTP Response we are processing.
 * @throws java.lang.Exception
 * @return
 */
public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws Exception {
  FloorForm floorForm=(FloorForm)form;
  RestaurantManager manager=new RestaurantManager();
  String floorId=(String)floorForm.getFloorId();
  String place=(String)floorForm.getId();
  String str=(String)floorForm.getMode();
  String[] array=null;
  int mode=0;
  if (!str.equals("String_Node_Str")) {
    mode=Integer.valueOf(str);
  }
  List<TicketLineInfo> linesList=new ArrayList<TicketLineInfo>();
  List products=new ArrayList<ProductInfoExt>();
  TicketInfo ticket;
switch (mode) {
case 1:
    ticket=manager.findTicket(place);
  linesList=ticket.getM_aLines();
array=floorForm.getParameters();
if (array != null) {
for (int i=0; i < array.length; i++) {
  if (linesList.get(Integer.valueOf(array[i]) - 0).getMultiply() > 0) {
    linesList.get(Integer.valueOf(array[i]) - 0).setMultiply(linesList.get(Integer.valueOf(array[i]) - 0).getMultiply() - 1);
  }
}
}
manager.updateLineFromTicket(place,ticket);
for (Object line : linesList) {
TicketLineInfo li=(TicketLineInfo)line;
products.add(manager.findProductById(li.getProductid()));
}
request.setAttribute("String_Node_Str",products.get(0));
request.setAttribute("String_Node_Str",place);
request.setAttribute("String_Node_Str",manager.findPlaceNameById(place));
request.setAttribute("String_Node_Str",linesList.get(Integer.valueOf(array[0])));
request.setAttribute("String_Node_Str",array[0]);
request.setAttribute("String_Node_Str",manager.getTotalOfaTicket(place));
return mapping.findForward(UPDATE);
case 4:
ticket=manager.findTicket(place);
linesList=ticket.getM_aLines();
array=floorForm.getParameters();
if (array != null) {
linesList.remove(Integer.parseInt(array[0]));
}
manager.updateLineFromTicket(place,ticket);
for (Object line : linesList) {
TicketLineInfo li=(TicketLineInfo)line;
products.add(manager.findProductById(li.getProductid()));
}
request.setAttribute("String_Node_Str",manager.findFloorById(manager.findPlaceById(place).getFloor()).getName());
request.setAttribute("String_Node_Str",place);
request.setAttribute("String_Node_Str",manager.findPlaceNameById(place));
request.setAttribute("String_Node_Str",floorId);
request.setAttribute("String_Node_Str",linesList);
request.setAttribute("String_Node_Str",products);
request.setAttribute("String_Node_Str",manager.getTotalOfaTicket(place));
return mapping.findForward(SUCCESS);
case 2:
ticket=manager.findTicket(place);
linesList=ticket.getM_aLines();
String[] index=floorForm.getParameters();
linesList.get(Integer.valueOf(index[0])).setMultiply(Double.valueOf(index[1]));
manager.updateLineFromTicket(floorForm.getId(),ticket);
for (Object line : linesList) {
TicketLineInfo li=(TicketLineInfo)line;
products.add(manager.findProductById(li.getProductid()));
}
break;
case 3:
ticket=manager.findTicket(place);
linesList=ticket.getM_aLines();
array=floorForm.getParameters();
if (array != null) {
for (int i=0; i < array.length; i++) {
linesList.get(Integer.valueOf(array[i]) - 0).setMultiply(linesList.get(Integer.valueOf(array[i]) - 0).getMultiply() + 1);
}
}
manager.updateLineFromTicket(place,ticket);
for (Object line : linesList) {
TicketLineInfo li=(TicketLineInfo)line;
products.add(manager.findProductById(li.getProductid()));
}
request.setAttribute("String_Node_Str",products.get(0));
request.setAttribute("String_Node_Str",place);
request.setAttribute("String_Node_Str",manager.findPlaceNameById(place));
request.setAttribute("String_Node_Str",linesList.get(Integer.valueOf(array[0])));
request.setAttribute("String_Node_Str",array[0]);
request.setAttribute("String_Node_Str",manager.getTotalOfaTicket(place));
return mapping.findForward(UPDATE);
default :
if (manager.findTicket(place) == null) {
manager.initTicket(place);
}
 else {
linesList=manager.findTicketLines(place);
}
for (Object line : linesList) {
TicketLineInfo li=(TicketLineInfo)line;
products.add(manager.findProductById(li.getProductid()));
}
break;
}
request.setAttribute("String_Node_Str",manager.findFloorById(manager.findPlaceById(place).getFloor()).getName());
request.setAttribute("String_Node_Str",place);
request.setAttribute("String_Node_Str",manager.findPlaceNameById(place));
request.setAttribute("String_Node_Str",floorId);
request.setAttribute("String_Node_Str",linesList);
request.setAttribute("String_Node_Str",products);
request.setAttribute("String_Node_Str",manager.getTotalOfaTicket(place));
return mapping.findForward(SUCCESS);
}

Fixed version (ground truth):
/** 
 * This is the action called from the Struts framework.
 * @param mapping The ActionMapping used to select this instance.
 * @param form The optional ActionForm bean for this request.
 * @param request The HTTP Request we are processing.
 * @param response The HTTP Response we are processing.
 * @throws java.lang.Exception
 * @return
 */
public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws Exception {
  FloorForm floorForm=(FloorForm)form;
  RestaurantManager manager=new RestaurantManager();
  String floorId=(String)floorForm.getFloorId();
  String place=(String)floorForm.getId();
  String str=(String)floorForm.getMode();
  String[] array=null;
  int mode=0;
  if (!str.equals("String_Node_Str")) {
    mode=Integer.valueOf(str);
  }
  List<TicketLineInfo> linesList=new ArrayList<TicketLineInfo>();
  List products=new ArrayList<ProductInfoExt>();
  TicketInfo ticket;
switch (mode) {
case 1:
    ticket=manager.findTicket(place);
  linesList=ticket.getM_aLines();
array=floorForm.getParameters();
if (array != null) {
for (int i=0; i < array.length; i++) {
  if (linesList.get(Integer.valueOf(array[i])).getMultiply() > 0) {
    linesList.get(Integer.valueOf(array[i])).setMultiply(linesList.get(Integer.valueOf(array[i])).getMultiply() - 1);
  }
}
}
manager.updateLineFromTicket(place,ticket);
for (Object line : linesList) {
TicketLineInfo li=(TicketLineInfo)line;
products.add(manager.findProductById(li.getProductid()));
}
request.setAttribute("String_Node_Str",products.get(0));
request.setAttribute("String_Node_Str",place);
request.setAttribute("String_Node_Str",manager.findPlaceNameById(place));
request.setAttribute("String_Node_Str",linesList.get(Integer.valueOf(array[0])));
request.setAttribute("String_Node_Str",array[0]);
request.setAttribute("String_Node_Str",manager.getTotalOfaTicket(place));
return mapping.findForward(UPDATE);
case 4:
ticket=manager.findTicket(place);
linesList=ticket.getM_aLines();
array=floorForm.getParameters();
if (array != null) {
linesList.remove(Integer.parseInt(array[0]));
}
manager.updateLineFromTicket(place,ticket);
for (Object line : linesList) {
TicketLineInfo li=(TicketLineInfo)line;
products.add(manager.findProductById(li.getProductid()));
}
request.setAttribute("String_Node_Str",manager.findFloorById(manager.findPlaceById(place).getFloor()).getName());
request.setAttribute("String_Node_Str",place);
request.setAttribute("String_Node_Str",manager.findPlaceNameById(place));
request.setAttribute("String_Node_Str",floorId);
request.setAttribute("String_Node_Str",linesList);
request.setAttribute("String_Node_Str",products);
request.setAttribute("String_Node_Str",manager.getTotalOfaTicket(place));
return mapping.findForward(SUCCESS);
case 2:
ticket=manager.findTicket(place);
linesList=ticket.getM_aLines();
String[] index=floorForm.getParameters();
linesList.get(Integer.valueOf(index[0])).setMultiply(Double.valueOf(index[1]));
manager.updateLineFromTicket(floorForm.getId(),ticket);
for (Object line : linesList) {
TicketLineInfo li=(TicketLineInfo)line;
products.add(manager.findProductById(li.getProductid()));
}
break;
case 3:
ticket=manager.findTicket(place);
linesList=ticket.getM_aLines();
array=floorForm.getParameters();
if (array != null) {
for (int i=0; i < array.length; i++) {
linesList.get(Integer.valueOf(array[i])).setMultiply(linesList.get(Integer.valueOf(array[i])).getMultiply() + 1);
}
}
manager.updateLineFromTicket(place,ticket);
for (Object line : linesList) {
TicketLineInfo li=(TicketLineInfo)line;
products.add(manager.findProductById(li.getProductid()));
}
request.setAttribute("String_Node_Str",products.get(0));
request.setAttribute("String_Node_Str",place);
request.setAttribute("String_Node_Str",manager.findPlaceNameById(place));
request.setAttribute("String_Node_Str",linesList.get(Integer.valueOf(array[0])));
request.setAttribute("String_Node_Str",array[0]);
request.setAttribute("String_Node_Str",manager.getTotalOfaTicket(place));
return mapping.findForward(UPDATE);
default :
if (manager.findTicket(place) == null) {
manager.initTicket(place);
}
 else {
linesList=manager.findTicketLines(place);
}
for (Object line : linesList) {
TicketLineInfo li=(TicketLineInfo)line;
products.add(manager.findProductById(li.getProductid()));
}
break;
}
request.setAttribute("String_Node_Str",manager.findFloorById(manager.findPlaceById(place).getFloor()).getName());
request.setAttribute("String_Node_Str",place);
request.setAttribute("String_Node_Str",manager.findPlaceNameById(place));
request.setAttribute("String_Node_Str",floorId);
request.setAttribute("String_Node_Str",linesList);
request.setAttribute("String_Node_Str",products);
request.setAttribute("String_Node_Str",manager.getTotalOfaTicket(place));
return mapping.findForward(SUCCESS);
}