Program: 68575
Project: 68575
Buggy source:
private static List<String> getRowExpressions(ChartWithAxes cwa,IActionEvaluator iae,boolean needChangeValueExpr) throws ChartException {
  final List<String> alExpressions=new ArrayList<String>(4);
  final Axis axPrimaryBase=cwa.getPrimaryBaseAxes()[0];
  EList<SeriesDefinition> elSD=axPrimaryBase.getSeriesDefinitions();
  if (elSD.size() != 1) {
    throw new ChartException(ChartEnginePlugin.ID,ChartException.GENERATION,"String_Node_Str",Messages.getResourceBundle());
  }
  SeriesDefinition categorySD=elSD.get(0);
  final Query qBaseSeriesDefinition=categorySD.getQuery();
  String sExpression=qBaseSeriesDefinition.getDefinition();
  if (sExpression != null && sExpression.trim().length() > 0) {
    logger.log(ILogger.WARNING,Messages.getString("String_Node_Str",sExpression,ULocale.getDefault()));
  }
  final Series seBase=categorySD.getDesignTimeSeries();
  EList<Query> elBaseSeries=seBase.getDataDefinition();
  if (elBaseSeries.size() != 1) {
    throw new ChartException(ChartEnginePlugin.ID,ChartException.DATA_BINDING,"String_Node_Str",new Object[]{String.valueOf(elBaseSeries.size())},Messages.getResourceBundle());
  }
  final Query qBaseSeries=elBaseSeries.get(0);
  sExpression=qBaseSeries.getDefinition();
  if (sExpression != null && sExpression.trim().length() > 0) {
    alExpressions.add(sExpression);
    addSortExperssion(alExpressions,categorySD,sExpression);
  }
 else {
    throw new ChartException(ChartEnginePlugin.ID,ChartException.DATA_BINDING,"String_Node_Str",Messages.getResourceBundle());
  }
  Query qOrthogonalSeriesDefinition, qOrthogonalSeries;
  Series seOrthogonal;
  EList<Query> elOrthogonalSeries;
  final Axis[] axaOrthogonal=cwa.getOrthogonalAxes(axPrimaryBase,true);
  int iCount=0;
  boolean bAnyQueries;
  for (int j=0; j < axaOrthogonal.length; j++) {
    elSD=axaOrthogonal[j].getSeriesDefinitions();
    for (int k=0; k < elSD.size(); k++) {
      SeriesDefinition sd=elSD.get(k);
      qOrthogonalSeriesDefinition=sd.getQuery();
      if (qOrthogonalSeriesDefinition == null) {
        continue;
      }
      sExpression=qOrthogonalSeriesDefinition.getDefinition();
      if (sExpression != null && sExpression.trim().length() > 0) {
        if (alExpressions.contains(sExpression)) {
          int iRemovalIndex=alExpressions.indexOf(sExpression);
          if (iRemovalIndex > iCount) {
            alExpressions.remove(iRemovalIndex);
            alExpressions.add(iCount++,sExpression);
          }
 else {
          }
        }
 else {
          alExpressions.add(iCount++,sExpression);
          addSortExperssion(alExpressions,sd,sExpression);
        }
      }
      seOrthogonal=sd.getDesignTimeSeries();
      elOrthogonalSeries=seOrthogonal.getDataDefinition();
      if (elOrthogonalSeries.isEmpty()) {
        throw new ChartException(ChartEnginePlugin.ID,ChartException.DATA_BINDING,"String_Node_Str",new Object[]{String.valueOf(iCount),seOrthogonal},Messages.getResourceBundle());
      }
      bAnyQueries=false;
      for (int i=0; i < elOrthogonalSeries.size(); i++) {
        qOrthogonalSeries=elOrthogonalSeries.get(i);
        if (qOrthogonalSeries == null) {
          continue;
        }
        sExpression=qOrthogonalSeries.getDefinition();
        if (sExpression != null && sExpression.trim().length() > 0) {
          if (needChangeValueExpr) {
            sExpression=ChartUtil.createValueSeriesRowFullExpression(qOrthogonalSeries,sd,categorySD);
          }
          bAnyQueries=true;
          if (!alExpressions.contains(sExpression)) {
            alExpressions.add(sExpression);
          }
        }
      }
      if (!bAnyQueries) {
        throw new ChartException(ChartEnginePlugin.ID,ChartException.DATA_BINDING,"String_Node_Str",new Object[]{String.valueOf(iCount),seOrthogonal},Messages.getResourceBundle());
      }
      String[] triggerExprs=DataProcessor.getSeriesTriggerExpressions(seOrthogonal,iae,categorySD,sd);
      if (triggerExprs != null) {
        for (int t=0; t < triggerExprs.length; t++) {
          String tgexp=triggerExprs[t];
          if (!alExpressions.contains(tgexp)) {
            alExpressions.add(tgexp);
          }
        }
      }
    }
  }
  return alExpressions;
}

