Program: 137876
Project: 137876
Buggy source:
/** 
 * recursively check if a entire row/column is selected/
 * @param grid
 * @param parentItem
 * @param currentItem
 */
void processNodeSelection(GridItem parentItem,GridItem currentItem){
  if (currentItem.hasChildren()) {
    Boolean allCheckedInColumn[]=new Boolean[getColumnCount()];
    Boolean hasCheckedInColumn[]=new Boolean[getColumnCount()];
    for (int j=1; j < getColumnCount(); j++) {
      allCheckedInColumn[j]=true;
      hasCheckedInColumn[j]=false;
    }
    for (int i=0; i < currentItem.getItemCount(); i++) {
      GridItem childItem=currentItem.getItem(i);
      processNodeSelection(currentItem,childItem);
      boolean allCheckedInRow=true;
      boolean hasCheckedInRow=false;
      boolean expanded=false;
      for (int j=2; j < getColumnCount(); j++) {
        if (childItem.getChecked(j)) {
          hasCheckedInRow=true;
          hasCheckedInColumn[j]=true;
          expanded=true;
          if (childItem.getGrayed(j)) {
            allCheckedInRow=false;
            allCheckedInColumn[j]=false;
          }
        }
 else {
          if (childItem.getCheckable(j)) {
            allCheckedInRow=false;
            allCheckedInColumn[j]=false;
          }
        }
      }
      childItem.setChecked(1,hasCheckedInRow);
      childItem.setGrayed(1,hasCheckedInRow && !allCheckedInRow);
      if (expanded) {
        currentItem.setExpanded(true);
        if (parentItem != null) {
          parentItem.setExpanded(true);
        }
      }
    }
    boolean entireCategoryChecked=true;
    for (int j=2; j < getColumnCount(); j++) {
      if (currentItem.getCheckable(j)) {
        if (hasCheckedInColumn[j]) {
          hasCheckedInColumn[1]=true;
          currentItem.setChecked(j,true);
        }
 else {
          currentItem.setChecked(j,false);
        }
        if (allCheckedInColumn[j]) {
          currentItem.setGrayed(j,false);
        }
 else {
          currentItem.setGrayed(j,true);
          entireCategoryChecked=false;
        }
      }
    }
    if (currentItem.getCheckable(1)) {
      currentItem.setChecked(1,hasCheckedInColumn[1]);
      currentItem.setGrayed(1,!entireCategoryChecked);
    }
  }
}

Fixed version (ground truth):
/** 
 * recursively check if a entire row/column is selected/
 * @param grid
 * @param parentItem
 * @param currentItem
 */
void processNodeSelection(GridItem parentItem,GridItem currentItem){
  if (currentItem.hasChildren()) {
    Boolean allCheckedInColumn[]=new Boolean[getColumnCount()];
    Boolean hasCheckedInColumn[]=new Boolean[getColumnCount()];
    for (int j=1; j < getColumnCount(); j++) {
      allCheckedInColumn[j]=true;
      hasCheckedInColumn[j]=false;
    }
    for (int i=0; i < currentItem.getItemCount(); i++) {
      GridItem childItem=currentItem.getItem(i);
      processNodeSelection(currentItem,childItem);
      boolean allCheckedInRow=true;
      boolean hasCheckedInRow=false;
      boolean expanded=false;
      for (int j=2; j < getColumnCount(); j++) {
        if (childItem.getChecked(j)) {
          hasCheckedInRow=true;
          hasCheckedInColumn[j]=true;
          expanded=true;
          if (childItem.getGrayed(j)) {
            allCheckedInRow=false;
            allCheckedInColumn[j]=false;
          }
        }
 else {
          if (childItem.getCheckable(j)) {
            allCheckedInRow=false;
            allCheckedInColumn[j]=false;
          }
        }
      }
      childItem.setChecked(1,hasCheckedInRow);
      childItem.setGrayed(1,hasCheckedInRow && !allCheckedInRow);
      if (expanded) {
        currentItem.setExpanded(true);
        if (parentItem != null) {
          parentItem.setExpanded(true);
        }
      }
    }
    boolean entireCategoryChecked=true;
    for (int j=1; j < getColumnCount(); j++) {
      if (currentItem.getCheckable(j)) {
        if (hasCheckedInColumn[j]) {
          hasCheckedInColumn[1]=true;
          currentItem.setChecked(j,true);
        }
 else {
          currentItem.setChecked(j,false);
        }
        if (!allCheckedInColumn[j]) {
          currentItem.setGrayed(j,hasCheckedInColumn[j]);
          entireCategoryChecked=false;
        }
 else {
          currentItem.setGrayed(j,false);
        }
      }
    }
    if (currentItem.getCheckable(1)) {
      currentItem.setChecked(1,hasCheckedInColumn[1]);
      currentItem.setGrayed(1,hasCheckedInColumn[1] && !entireCategoryChecked);
    }
  }
}