Program: 78294
Project: 78294
Buggy source:
protected void openQuery(IContent content){
  Object generateBy=content.getGenerateBy();
  if (generateBy instanceof ReportItemDesign) {
    if (!(generateBy instanceof ExtendedItemDesign)) {
      ReportItemDesign design=(ReportItemDesign)generateBy;
      IBaseQueryDefinition query=design.getQuery();
      if (query != null) {
        IResultSet rset=dataEngine.execute(query);
        resultSets.push(rset);
      }
    }
  }
  InstanceID iid=content.getInstanceID();
  if (iid != null) {
    DataID dataId=iid.getDataID();
    while (dataId == null && iid.getParentID() != null) {
      iid=iid.getParentID();
      dataId=iid.getDataID();
    }
    if (dataId != null) {
      if (!resultSets.isEmpty()) {
        IResultSet rset=(IResultSet)resultSets.peek();
        if (rset != null) {
          long rowId=dataId.getRowID();
          if (rowId != -1 && rowId != rset.getCurrentPosition()) {
            rset.skipTo(rowId);
          }
        }
      }
    }
  }
  if (generateBy instanceof DataItemDesign && content instanceof DataContent) {
    DataItemDesign design=(DataItemDesign)generateBy;
    DataContent data=(DataContent)content;
    if (design.getMap() == null) {
      String valueExpr=design.getValue();
      if (valueExpr != null) {
        Object value=context.evaluate(valueExpr);
        data.setValue(value);
      }
    }
  }
}

Fixed version (ground truth):
protected void openQuery(IContent content){
  Object generateBy=content.getGenerateBy();
  if (generateBy instanceof ReportItemDesign) {
    if (!(generateBy instanceof ExtendedItemDesign)) {
      InstanceID iid=content.getInstanceID();
      if (iid != null) {
        DataID dataId=iid.getDataID();
        if (dataId != null) {
          DataSetID dataSetId=dataId.getDataSetID();
          if (dataSetId != null) {
            DataSetID parentSetId=dataSetId.getParentID();
            long parentRowId=dataSetId.getRowID();
            if (parentSetId != null && parentRowId != -1) {
              if (!resultSets.isEmpty()) {
                IResultSet rset=(IResultSet)resultSets.peek();
                if (rset != null) {
                  if (parentRowId != rset.getCurrentPosition()) {
                    rset.skipTo(parentRowId);
                  }
                }
              }
            }
          }
        }
      }
      ReportItemDesign design=(ReportItemDesign)generateBy;
      IBaseQueryDefinition query=design.getQuery();
      if (query != null) {
        IResultSet rset=dataEngine.execute(query);
        resultSets.push(rset);
      }
    }
  }
  InstanceID iid=content.getInstanceID();
  if (iid != null) {
    DataID dataId=iid.getDataID();
    while (dataId == null && iid.getParentID() != null) {
      iid=iid.getParentID();
      dataId=iid.getDataID();
    }
    if (dataId != null) {
      if (!resultSets.isEmpty()) {
        IResultSet rset=(IResultSet)resultSets.peek();
        if (rset != null) {
          long rowId=dataId.getRowID();
          if (rowId != -1 && rowId != rset.getCurrentPosition()) {
            rset.skipTo(rowId);
          }
        }
      }
    }
  }
  if (generateBy instanceof DataItemDesign && content instanceof DataContent) {
    DataItemDesign design=(DataItemDesign)generateBy;
    DataContent data=(DataContent)content;
    if (design.getMap() == null) {
      String valueExpr=design.getValue();
      if (valueExpr != null) {
        Object value=context.evaluate(valueExpr);
        data.setValue(value);
      }
    }
  }
}