Program: 64952
Project: 64952
Buggy source:
/** 
 * Check if the expressions of category and Y optional have same dimension.
 * @param checkType
 * @param data
 * @param queryDefinitionsMap
 * @param itemHandle
 * @param provider
 * @since 2.5.1
 */
@SuppressWarnings("String_Node_Str") public static boolean checkQueryExpression(String checkType,Object data,Map<String,Query[]> queryDefinitionsMap,ExtendedItemHandle itemHandle,ReportDataServiceProvider provider){
  if (data == null || "String_Node_Str".equals(data)) {
    return true;
  }
  ExpressionCodec exprCodec=ChartModelHelper.instance().createExpressionCodec();
  String categoryDimension=null;
  String yOptionDimension=null;
  String categoryBindName=null;
  String yOptionBindName=null;
  String expression=(String)data;
  Iterator<ComputedColumnHandle> columnBindings=null;
  if (ChartReportItemHelper.instance().getBindingCubeHandle(itemHandle) != null && provider.isInheritanceOnly() || provider.isSharedBinding()) {
    ReportItemHandle reportItemHandle=provider.getReportItemHandle();
    columnBindings=reportItemHandle.getColumnBindings().iterator();
  }
 else   if (ChartReportItemHelper.instance().getBindingCubeHandle(itemHandle) != null || (provider.isInXTabMeasureCell() && !provider.isPartChart())) {
    columnBindings=getAllColumnBindingsIterator(itemHandle);
  }
  if (ChartUIConstants.QUERY_OPTIONAL.equals(checkType)) {
    String categoryExpr=null;
    Query[] querys=queryDefinitionsMap.get(ChartUIConstants.QUERY_CATEGORY);
    if (querys != null && querys.length > 0) {
      categoryExpr=querys[0].getDefinition();
    }
    if (categoryExpr == null || "String_Node_Str".equals(categoryExpr)) {
      return true;
    }
    categoryBindName=exprCodec.getCubeBindingName(categoryExpr,true);
    yOptionBindName=exprCodec.getCubeBindingName(expression,true);
  }
 else   if (ChartUIConstants.QUERY_CATEGORY.equals(checkType)) {
    String yOptionExpr=null;
    Query[] querys=queryDefinitionsMap.get(ChartUIConstants.QUERY_OPTIONAL);
    if (querys != null && querys.length > 0) {
      yOptionExpr=querys[0].getDefinition();
    }
    if (yOptionExpr == null || "String_Node_Str".equals(yOptionExpr)) {
      return true;
    }
    categoryBindName=exprCodec.getCubeBindingName(expression,true);
    yOptionBindName=exprCodec.getCubeBindingName(yOptionExpr,true);
  }
  if (columnBindings == null) {
    return true;
  }
  while (columnBindings.hasNext()) {
    ComputedColumnHandle columnHandle=columnBindings.next();
    ChartItemUtil.loadExpression(exprCodec,columnHandle);
    String bindName=columnHandle.getName();
    if (!exprCodec.isDimensionExpresion()) {
      continue;
    }
    if (bindName.equals(categoryBindName)) {
      categoryDimension=exprCodec.getLevelNames()[0];
    }
    if (bindName.equals(yOptionBindName)) {
      yOptionDimension=exprCodec.getLevelNames()[0];
    }
  }
  if ((categoryDimension != null && yOptionDimension != null && categoryDimension.equals(yOptionDimension))) {
    return false;
  }
 else {
    return true;
  }
}

Fixed version (ground truth):
/** 
 * Check if the expressions of category and Y optional have same dimension.
 * @param checkType
 * @param data
 * @param queryDefinitionsMap
 * @param itemHandle
 * @param provider
 * @since 2.5.1
 */
@SuppressWarnings("String_Node_Str") public static boolean checkQueryExpression(String checkType,Object data,Map<String,Query[]> queryDefinitionsMap,ExtendedItemHandle itemHandle,ReportDataServiceProvider provider){
  if (data == null || "String_Node_Str".equals(data)) {
    return true;
  }
  ExpressionCodec exprCodec=ChartReportItemHelper.instance().createExpressionCodec(itemHandle);
  String categoryDimension=null;
  String yOptionDimension=null;
  String categoryBindName=null;
  String yOptionBindName=null;
  String expression=(String)data;
  Iterator<ComputedColumnHandle> columnBindings=null;
  if (ChartReportItemHelper.instance().getBindingCubeHandle(itemHandle) != null && provider.isInheritanceOnly() || provider.isSharedBinding()) {
    ReportItemHandle reportItemHandle=provider.getReportItemHandle();
    columnBindings=reportItemHandle.getColumnBindings().iterator();
  }
 else   if (ChartReportItemHelper.instance().getBindingCubeHandle(itemHandle) != null || (provider.isInXTabMeasureCell() && !provider.isPartChart())) {
    columnBindings=getAllColumnBindingsIterator(itemHandle);
  }
  if (ChartUIConstants.QUERY_OPTIONAL.equals(checkType)) {
    String categoryExpr=null;
    Query[] querys=queryDefinitionsMap.get(ChartUIConstants.QUERY_CATEGORY);
    if (querys != null && querys.length > 0) {
      categoryExpr=querys[0].getDefinition();
    }
    if (categoryExpr == null || "String_Node_Str".equals(categoryExpr)) {
      return true;
    }
    categoryBindName=exprCodec.getCubeBindingName(categoryExpr,true);
    yOptionBindName=exprCodec.getCubeBindingName(expression,true);
  }
 else   if (ChartUIConstants.QUERY_CATEGORY.equals(checkType)) {
    String yOptionExpr=null;
    Query[] querys=queryDefinitionsMap.get(ChartUIConstants.QUERY_OPTIONAL);
    if (querys != null && querys.length > 0) {
      yOptionExpr=querys[0].getDefinition();
    }
    if (yOptionExpr == null || "String_Node_Str".equals(yOptionExpr)) {
      return true;
    }
    categoryBindName=exprCodec.getCubeBindingName(expression,true);
    yOptionBindName=exprCodec.getCubeBindingName(yOptionExpr,true);
  }
  if (columnBindings == null) {
    return true;
  }
  while (columnBindings.hasNext()) {
    ComputedColumnHandle columnHandle=columnBindings.next();
    ChartReportItemHelper.instance().loadExpression(exprCodec,columnHandle);
    String bindName=columnHandle.getName();
    if (!exprCodec.isDimensionExpresion()) {
      continue;
    }
    if (bindName.equals(categoryBindName)) {
      categoryDimension=exprCodec.getLevelNames()[0];
    }
    if (bindName.equals(yOptionBindName)) {
      yOptionDimension=exprCodec.getLevelNames()[0];
    }
  }
  if ((categoryDimension != null && yOptionDimension != null && categoryDimension.equals(yOptionDimension))) {
    return false;
  }
 else {
    return true;
  }
}