Program: 143504
Project: 143504
Buggy source:
/** 
 * @param component
 */
@SuppressWarnings("String_Node_Str") public static boolean setSelectedIndex(Component component,AjaxRequestTarget target,int modifiers,boolean bHandleMultiselect){
  WebForm parentForm=component.findParent(WebForm.class);
  if (parentForm != null) {
    int parentFormViewType=parentForm.getController().getForm().getView();
    if (parentFormViewType == FormController.TABLE_VIEW || parentFormViewType == FormController.LOCKED_TABLE_VIEW || parentFormViewType == IForm.LIST_VIEW || parentFormViewType == FormController.LOCKED_LIST_VIEW) {
      WebCellBasedView tableView=component.findParent(WebCellBasedView.class);
      if (tableView == null) {
        return true;
      }
 else       tableView.setSelectionMadeByCellAction();
      if (parentFormViewType == IForm.LIST_VIEW || parentFormViewType == FormController.LOCKED_LIST_VIEW) {
        WebCellBasedViewListViewItem listViewItem=component.findParent(WebCellBasedView.WebCellBasedViewListViewItem.class);
        if (listViewItem != null)         listViewItem.markSelected(target);
      }
    }
  }
  Component recordItemModelComponent=component;
  IModel<?> someModel=recordItemModelComponent.getDefaultModel();
  while (!(someModel instanceof RecordItemModel)) {
    recordItemModelComponent=recordItemModelComponent.getParent();
    if (recordItemModelComponent == null)     break;
    someModel=recordItemModelComponent.getDefaultModel();
  }
  if (someModel instanceof RecordItemModel) {
    ((RecordItemModel)someModel).updateRenderedValue(component);
    IRecordInternal rec=(IRecordInternal)someModel.getObject();
    if (rec != null) {
      int index;
      IFoundSetInternal fs=rec.getParentFoundSet();
      if (someModel instanceof FoundsetRecordItemModel) {
        index=((FoundsetRecordItemModel)someModel).getRowIndex();
      }
 else {
        index=fs.getRecordIndex(rec);
      }
      if (fs instanceof FoundSet && ((FoundSet)fs).isMultiSelect()) {
        ClientProperties clp=((WebClientInfo)Session.get().getClientInfo()).getProperties();
        String navPlatform=clp.getNavigatorPlatform();
        int controlMask=(navPlatform != null && navPlatform.toLowerCase().indexOf("String_Node_Str") != -1) ? Event.META_MASK : Event.CTRL_MASK;
        boolean toggle=(modifiers != MODIFIERS_UNSPECIFIED) && ((modifiers & controlMask) != 0);
        boolean extend=(modifiers != MODIFIERS_UNSPECIFIED) && ((modifiers & Event.SHIFT_MASK) != 0);
        boolean isRightClick=(modifiers != MODIFIERS_UNSPECIFIED) && ((modifiers & Event.ALT_MASK) != 0);
        if (!isRightClick) {
          if (toggle || extend) {
            if (bHandleMultiselect) {
              if (toggle) {
                int[] selectedIndexes=((FoundSet)fs).getSelectedIndexes();
                ArrayList<Integer> selectedIndexesA=new ArrayList<Integer>();
                Integer selectedIndex=new Integer(index);
                for (                int selected : selectedIndexes)                 selectedIndexesA.add(new Integer(selected));
                if (selectedIndexesA.indexOf(selectedIndex) != -1) {
                  if (selectedIndexesA.size() > 1)                   selectedIndexesA.remove(selectedIndex);
                }
 else                 selectedIndexesA.add(selectedIndex);
                selectedIndexes=new int[selectedIndexesA.size()];
                for (int i=0; i < selectedIndexesA.size(); i++)                 selectedIndexes[i]=selectedIndexesA.get(i).intValue();
                ((FoundSet)fs).setSelectedIndexes(selectedIndexes);
              }
 else               if (extend) {
                int anchor=((FoundSet)fs).getSelectedIndex();
                int min=Math.min(anchor,index);
                int max=Math.max(anchor,index);
                int[] newSelectedIndexes=new int[max - min + 1];
                for (int i=min; i <= max; i++)                 newSelectedIndexes[i - min]=i;
                ((FoundSet)fs).setSelectedIndexes(newSelectedIndexes);
              }
            }
          }
 else           if (index != -1 || fs.getSize() == 0) {
            fs.setSelectedIndex(index);
          }
        }
      }
 else       if (!isIndexSelected(fs,index))       fs.setSelectedIndex(index);
      if (!isIndexSelected(fs,index) && !(fs instanceof FoundSet && ((FoundSet)fs).isMultiSelect())) {
        if (target != null)         target.appendJavascript("String_Node_Str" + component.getMarkupId() + "String_Node_Str");
        return false;
      }
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * @param component
 */
@SuppressWarnings("String_Node_Str") public static boolean setSelectedIndex(Component component,AjaxRequestTarget target,int modifiers,boolean bHandleMultiselect){
  WebForm parentForm=component.findParent(WebForm.class);
  WebCellBasedView tableView=null;
  if (parentForm != null) {
    int parentFormViewType=parentForm.getController().getForm().getView();
    if (parentFormViewType == FormController.TABLE_VIEW || parentFormViewType == FormController.LOCKED_TABLE_VIEW || parentFormViewType == IForm.LIST_VIEW || parentFormViewType == FormController.LOCKED_LIST_VIEW) {
      tableView=component.findParent(WebCellBasedView.class);
      if (tableView == null) {
        return true;
      }
 else       tableView.setSelectionMadeByCellAction();
      if (parentFormViewType == IForm.LIST_VIEW || parentFormViewType == FormController.LOCKED_LIST_VIEW) {
        WebCellBasedViewListViewItem listViewItem=component.findParent(WebCellBasedView.WebCellBasedViewListViewItem.class);
        if (listViewItem != null)         listViewItem.markSelected(target);
      }
    }
  }
  Component recordItemModelComponent=component;
  IModel<?> someModel=recordItemModelComponent.getDefaultModel();
  while (!(someModel instanceof RecordItemModel)) {
    recordItemModelComponent=recordItemModelComponent.getParent();
    if (recordItemModelComponent == null)     break;
    someModel=recordItemModelComponent.getDefaultModel();
  }
  if (someModel instanceof RecordItemModel) {
    ((RecordItemModel)someModel).updateRenderedValue(component);
    IRecordInternal rec=(IRecordInternal)someModel.getObject();
    if (rec != null) {
      int index;
      IFoundSetInternal fs=rec.getParentFoundSet();
      if (someModel instanceof FoundsetRecordItemModel) {
        index=((FoundsetRecordItemModel)someModel).getRowIndex();
      }
 else {
        index=fs.getRecordIndex(rec);
      }
      if (fs instanceof FoundSet && ((FoundSet)fs).isMultiSelect()) {
        ClientProperties clp=((WebClientInfo)Session.get().getClientInfo()).getProperties();
        String navPlatform=clp.getNavigatorPlatform();
        int controlMask=(navPlatform != null && navPlatform.toLowerCase().indexOf("String_Node_Str") != -1) ? Event.META_MASK : Event.CTRL_MASK;
        boolean toggle=(modifiers != MODIFIERS_UNSPECIFIED) && ((modifiers & controlMask) != 0);
        boolean extend=(modifiers != MODIFIERS_UNSPECIFIED) && ((modifiers & Event.SHIFT_MASK) != 0);
        boolean isRightClick=(modifiers != MODIFIERS_UNSPECIFIED) && ((modifiers & Event.ALT_MASK) != 0);
        if (!isRightClick) {
          if (!toggle && !extend && tableView != null && tableView.getDragNDropController() != null && Arrays.binarySearch(((FoundSet)fs).getSelectedIndexes(),index) > -1) {
            return true;
          }
          if (toggle || extend) {
            if (bHandleMultiselect) {
              if (toggle) {
                int[] selectedIndexes=((FoundSet)fs).getSelectedIndexes();
                ArrayList<Integer> selectedIndexesA=new ArrayList<Integer>();
                Integer selectedIndex=new Integer(index);
                for (                int selected : selectedIndexes)                 selectedIndexesA.add(new Integer(selected));
                if (selectedIndexesA.indexOf(selectedIndex) != -1) {
                  if (selectedIndexesA.size() > 1)                   selectedIndexesA.remove(selectedIndex);
                }
 else                 selectedIndexesA.add(selectedIndex);
                selectedIndexes=new int[selectedIndexesA.size()];
                for (int i=0; i < selectedIndexesA.size(); i++)                 selectedIndexes[i]=selectedIndexesA.get(i).intValue();
                ((FoundSet)fs).setSelectedIndexes(selectedIndexes);
              }
 else               if (extend) {
                int anchor=((FoundSet)fs).getSelectedIndex();
                int min=Math.min(anchor,index);
                int max=Math.max(anchor,index);
                int[] newSelectedIndexes=new int[max - min + 1];
                for (int i=min; i <= max; i++)                 newSelectedIndexes[i - min]=i;
                ((FoundSet)fs).setSelectedIndexes(newSelectedIndexes);
              }
            }
          }
 else           if (index != -1 || fs.getSize() == 0) {
            fs.setSelectedIndex(index);
          }
        }
      }
 else       if (!isIndexSelected(fs,index))       fs.setSelectedIndex(index);
      if (!isIndexSelected(fs,index) && !(fs instanceof FoundSet && ((FoundSet)fs).isMultiSelect())) {
        if (target != null)         target.appendJavascript("String_Node_Str" + component.getMarkupId() + "String_Node_Str");
        return false;
      }
    }
  }
  return true;
}