Program: 78291
Project: 78291
Buggy source:
/** 
 * Inserts dataset column into the target. Add label or group key if possible
 * @param model column item
 * @param target insert target like cell or ListBandProxy
 * @param targetParent target container like table or list
 * @return to be inserted data item
 * @throws SemanticException
 */
protected static DataItemHandle performInsertDataSetColumn(ResultSetColumnHandle model,Object target,Object targetParent) throws SemanticException {
  DataItemHandle dataHandle=DesignElementFactory.getInstance().newDataItem(null);
  DataSetHandle dataSet=(DataSetHandle)model.getElementHandle();
  dataHandle.setResultSetColumn(model.getColumnName());
  if (targetParent instanceof ReportItemHandle) {
    ReportItemHandle container=(ReportItemHandle)targetParent;
    if (!DEUtil.getDataSetList(container).contains(dataSet)) {
      if (container.getDataSet() == null) {
        container.setDataSet(dataSet);
      }
    }
    GroupHandle groupHandle=getGroupHandle(target);
    if (groupHandle != null) {
      ComputedColumn bindingColumn=StructureFactory.createComputedColumn();
      bindingColumn.setDataType(model.getDataType());
      bindingColumn.setExpression(DEUtil.getExpression(model));
      bindingColumn.setName(model.getColumnName());
      groupHandle.addColumnBinding(bindingColumn,false);
    }
 else {
      ComputedColumn bindingColumn=StructureFactory.createComputedColumn();
      bindingColumn.setDataType(model.getDataType());
      bindingColumn.setExpression(DEUtil.getExpression(model));
      bindingColumn.setName(model.getColumnName());
      container.addColumnBinding(bindingColumn,false);
    }
  }
 else {
    ComputedColumn bindingColumn=StructureFactory.createComputedColumn();
    bindingColumn.setDataType(model.getDataType());
    bindingColumn.setExpression(DEUtil.getExpression(model));
    bindingColumn.setName(model.getColumnName());
    dataHandle.addColumnBinding(bindingColumn,false);
    dataHandle.setDataSet(dataSet);
  }
  InsertInLayoutRule rule=new LabelAddRule(target);
  if (rule.canInsert()) {
    LabelHandle label=DesignElementFactory.getInstance().newLabel(null);
    label.setText(model.getColumnName());
    rule.insert(label);
  }
  rule=new GroupKeySetRule(target,model);
  if (rule.canInsert()) {
    rule.insert(model);
  }
  return dataHandle;
}

Fixed version (ground truth):
/** 
 * Inserts dataset column into the target. Add label or group key if possible
 * @param model column item
 * @param target insert target like cell or ListBandProxy
 * @param targetParent target container like table or list
 * @return to be inserted data item
 * @throws SemanticException
 */
protected static DataItemHandle performInsertDataSetColumn(ResultSetColumnHandle model,Object target,Object targetParent) throws SemanticException {
  DataItemHandle dataHandle=DesignElementFactory.getInstance().newDataItem(null);
  DataSetHandle dataSet=(DataSetHandle)model.getElementHandle();
  dataHandle.setResultSetColumn(model.getColumnName());
  if (targetParent instanceof ReportItemHandle) {
    ReportItemHandle container=(ReportItemHandle)targetParent;
    if (!DEUtil.getDataSetList(container).contains(dataSet)) {
      if (container.getDataSet() == null) {
        container.setDataSet(dataSet);
      }
    }
    GroupHandle groupHandle=getGroupHandle(target);
    if (groupHandle != null) {
      ComputedColumn bindingColumn=StructureFactory.newComputedColumn(groupHandle,model.getColumnName());
      bindingColumn.setDataType(model.getDataType());
      bindingColumn.setExpression(DEUtil.getExpression(model));
      groupHandle.addColumnBinding(bindingColumn,false);
    }
 else {
      ComputedColumn bindingColumn=StructureFactory.newComputedColumn(container,model.getColumnName());
      bindingColumn.setDataType(model.getDataType());
      bindingColumn.setExpression(DEUtil.getExpression(model));
      container.addColumnBinding(bindingColumn,false);
    }
  }
 else {
    ComputedColumn bindingColumn=StructureFactory.newComputedColumn(dataHandle,model.getColumnName());
    bindingColumn.setDataType(model.getDataType());
    bindingColumn.setExpression(DEUtil.getExpression(model));
    dataHandle.addColumnBinding(bindingColumn,false);
    dataHandle.setDataSet(dataSet);
  }
  InsertInLayoutRule rule=new LabelAddRule(target);
  if (rule.canInsert()) {
    LabelHandle label=DesignElementFactory.getInstance().newLabel(null);
    label.setText(model.getColumnName());
    rule.insert(label);
  }
  rule=new GroupKeySetRule(target,model);
  if (rule.canInsert()) {
    rule.insert(model);
  }
  return dataHandle;
}