Program: 68260
Project: 68260
Buggy source:
/** 
 * Updates the color registry and refresh all background color of the text field
 * @param seriesIndex -1 means all series under selected axis
 */
private void updateColorRegistry(int seriesIndex){
  List<Query> dataDefinitions=null;
  if (seriesIndex > -1) {
    dataDefinitions=seriesDefns.get(seriesIndex).getDesignTimeSeries().getDataDefinition();
  }
 else {
    List<SeriesDefinition> allSeriesDefns=ChartUIUtil.getAllOrthogonalSeriesDefinitions(getChart());
    dataDefinitions=new ArrayList<Query>();
    for (int i=0; i < allSeriesDefns.size(); i++) {
      dataDefinitions.addAll(allSeriesDefns.get(i).getDesignTimeSeries().getDataDefinition());
    }
  }
  Map<String,Integer> queryMap=new HashMap<String,Integer>();
  for (int i=0; i < dataDefinitions.size(); i++) {
    String expression=dataDefinitions.get(i).getDefinition();
    if (queryMap.containsKey(expression)) {
      int expCount=queryMap.get(expression).intValue();
      queryMap.put(expression,Integer.valueOf(expCount++));
    }
 else {
      queryMap.put(expression,Integer.valueOf(1));
    }
  }
  for (Iterator<Entry<String,Integer>> iterator=queryMap.entrySet().iterator(); iterator.hasNext(); ) {
    Entry<String,Integer> entry=iterator.next();
    String expression=entry.getKey();
    if (DataDefinitionTextManager.getInstance().getNumberOfSameDataDefinition(expression) == entry.getValue().intValue()) {
      ColorPalette.getInstance().retrieveColor(expression);
    }
  }
  final Event e=new Event();
  e.data=DataDefinitionSelector.this;
  e.type=IChartDataSheet.EVENT_QUERY;
  e.detail=IChartDataSheet.DETAIL_UPDATE_COLOR;
  Display.getCurrent().asyncExec(new Runnable(){
    public void run(){
      wizardContext.getDataSheet().notifyListeners(e);
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Updates the color registry and refresh all background color of the text field
 * @param seriesIndex -1 means all series under selected axis
 */
private void updateColorRegistry(int seriesIndex){
  List<Query> dataDefinitions=null;
  if (seriesIndex > -1) {
    dataDefinitions=seriesDefns.get(seriesIndex).getDesignTimeSeries().getDataDefinition();
  }
 else {
    List<SeriesDefinition> allSeriesDefns=ChartUIUtil.getAllOrthogonalSeriesDefinitions(getChart());
    dataDefinitions=new ArrayList<Query>();
    for (int i=0; i < allSeriesDefns.size(); i++) {
      dataDefinitions.addAll(allSeriesDefns.get(i).getDesignTimeSeries().getDataDefinition());
    }
  }
  Map<String,Integer> queryMap=new HashMap<String,Integer>();
  for (int i=0; i < dataDefinitions.size(); i++) {
    String expression=dataDefinitions.get(i).getDefinition();
    if (queryMap.containsKey(expression)) {
      int expCount=queryMap.get(expression).intValue();
      queryMap.put(expression,Integer.valueOf(expCount++));
    }
 else {
      queryMap.put(expression,Integer.valueOf(1));
    }
  }
  for (Iterator<Entry<String,Integer>> iterator=queryMap.entrySet().iterator(); iterator.hasNext(); ) {
    Entry<String,Integer> entry=iterator.next();
    String expression=entry.getKey();
    if (DataDefinitionTextManager.getInstance().getNumberOfSameDataDefinition(expression) == entry.getValue().intValue()) {
      ColorPalette.getInstance().retrieveColor(expression);
    }
  }
  final Event e=new Event();
  e.data=DataDefinitionSelector.this;
  e.type=IChartDataSheet.EVENT_QUERY;
  e.detail=IChartDataSheet.DETAIL_UPDATE_COLOR_AND_TEXT;
  Display.getCurrent().asyncExec(new Runnable(){
    public void run(){
      wizardContext.getDataSheet().notifyListeners(e);
    }
  }
);
}