Program: 140213
Project: 140213
Buggy source:
public void chartMouseClicked(ChartMouseEvent event){
  ChartEntity chartEntity=event.getEntity();
  if (chartEntity != null) {
    CategoryItemEntity cateEntity=(CategoryItemEntity)chartEntity;
    IDataEntity dataEntity=(IDataEntity)cateEntity.getDataset();
    ChartDataEntity currentDataEntity=null;
    for (    ChartDataEntity entity : dataEntity.getDataEntities()) {
      if (chartType == EIndicatorChartType.FREQUENCE_STATISTICS) {
        if (cateEntity.getColumnKey().compareTo(entity.getLabel()) == 0) {
          currentDataEntity=entity;
        }
      }
 else {
        if (cateEntity.getRowKey().compareTo(entity.getLabel()) == 0) {
          currentDataEntity=entity;
        }
      }
    }
    PopupMenu menu=new PopupMenu("String_Node_Str");
    if (currentDataEntity != null) {
      final Indicator currentIndicator=currentDataEntity.getIndicator();
      MenuItemEntity[] itemEntities=ChartTableMenuGenerator.generate(chartType,analysis,currentDataEntity);
      for (      final MenuItemEntity itemEntity : itemEntities) {
        MenuItem item=new MenuItem(itemEntity.getLabel());
        item.addActionListener(new ActionListener(){
          public void actionPerformed(          ActionEvent arg0){
            Display.getDefault().asyncExec(new Runnable(){
              public void run(){
                ChartTableFactory.viewRecordInDataExplorer(analysis,currentIndicator,itemEntity.getQuery());
              }
            }
);
          }
        }
);
        menu.add(item);
      }
      chartPanel.add(menu);
      menu.show(chartPanel,event.getTrigger().getX(),event.getTrigger().getY());
    }
  }
}

Fixed version (ground truth):
public void chartMouseClicked(ChartMouseEvent event){
  ChartEntity chartEntity=event.getEntity();
  if (chartEntity != null) {
    CategoryItemEntity cateEntity=(CategoryItemEntity)chartEntity;
    IDataEntity dataEntity=(IDataEntity)cateEntity.getDataset();
    ChartDataEntity currentDataEntity=null;
    ChartDataEntity[] dataEntities=dataEntity.getDataEntities();
    if (dataEntities.length == 1) {
      currentDataEntity=dataEntities[0];
    }
 else {
      for (      ChartDataEntity entity : dataEntities) {
        if (chartType == EIndicatorChartType.FREQUENCE_STATISTICS) {
          if (cateEntity.getColumnKey().compareTo(entity.getLabel()) == 0) {
            currentDataEntity=entity;
          }
        }
 else {
          if (cateEntity.getRowKey().compareTo(entity.getLabel()) == 0) {
            currentDataEntity=entity;
          }
        }
      }
    }
    PopupMenu menu=new PopupMenu("String_Node_Str");
    if (currentDataEntity != null) {
      final Indicator currentIndicator=currentDataEntity.getIndicator();
      MenuItemEntity[] itemEntities=ChartTableMenuGenerator.generate(chartType,analysis,currentDataEntity);
      for (      final MenuItemEntity itemEntity : itemEntities) {
        MenuItem item=new MenuItem(itemEntity.getLabel());
        item.addActionListener(new ActionListener(){
          public void actionPerformed(          ActionEvent arg0){
            Display.getDefault().asyncExec(new Runnable(){
              public void run(){
                ChartTableFactory.viewRecordInDataExplorer(analysis,currentIndicator,itemEntity.getQuery());
              }
            }
);
          }
        }
);
        menu.add(item);
      }
      chartPanel.add(menu);
      menu.show(chartPanel,event.getTrigger().getX(),event.getTrigger().getY());
    }
  }
}