Program: 137280
Project: 137280
Buggy source:
/** 
 * DOC bZhou Comment method "createChart".
 * @param comp
 * @param chartType
 * @param units
 */
private void createChart(final Composite comp,EIndicatorChartType chartType,List<IndicatorUnit> units){
  IChartTypeStates chartTypeState=ChartTypeStatesOperator.getChartState(chartType,units);
  JFreeChart chart=null;
  CategoryDataset dataset=null;
  if (!EditorPreferencePage.isHideGraphics()) {
    chart=chartTypeState.getChart();
    ChartDecorator.decorate(chart,null);
    if (chart != null) {
      if (EIndicatorChartType.BENFORD_LAW_STATISTICS.equals(chartType)) {
        dataset=chart.getCategoryPlot().getDataset(1);
      }
 else {
        dataset=chart.getCategoryPlot().getDataset();
      }
    }
  }
  if (dataset == null) {
    dataset=chartTypeState.getDataset();
  }
  List<Indicator> indicators=null;
  DynamicIndicatorModel dyModel=new DynamicIndicatorModel();
  dyModel.setDataset(dataset);
  dyModel.setChartType(chartType);
  this.dynamicList.add(dyModel);
  indicators=getIndicators(units);
  dyModel.setIndicatorList(indicators);
  ChartWithData chartData=new ChartWithData(chartType,chart,((ICustomerDataset)dataset).getDataEntities());
  ExpandableComposite subComp=uiPagination.getToolkit().createExpandableComposite(comp,ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT | ExpandableComposite.EXPANDED);
  subComp.setText(chartData.getChartType().getLiteral());
  subComp.setLayoutData(new GridData(GridData.FILL_BOTH));
  subComp.setExpanded(EditorPreferencePage.isUnfoldingIndicators());
  final Composite composite=uiPagination.getToolkit().createComposite(subComp,SWT.NULL);
  composite.setLayout(new GridLayout(2,false));
  composite.setLayoutData(new GridData(GridData.FILL_BOTH));
  Analysis analysis=masterPage.getAnalysisHandler().getAnalysis();
  TableViewer tableviewer=chartTypeState.getTableForm(composite);
  tableviewer.setInput(chartData);
  if (EIndicatorChartType.SUMMARY_STATISTICS.equals(chartType)) {
    dyModel.setSummaryIndicators(getIndicatorsForTable(units,true));
  }
  dyModel.setTableViewer(tableviewer);
  DataExplorer dataExplorer=chartTypeState.getDataExplorer();
  ChartTableFactory.addMenuAndTip(tableviewer,dataExplorer,analysis);
  if (chart != null) {
    ChartComposite cc=new TalendChartComposite(composite,SWT.NONE,chart,true);
    if (EIndicatorChartType.SUMMARY_STATISTICS.equals(chartType)) {
      dyModel.setBawParentChartComp((TalendChartComposite)cc);
    }
    GridData gd=new GridData();
    gd.widthHint=PluginConstant.CHART_STANDARD_WIDHT;
    gd.heightHint=PluginConstant.CHART_STANDARD_HEIGHT;
    cc.setLayoutData(gd);
    addMouseListenerForChart(cc,dataExplorer,analysis);
  }
  subComp.setClient(composite);
  subComp.addExpansionListener(new ExpansionAdapter(){
    @Override public void expansionStateChanged(    ExpansionEvent e){
      form.reflow(true);
    }
  }
);
  masterPage.registerSection(subComp);
}

Fixed version (ground truth):
/** 
 * DOC bZhou Comment method "createChart".
 * @param comp
 * @param chartType
 * @param units
 */
private void createChart(final Composite comp,EIndicatorChartType chartType,List<IndicatorUnit> units){
  IChartTypeStates chartTypeState=ChartTypeStatesOperator.getChartState(chartType,units);
  DynamicIndicatorModel dyModel=new DynamicIndicatorModel();
  JFreeChart chart=null;
  CategoryDataset dataset=null;
  if (!EditorPreferencePage.isHideGraphics()) {
    chart=chartTypeState.getChart();
    ChartDecorator.decorate(chart,null);
    if (chart != null) {
      if (EIndicatorChartType.BENFORD_LAW_STATISTICS.equals(chartType)) {
        dataset=chart.getCategoryPlot().getDataset(1);
        dyModel.setSecondDataset(chart.getCategoryPlot().getDataset(0));
      }
 else {
        dataset=chart.getCategoryPlot().getDataset();
      }
    }
  }
  if (dataset == null) {
    dataset=chartTypeState.getDataset();
  }
  List<Indicator> indicators=null;
  dyModel.setDataset(dataset);
  dyModel.setChartType(chartType);
  this.dynamicList.add(dyModel);
  indicators=getIndicators(units);
  dyModel.setIndicatorList(indicators);
  ChartWithData chartData=new ChartWithData(chartType,chart,((ICustomerDataset)dataset).getDataEntities());
  ExpandableComposite subComp=uiPagination.getToolkit().createExpandableComposite(comp,ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT | ExpandableComposite.EXPANDED);
  subComp.setText(chartData.getChartType().getLiteral());
  subComp.setLayoutData(new GridData(GridData.FILL_BOTH));
  subComp.setExpanded(EditorPreferencePage.isUnfoldingIndicators());
  final Composite composite=uiPagination.getToolkit().createComposite(subComp,SWT.NULL);
  composite.setLayout(new GridLayout(2,false));
  composite.setLayoutData(new GridData(GridData.FILL_BOTH));
  Analysis analysis=masterPage.getAnalysisHandler().getAnalysis();
  TableViewer tableviewer=chartTypeState.getTableForm(composite);
  tableviewer.setInput(chartData);
  if (EIndicatorChartType.SUMMARY_STATISTICS.equals(chartType)) {
    dyModel.setSummaryIndicators(getIndicatorsForTable(units,true));
  }
  dyModel.setTableViewer(tableviewer);
  DataExplorer dataExplorer=chartTypeState.getDataExplorer();
  ChartTableFactory.addMenuAndTip(tableviewer,dataExplorer,analysis);
  if (chart != null) {
    ChartComposite cc=new TalendChartComposite(composite,SWT.NONE,chart,true);
    if (EIndicatorChartType.SUMMARY_STATISTICS.equals(chartType)) {
      dyModel.setBawParentChartComp((TalendChartComposite)cc);
    }
    GridData gd=new GridData();
    gd.widthHint=PluginConstant.CHART_STANDARD_WIDHT;
    gd.heightHint=PluginConstant.CHART_STANDARD_HEIGHT;
    cc.setLayoutData(gd);
    addMouseListenerForChart(cc,dataExplorer,analysis);
  }
  subComp.setClient(composite);
  subComp.addExpansionListener(new ExpansionAdapter(){
    @Override public void expansionStateChanged(    ExpansionEvent e){
      form.reflow(true);
    }
  }
);
  masterPage.registerSection(subComp);
}