Program: 126862
Project: 126862
Buggy source:
@Override public void handleEvent(Event event){
  TreeItem treeItem=(TreeItem)event.item;
  String itemText=treeItem.getText();
  boolean needUpdate=treeItem.getChecked();
  boolean firstExpand=false;
  if (mapCheckState.containsKey(itemText)) {
    firstExpand=mapCheckState.get(itemText);
  }
 else {
    firstExpand=true;
  }
  for (  TreeItem item : treeItem.getItems()) {
    if (item.getData() != null) {
      TableNode node=(TableNode)item.getData();
      if (useProvider()) {
        if (node.getType() == TableNode.COLUMN_FAMILY) {
          if (firstExpand && needUpdate && item.getData() != null) {
            updateLeafItem(item,true,TableNode.COLUMN);
          }
 else           if (isExistTable(node)) {
            item.setChecked(true);
          }
 else {
            item.setChecked(false);
          }
        }
 else         if (node.getType() == provider.getRunnableAccessNodeType()) {
          if (isExistTable(node)) {
            item.setChecked(true);
          }
 else {
            item.setChecked(false);
          }
        }
      }
 else       if (node.getType() == TableNode.TABLE) {
        if (firstExpand && needUpdate && item.getData() != null) {
          updateItem(item,true,true);
        }
 else         if (isExistTable(node)) {
          item.setChecked(true);
        }
 else {
          item.setChecked(false);
        }
      }
 else       if (firstExpand && needUpdate && node.getType() == TableNode.SCHEMA) {
        item.setChecked(true);
        mapCheckState.put(item.getText(),firstExpand);
      }
 else {
        item.setGrayed(item.getChecked());
      }
    }
  }
  if (firstExpand) {
    mapCheckState.put(itemText,false);
  }
}

Fixed version (ground truth):
@Override public void handleEvent(Event event){
  TreeItem treeItem=(TreeItem)event.item;
  String itemText=treeItem.getText();
  boolean needUpdate=treeItem.getChecked();
  TableNode parentNode=(TableNode)treeItem.getData();
  if (parentNode.getType() == TableNode.CATALOG || parentNode.getType() == TableNode.SCHEMA) {
    needUpdate=false;
  }
  boolean firstExpand=false;
  if (mapCheckState.containsKey(itemText)) {
    firstExpand=mapCheckState.get(itemText);
  }
 else {
    firstExpand=true;
  }
  for (  TreeItem item : treeItem.getItems()) {
    if (item.getData() != null) {
      TableNode node=(TableNode)item.getData();
      if (useProvider()) {
        if (node.getType() == TableNode.COLUMN_FAMILY) {
          if (firstExpand && needUpdate && item.getData() != null) {
            updateLeafItem(item,true,TableNode.COLUMN);
          }
 else           if (isExistTable(node)) {
            item.setChecked(true);
          }
 else {
            item.setChecked(false);
          }
        }
 else         if (node.getType() == provider.getRunnableAccessNodeType()) {
          if (isExistTable(node)) {
            item.setChecked(true);
          }
 else {
            item.setChecked(false);
          }
        }
      }
 else       if (node.getType() == TableNode.TABLE) {
        if (firstExpand && needUpdate && item.getData() != null) {
          updateItem(item,true,true);
        }
 else         if (isExistTable(node)) {
          item.setChecked(true);
        }
 else {
          item.setChecked(false);
        }
      }
 else       if (firstExpand && needUpdate && node.getType() == TableNode.SCHEMA) {
        item.setChecked(true);
        mapCheckState.put(item.getText(),firstExpand);
      }
 else {
        item.setGrayed(item.getChecked());
      }
    }
  }
  if (firstExpand) {
    mapCheckState.put(itemText,false);
  }
}