Program: 68919
Project: 68919
Buggy source:
private void addLookupForOrthogonalSeries(SeriesDefinition baseSD,EList<SeriesDefinition> lstOrthogonalSDs,IActionEvaluator iae) throws ChartException {
  for (int k=0; k < lstOrthogonalSDs.size(); k++) {
    SeriesDefinition orthoSD=lstOrthogonalSDs.get(k);
    Query qOrthogonalSeriesDefinition=orthoSD.getQuery();
    if (qOrthogonalSeriesDefinition == null) {
      return;
    }
    String strOrthoAgg=getOrthogonalAggregationExpression(orthoSD);
    addDataExp(qOrthogonalSeriesDefinition.getDefinition(),strOrthoAgg);
    String ySortKey=getSortKey(orthoSD);
    Series seOrthogonal=orthoSD.getDesignTimeSeries();
    EList<Query> elOrthogonalSeries=seOrthogonal.getDataDefinition();
    if (elOrthogonalSeries.isEmpty()) {
      throw new ChartException(ChartEnginePlugin.ID,ChartException.DATA_BINDING,"String_Node_Str",new Object[]{String.valueOf(k),seOrthogonal},Messages.getResourceBundle(this.locale));
    }
    boolean bAnyQueries=false;
    for (int i=0; i < elOrthogonalSeries.size(); i++) {
      Query qOrthogonalSeries=elOrthogonalSeries.get(i);
      if (qOrthogonalSeries == null) {
        continue;
      }
      if (addDataExp(valueSeriesExprBuilder.buildExpr(qOrthogonalSeries,orthoSD,baseSD),strOrthoAgg)) {
        bAnyQueries=true;
        if (fBaseSortExprIndex < 0) {
          String sortExpr=getSortKey(baseSD);
          if (sortExpr != null && sortExpr.equals(qOrthogonalSeries.getDefinition()) && baseSD.eIsSet(DataPackage.eINSTANCE.getSeriesDefinition_Sorting())) {
            fBaseSortExprIndex=findIndex(valueSeriesExprBuilder.buildExpr(qOrthogonalSeries,orthoSD,baseSD),strOrthoAgg);
          }
        }
        if (fYSortExprIndex < 0) {
          if (ySortKey != null && ySortKey.equals(qOrthogonalSeries.getDefinition()) && orthoSD.eIsSet(DataPackage.eINSTANCE.getSeriesDefinition_Sorting())) {
            fYSortExprIndex=findIndex(valueSeriesExprBuilder.buildExpr(qOrthogonalSeries,orthoSD,baseSD),strOrthoAgg);
          }
        }
      }
    }
    if (fYSortExprIndex < 0) {
      addDataExp(ySortKey,"String_Node_Str");
      fYSortExprIndex=findIndexOfBaseSeries(ySortKey);
    }
    if (!bAnyQueries) {
      throw new ChartException(ChartEnginePlugin.ID,ChartException.DATA_BINDING,"String_Node_Str",new Object[]{String.valueOf(k),seOrthogonal},Messages.getResourceBundle(this.locale));
    }
    String[] triggerExprs=DataProcessor.getSeriesTriggerExpressions(seOrthogonal,iae,baseSD,orthoSD);
    if (triggerExprs != null) {
      for (int t=0; t < triggerExprs.length; t++) {
        addDataExp(triggerExprs[t],strOrthoAgg);
      }
    }
  }
}

Fixed version (ground truth):
private void addLookupForOrthogonalSeries(SeriesDefinition baseSD,EList<SeriesDefinition> lstOrthogonalSDs,IActionEvaluator iae) throws ChartException {
  for (int k=0; k < lstOrthogonalSDs.size(); k++) {
    SeriesDefinition orthoSD=lstOrthogonalSDs.get(k);
    Query qOrthogonalSeriesDefinition=orthoSD.getQuery();
    if (qOrthogonalSeriesDefinition == null) {
      return;
    }
    String strOrthoAgg=getOrthogonalAggregationExpression(orthoSD);
    addDataExp(qOrthogonalSeriesDefinition.getDefinition(),strOrthoAgg);
    String ySortKey=getSortKey(orthoSD);
    Series seOrthogonal=orthoSD.getDesignTimeSeries();
    EList<Query> elOrthogonalSeries=seOrthogonal.getDataDefinition();
    if (elOrthogonalSeries.isEmpty()) {
      throw new ChartException(ChartEnginePlugin.ID,ChartException.DATA_BINDING,"String_Node_Str",new Object[]{String.valueOf(k),seOrthogonal},Messages.getResourceBundle(this.locale));
    }
    boolean bAnyQueries=false;
    for (int i=0; i < elOrthogonalSeries.size(); i++) {
      Query qOrthogonalSeries=elOrthogonalSeries.get(i);
      if (qOrthogonalSeries == null) {
        continue;
      }
      if (addDataExp(valueSeriesExprBuilder.buildExpr(qOrthogonalSeries,orthoSD,baseSD),strOrthoAgg)) {
        bAnyQueries=true;
        if (fBaseSortExprIndex < 0) {
          String sortExpr=getSortKey(baseSD);
          if (sortExpr != null && sortExpr.equals(qOrthogonalSeries.getDefinition()) && baseSD.eIsSet(DataPackage.eINSTANCE.getSeriesDefinition_Sorting())) {
            fBaseSortExprIndex=findIndex(valueSeriesExprBuilder.buildExpr(qOrthogonalSeries,orthoSD,baseSD),strOrthoAgg);
          }
        }
        if (fYSortExprIndex < 0) {
          if (ySortKey != null && ySortKey.equals(qOrthogonalSeries.getDefinition()) && orthoSD.eIsSet(DataPackage.eINSTANCE.getSeriesDefinition_Sorting())) {
            fYSortExprIndex=findIndex(valueSeriesExprBuilder.buildExpr(qOrthogonalSeries,orthoSD,baseSD),strOrthoAgg);
          }
        }
      }
    }
    if (fYSortExprIndex < 0 && qOrthogonalSeriesDefinition.getDefinition() != null && qOrthogonalSeriesDefinition.getDefinition().trim().length() > 0) {
      addDataExp(ySortKey,"String_Node_Str");
      fYSortExprIndex=findIndexOfBaseSeries(ySortKey);
    }
    if (!bAnyQueries) {
      throw new ChartException(ChartEnginePlugin.ID,ChartException.DATA_BINDING,"String_Node_Str",new Object[]{String.valueOf(k),seOrthogonal},Messages.getResourceBundle(this.locale));
    }
    String[] triggerExprs=DataProcessor.getSeriesTriggerExpressions(seOrthogonal,iae,baseSD,orthoSD);
    if (triggerExprs != null) {
      for (int t=0; t < triggerExprs.length; t++) {
        addDataExp(triggerExprs[t],strOrthoAgg);
      }
    }
  }
}