Program: 78798
Project: 78798
Buggy source:
protected void okPressed(){
  try {
    inputGroup.setName(nameEditor.getText());
    int index=keyChooser.getSelectionIndex();
    String oldKey=inputGroup.getKeyExpr();
    String newKey=null;
    if (index == -1) {
      newKey=keyChooser.getText();
    }
 else {
      newKey=DEUtil.getExpression(columnList.get(index));
    }
    if (!newKey.equals(oldKey)) {
      inputGroup.setKeyExpr(newKey);
      SlotHandle slotHandle=null;
      if (inputGroup instanceof ListGroupHandle) {
        slotHandle=inputGroup.getHeader();
      }
 else       if (inputGroup instanceof TableGroupHandle) {
        if (inputGroup.getHeader().getCount() != 0) {
          RowHandle rowHandle=((RowHandle)inputGroup.getHeader().get(0));
          CellHandle cellHandle=(CellHandle)rowHandle.getCells().get(0);
          slotHandle=cellHandle.getContent();
        }
      }
      if (slotHandle != null) {
        Object insertObj=index == -1 ? newKey : columnList.get(index);
        DesignElementHandle dataItemHandle=InsertInLayoutUtil.performInsert(insertObj,slotHandle,inputGroup.getContainer());
        slotHandle.add(dataItemHandle);
      }
    }
    index=intervalType.getSelectionIndex();
    inputGroup.setInterval(intervalChoices[index].getName());
    if (index != 0) {
      inputGroup.setIntervalRange(intervalRange.getSelection());
    }
    if (inputGroup instanceof TableGroupHandle) {
      if (includeHeader.getSelection() != inputGroup.hasHeader()) {
        if (includeHeader.getSelection()) {
          inputGroup.getHeader().add(createRow());
        }
 else {
          inputGroup.clearContents(GroupHandle.HEADER_SLOT);
        }
      }
      if (includeFooter.getSelection() != inputGroup.hasFooter()) {
        if (includeFooter.getSelection()) {
          inputGroup.getFooter().add(createRow());
        }
 else {
          inputGroup.clearContents(GroupHandle.FOOTER_SLOT);
        }
      }
    }
    if (ascending.getSelection()) {
      inputGroup.setSortDirection(DesignChoiceConstants.SORT_DIRECTION_ASC);
    }
 else {
      inputGroup.setSortDirection(DesignChoiceConstants.SORT_DIRECTION_DESC);
    }
    inputGroup.setTocExpression(UIUtil.convertToModelString(tocEditor.getText(),true));
  }
 catch (  SemanticException e) {
    ExceptionHandler.handle(e);
    return;
  }
  setResult(inputGroup);
  super.okPressed();
}

Fixed version (ground truth):
protected void okPressed(){
  try {
    inputGroup.setName(nameEditor.getText());
    int index=keyChooser.getSelectionIndex();
    String oldKey=inputGroup.getKeyExpr();
    String newKey=null;
    if (index != -1) {
      newKey=DEUtil.getExpression(columnList.get(index));
    }
    inputGroup.setKeyExpr(newKey);
    if (newKey != null && !newKey.equals(oldKey)) {
      SlotHandle slotHandle=null;
      if (inputGroup instanceof ListGroupHandle) {
        slotHandle=inputGroup.getHeader();
      }
 else       if (inputGroup instanceof TableGroupHandle) {
        if (inputGroup.getHeader().getCount() != 0) {
          RowHandle rowHandle=((RowHandle)inputGroup.getHeader().get(0));
          CellHandle cellHandle=(CellHandle)rowHandle.getCells().get(0);
          slotHandle=cellHandle.getContent();
        }
      }
      if (slotHandle != null) {
        DesignElementHandle dataItemHandle=InsertInLayoutUtil.performInsert(columnList.get(index),slotHandle,inputGroup.getContainer());
        slotHandle.add(dataItemHandle);
      }
    }
    index=intervalType.getSelectionIndex();
    inputGroup.setInterval(intervalChoices[index].getName());
    if (index != 0) {
      inputGroup.setIntervalRange(intervalRange.getSelection());
    }
    if (inputGroup instanceof TableGroupHandle) {
      if (includeHeader.getSelection() != inputGroup.hasHeader()) {
        if (includeHeader.getSelection()) {
          inputGroup.getHeader().add(createRow());
        }
 else {
          inputGroup.clearContents(GroupHandle.HEADER_SLOT);
        }
      }
      if (includeFooter.getSelection() != inputGroup.hasFooter()) {
        if (includeFooter.getSelection()) {
          inputGroup.getFooter().add(createRow());
        }
 else {
          inputGroup.clearContents(GroupHandle.FOOTER_SLOT);
        }
      }
    }
    if (ascending.getSelection()) {
      inputGroup.setSortDirection(DesignChoiceConstants.SORT_DIRECTION_ASC);
    }
 else {
      inputGroup.setSortDirection(DesignChoiceConstants.SORT_DIRECTION_DESC);
    }
    inputGroup.setTocExpression(UIUtil.convertToModelString(tocEditor.getText(),true));
  }
 catch (  SemanticException e) {
    ExceptionHandler.handle(e);
    return;
  }
  setResult(inputGroup);
  super.okPressed();
}