Fixed version (ground truth):
private static List<String> getRowExpressions(ChartWithAxes cwa,IActionEvaluator iae,boolean needChangeValueExpr) throws ChartException {
  final List<String> alExpressions=new ArrayList<String>(4);
  final Axis axPrimaryBase=cwa.getPrimaryBaseAxes()[0];
  EList<SeriesDefinition> elSD=axPrimaryBase.getSeriesDefinitions();
  if (elSD.size() != 1) {
    throw new ChartException(ChartEnginePlugin.ID,ChartException.GENERATION,"String_Node_Str",Messages.getResourceBundle());
  }
  SeriesDefinition categorySD=elSD.get(0);
  final Query qBaseSeriesDefinition=categorySD.getQuery();
  String sExpression=qBaseSeriesDefinition.getDefinition();
  if (sExpression != null && sExpression.trim().length() > 0) {
    logger.log(ILogger.WARNING,Messages.getString("String_Node_Str",sExpression,ULocale.getDefault()));
  }
  final Series seBase=categorySD.getDesignTimeSeries();
  EList<Query> elBaseSeries=seBase.getDataDefinition();
  if (elBaseSeries.size() != 1) {
    throw new ChartException(ChartEnginePlugin.ID,ChartException.DATA_BINDING,"String_Node_Str",new Object[]{String.valueOf(elBaseSeries.size())},Messages.getResourceBundle());
  }
  final Query qBaseSeries=elBaseSeries.get(0);
  sExpression=qBaseSeries.getDefinition();
  if (sExpression != null && sExpression.trim().length() > 0) {
    alExpressions.add(sExpression);
    addSortExperssion(alExpressions,categorySD,sExpression);
  }
 else {
    throw new ChartException(ChartEnginePlugin.ID,ChartException.DATA_BINDING,"String_Node_Str",Messages.getResourceBundle());
  }
  Query qOrthogonalSeriesDefinition, qOrthogonalSeries;
  Series seOrthogonal;
  EList<Query> elOrthogonalSeries;
  final Axis[] axaOrthogonal=cwa.getOrthogonalAxes(axPrimaryBase,true);
  int iCount=0;
  boolean bAnyQueries;
  for (int j=0; j < axaOrthogonal.length; j++) {
    elSD=axaOrthogonal[j].getSeriesDefinitions();
    for (int k=0; k < elSD.size(); k++) {
      SeriesDefinition sd=elSD.get(k);
      qOrthogonalSeriesDefinition=sd.getQuery();
      if (qOrthogonalSeriesDefinition == null) {
        continue;
      }
      sExpression=qOrthogonalSeriesDefinition.getDefinition();
      if (sExpression != null && sExpression.trim().length() > 0) {
        if (alExpressions.contains(sExpression)) {
          int iRemovalIndex=alExpressions.indexOf(sExpression);
          if (iRemovalIndex > iCount) {
            alExpressions.remove(iRemovalIndex);
            alExpressions.add(iCount++,sExpression);
          }
 else {
          }
        }
 else {
          alExpressions.add(iCount++,sExpression);
          addSortExperssion(alExpressions,sd,sExpression);
        }
      }
      seOrthogonal=sd.getDesignTimeSeries();
      elOrthogonalSeries=seOrthogonal.getDataDefinition();
      if (elOrthogonalSeries.isEmpty()) {
        throw new ChartException(ChartEnginePlugin.ID,ChartException.DATA_BINDING,"String_Node_Str",new Object[]{String.valueOf(iCount),seOrthogonal},Messages.getResourceBundle());
      }
      bAnyQueries=false;
      for (int i=0; i < elOrthogonalSeries.size(); i++) {
        qOrthogonalSeries=elOrthogonalSeries.get(i);
        if (qOrthogonalSeries == null) {
          continue;
        }
        sExpression=qOrthogonalSeries.getDefinition();
        if (sExpression != null && sExpression.trim().length() > 0) {
          if (needChangeValueExpr) {
            sExpression=ChartUtil.createValueSeriesRowFullExpression(qOrthogonalSeries,sd,categorySD);
          }
          bAnyQueries=true;
          String fullAggExpr=ChartUtil.getFullAggregateExpression(sd,categorySD,qOrthogonalSeries);
          if (fullAggExpr != null) {
            continue;
          }
          if (!alExpressions.contains(sExpression)) {
            alExpressions.add(sExpression);
          }
        }
      }
      if (!bAnyQueries) {
        throw new ChartException(ChartEnginePlugin.ID,ChartException.DATA_BINDING,"String_Node_Str",new Object[]{String.valueOf(iCount),seOrthogonal},Messages.getResourceBundle());
      }
      String[] triggerExprs=DataProcessor.getSeriesTriggerExpressions(seOrthogonal,iae,categorySD,sd);
      if (triggerExprs != null) {
        for (int t=0; t < triggerExprs.length; t++) {
          String tgexp=triggerExprs[t];
          if (!alExpressions.contains(tgexp)) {
            alExpressions.add(tgexp);
          }
        }
      }
    }
  }
  return alExpressions;
}