Program: 119474
Project: 119474
Buggy source:
public void setTraceData(TraceData data,boolean flag,boolean traceFlag){
  if (data != null) {
    List childrens=this.getChildren();
    childrens.clear();
    boolean noVarNameDefined=false;
    Figure outlineFigure=new Figure();
    outlineFigure.setLayoutManager(new ToolbarLayout(true));
    int title1With=0;
    int title2With=0;
    if (tooltip != null) {
      collapseButton=new CollapseFigure();
      collapseButton.setCollapsed(connection.getConnectionTrace().isCollapse());
      collapseButton.addActionListener(new ActionListener(){
        @Override public void actionPerformed(        ActionEvent event){
          connection.getConnectionTrace().setCollapse(!connection.getConnectionTrace().isCollapse());
          collapseButton.setCollapsed(connection.getConnectionTrace().isCollapse());
          refreshCollapseStatus();
        }
      }
);
      if (flag == true) {
        outlineFigure.add(collapseButton);
      }
    }
    int lineNumber=data.getNbLine();
    SimpleHtmlFigure titleFigure=new SimpleHtmlFigure();
    titleFigure.setText("String_Node_Str");
    titleFigure.setText("String_Node_Str" + connection.getConnectionLabel().getLabelText() + "String_Node_Str");
    if (tooltip != null) {
      titleFigure.setBackgroundColor(ColorConstants.white);
      titleFigure.setOpaque(false);
    }
    titleFigure.getPreferredSize().expand(20,2);
    title1With=titleFigure.getPreferredSize().width;
    SimpleHtmlFigure titleFigureSe=new SimpleHtmlFigure();
    titleFigureSe.setText("String_Node_Str" + lineNumber + "String_Node_Str");
    if (tooltip != null) {
      titleFigureSe.setBackgroundColor(ColorConstants.white);
      titleFigureSe.setOpaque(false);
    }
    titleFigureSe.getPreferredSize().expand(20,2);
    title2With=titleFigureSe.getPreferredSize().width;
    if (flag == true) {
      outlineFigure.add(titleFigure);
    }
    ImageFigure figure=new ImageFigure(getTraceConnectionImage(flag));
    outlineFigure.add(figure);
    if (flag == true) {
      outlineFigure.add(titleFigureSe);
    }
    outlineFigure.setBorder(new LineBorder(ColorConstants.darkGray,SWT.LEFT | SWT.RIGHT | SWT.TOP| SWT.BOTTOM));
    outlineFigure.setOpaque(true);
    add(outlineFigure);
    Dimension size=titleFigure.getPreferredSize().getCopy();
    int variableWidth=0;
    int valueWidth=0;
    List<Map<String,Object>> columnsCheckInfo=null;
    if (data.getData() != null) {
      columnsCheckInfo=TracesConnectionUtils.getTraceConnectionFilterValues(connection);
      Iterator<String> iterator=data.getData().keySet().iterator();
      while (iterator.hasNext()) {
        String columnLabel=iterator.next();
        if (columnsCheckInfo != null && !isColumnChecked(columnsCheckInfo,columnLabel)) {
          continue;
        }
        String formatedVariable="String_Node_Str" + columnLabel + "String_Node_Str";
        String formatedValue="String_Node_Str" + data.getData().get(columnLabel) + "String_Node_Str";
        SimpleHtmlFigure var=new SimpleHtmlFigure();
        var.setText(formatedVariable);
        SimpleHtmlFigure value=new SimpleHtmlFigure();
        value.setText(formatedValue);
        Dimension varSize=var.getPreferredSize();
        varSize.expand(0,3);
        var.setPreferredSize(varSize);
        if (varSize.width > variableWidth) {
          variableWidth=varSize.width;
        }
        Dimension valueSize=value.getPreferredSize();
        valueSize.expand(0,3);
        value.setPreferredSize(valueSize);
        if (valueSize.width > valueWidth) {
          valueWidth=valueSize.width;
        }
        size.expand(0,varSize.height);
      }
    }
    variableWidth+=10;
    valueWidth+=10;
    if (variableWidth < title1With) {
      variableWidth=title1With;
    }
    if (valueWidth < title2With) {
      valueWidth=title2With;
    }
    if (variableWidth < MAX_VARIABLE_WIDTH) {
      variableWidth=MAX_VARIABLE_WIDTH;
    }
    if (valueWidth < MAX_VALUE_WIDTH) {
      valueWidth=MAX_VALUE_WIDTH;
    }
    if ((variableWidth + valueWidth) < titleFigure.getPreferredSize().width) {
      valueWidth=titleFigure.getPreferredSize().width - variableWidth;
    }
    if (noVarNameDefined) {
      if (titleFigure.getPreferredSize().width > valueWidth) {
        valueWidth=titleFigure.getPreferredSize().width;
      }
    }
    int nbVar=0;
    if (data.getData() != null) {
      Iterator<String> iterator=data.getData().keySet().iterator();
      while (iterator.hasNext()) {
        String columnLabel=iterator.next();
        if (columnsCheckInfo != null && !isColumnChecked(columnsCheckInfo,columnLabel)) {
          continue;
        }
        String formatedVariable="String_Node_Str" + columnLabel + "String_Node_Str";
        String formatedValue="String_Node_Str" + data.getData().get(columnLabel) + "String_Node_Str";
        SimpleHtmlFigure var=new SimpleHtmlFigure();
        var.setText(formatedVariable);
        SimpleHtmlFigure value=new SimpleHtmlFigure();
        value.setText(formatedValue);
        Dimension valueSize=value.getPreferredSize();
        valueSize.expand(0,3);
        value.setPreferredSize(valueSize);
        value.setPreferredSize(valueWidth,valueSize.height);
        var.setBorder(new LineBorder(ColorConstants.darkGray,SWT.RIGHT));
        Dimension varSize=var.getPreferredSize();
        varSize.expand(0,3);
        var.setPreferredSize(varSize);
        var.setPreferredSize(variableWidth,varSize.height);
        ToolbarLayout variableLayout=new ToolbarLayout(true);
        variableFigure=new Figure();
        variableFigure.setLayoutManager(variableLayout);
        variableFigure.add(var);
        variableFigure.add(value);
        if (flag == true) {
          add(variableFigure);
        }
      }
      if (tooltip != null) {
        variableFigure.setBorder(new LineBorder(ColorConstants.darkGray,SWT.LEFT | SWT.RIGHT));
      }
      variableFigure.setOpaque(true);
      if ((nbVar % 2) != 0) {
        if (tooltip != null) {
          variableFigure.setBackgroundColor(ColorConstants.white);
        }
      }
 else {
        variableFigure.setBackgroundColor(BACKGROUND);
      }
      nbVar++;
    }
    if (tooltip != null) {
      if (variableFigure != null) {
        variableFigure.setBorder(new LineBorder(ColorConstants.darkGray,SWT.LEFT | SWT.BOTTOM | SWT.RIGHT));
      }
    }
    if (maximized) {
      this.setVariableFigureBorder();
    }
    if (noVarNameDefined) {
      size.width=valueWidth;
    }
 else {
      size.width=variableWidth + valueWidth;
    }
    if (size.width < titleFigure.getPreferredSize().width) {
      size.width=titleFigure.getPreferredSize().width;
    }
    size.expand(5,3);
    setPreferredSize(size);
    setVisible(true);
    if (!flag) {
      this.remove(outlineFigure);
      add(figure);
    }
  }
 else {
    if (traceFlag) {
      Image enableImage=getTraceConnectionImage(flag);
      setPreferredSize(enableImage.getImageData().width,enableImage.getImageData().height);
      this.getChildren().clear();
      ImageFigure figure=new ImageFigure(enableImage);
      add(figure);
      setVisible(true);
    }
 else {
      setPreferredSize(0,0);
      setVisible(false);
    }
  }
  if (tooltip != null) {
    if (flag) {
      tooltip.setTraceData(data,flag,traceFlag);
    }
 else {
      tooltip.setTraceData(data,flag,false);
    }
  }
  contents=new ArrayList(getChildren());
  refreshCollapseStatus();
}

Fixed version (ground truth):
public void setTraceData(TraceData data,boolean flag,boolean traceFlag){
  if (data != null) {
    List childrens=this.getChildren();
    childrens.clear();
    boolean noVarNameDefined=false;
    Figure outlineFigure=new Figure();
    outlineFigure.setLayoutManager(new ToolbarLayout(true));
    int title1With=0;
    int title2With=0;
    if (tooltip != null) {
      collapseButton=new CollapseFigure();
      collapseButton.setCollapsed(connection.getConnectionTrace().isCollapse());
      collapseButton.addActionListener(new ActionListener(){
        @Override public void actionPerformed(        ActionEvent event){
          connection.getConnectionTrace().setCollapse(!connection.getConnectionTrace().isCollapse());
          collapseButton.setCollapsed(connection.getConnectionTrace().isCollapse());
          refreshCollapseStatus();
        }
      }
);
      if (flag == true) {
        outlineFigure.add(collapseButton);
      }
    }
    int lineNumber=data.getNbLine();
    SimpleHtmlFigure titleFigure=new SimpleHtmlFigure();
    titleFigure.setText("String_Node_Str");
    titleFigure.setText("String_Node_Str" + connection.getConnectionLabel().getLabelText() + "String_Node_Str");
    if (tooltip != null) {
      titleFigure.setBackgroundColor(ColorConstants.white);
      titleFigure.setOpaque(false);
    }
    titleFigure.getPreferredSize().expand(20,2);
    title1With=titleFigure.getPreferredSize().width;
    SimpleHtmlFigure titleFigureSe=new SimpleHtmlFigure();
    titleFigureSe.setText("String_Node_Str" + lineNumber + "String_Node_Str");
    if (tooltip != null) {
      titleFigureSe.setBackgroundColor(ColorConstants.white);
      titleFigureSe.setOpaque(false);
    }
    titleFigureSe.getPreferredSize().expand(20,2);
    title2With=titleFigureSe.getPreferredSize().width;
    if (flag == true) {
      outlineFigure.add(titleFigure);
    }
    ImageFigure figure=new ImageFigure(getTraceConnectionImage(flag));
    outlineFigure.add(figure);
    if (flag == true) {
      outlineFigure.add(titleFigureSe);
    }
    outlineFigure.setBorder(new LineBorder(ColorConstants.darkGray,SWT.LEFT | SWT.RIGHT | SWT.TOP| SWT.BOTTOM));
    outlineFigure.setOpaque(true);
    add(outlineFigure);
    Dimension size=titleFigure.getPreferredSize().getCopy();
    int variableWidth=0;
    int valueWidth=0;
    List<Map<String,Object>> columnsCheckInfo=null;
    if (data.getData() != null) {
      columnsCheckInfo=TracesConnectionUtils.getTraceConnectionFilterValues(connection);
      Iterator<String> iterator=data.getData().keySet().iterator();
      while (iterator.hasNext()) {
        String columnLabel=iterator.next();
        if (columnsCheckInfo != null && !isColumnChecked(columnsCheckInfo,columnLabel)) {
          continue;
        }
        String formatedVariable="String_Node_Str" + columnLabel + "String_Node_Str";
        String formatedValue="String_Node_Str" + data.getData().get(columnLabel) + "String_Node_Str";
        SimpleHtmlFigure var=new SimpleHtmlFigure();
        var.setText(formatedVariable);
        SimpleHtmlFigure value=new SimpleHtmlFigure();
        value.setText(formatedValue);
        Dimension varSize=var.getPreferredSize();
        varSize.expand(0,3);
        var.setPreferredSize(varSize);
        if (varSize.width > variableWidth) {
          variableWidth=varSize.width;
        }
        Dimension valueSize=value.getPreferredSize();
        valueSize.expand(0,3);
        value.setPreferredSize(valueSize);
        if (valueSize.width > valueWidth) {
          valueWidth=valueSize.width;
        }
        size.expand(0,varSize.height);
      }
    }
    variableWidth+=10;
    valueWidth+=10;
    if (variableWidth < title1With) {
      variableWidth=title1With;
    }
    if (valueWidth < title2With) {
      valueWidth=title2With;
    }
    if (variableWidth < MAX_VARIABLE_WIDTH) {
      variableWidth=MAX_VARIABLE_WIDTH;
    }
    if (valueWidth < MAX_VALUE_WIDTH) {
      valueWidth=MAX_VALUE_WIDTH;
    }
    if ((variableWidth + valueWidth) < titleFigure.getPreferredSize().width) {
      valueWidth=titleFigure.getPreferredSize().width - variableWidth;
    }
    if (noVarNameDefined) {
      if (titleFigure.getPreferredSize().width > valueWidth) {
        valueWidth=titleFigure.getPreferredSize().width;
      }
    }
    int nbVar=0;
    if (data.getData() != null) {
      Iterator<String> iterator=data.getData().keySet().iterator();
      while (iterator.hasNext()) {
        String columnLabel=iterator.next();
        if (columnsCheckInfo != null && !isColumnChecked(columnsCheckInfo,columnLabel)) {
          continue;
        }
        String formatedVariable="String_Node_Str" + columnLabel + "String_Node_Str";
        String formatedValue="String_Node_Str" + data.getData().get(columnLabel) + "String_Node_Str";
        SimpleHtmlFigure var=new SimpleHtmlFigure();
        var.setText(formatedVariable);
        SimpleHtmlFigure value=new SimpleHtmlFigure();
        value.setText(formatedValue);
        Dimension valueSize=value.getPreferredSize();
        valueSize.expand(0,3);
        value.setPreferredSize(valueSize);
        value.setPreferredSize(valueWidth,valueSize.height);
        var.setBorder(new LineBorder(ColorConstants.darkGray,SWT.RIGHT));
        Dimension varSize=var.getPreferredSize();
        varSize.expand(0,3);
        var.setPreferredSize(varSize);
        var.setPreferredSize(variableWidth,varSize.height);
        ToolbarLayout variableLayout=new ToolbarLayout(true);
        variableFigure=new Figure();
        variableFigure.setLayoutManager(variableLayout);
        variableFigure.add(var);
        variableFigure.add(value);
        if (flag == true) {
          add(variableFigure);
        }
      }
      if (tooltip != null) {
        if (variableFigure != null) {
          variableFigure.setBorder(new LineBorder(ColorConstants.darkGray,SWT.LEFT | SWT.RIGHT));
        }
      }
      if (variableFigure != null) {
        variableFigure.setOpaque(true);
      }
      if ((nbVar % 2) != 0) {
        if (tooltip != null) {
          if (variableFigure != null) {
            variableFigure.setBackgroundColor(ColorConstants.white);
          }
        }
      }
 else {
        if (variableFigure != null) {
          variableFigure.setBackgroundColor(BACKGROUND);
        }
      }
      nbVar++;
    }
    if (tooltip != null) {
      if (variableFigure != null) {
        variableFigure.setBorder(new LineBorder(ColorConstants.darkGray,SWT.LEFT | SWT.BOTTOM | SWT.RIGHT));
      }
    }
    if (maximized) {
      this.setVariableFigureBorder();
    }
    if (noVarNameDefined) {
      size.width=valueWidth;
    }
 else {
      size.width=variableWidth + valueWidth;
    }
    if (size.width < titleFigure.getPreferredSize().width) {
      size.width=titleFigure.getPreferredSize().width;
    }
    size.expand(5,3);
    setPreferredSize(size);
    setVisible(true);
    if (!flag) {
      this.remove(outlineFigure);
      add(figure);
    }
  }
 else {
    if (traceFlag) {
      Image enableImage=getTraceConnectionImage(flag);
      setPreferredSize(enableImage.getImageData().width,enableImage.getImageData().height);
      this.getChildren().clear();
      ImageFigure figure=new ImageFigure(enableImage);
      add(figure);
      setVisible(true);
    }
 else {
      setPreferredSize(0,0);
      setVisible(false);
    }
  }
  if (tooltip != null) {
    if (flag) {
      tooltip.setTraceData(data,flag,traceFlag);
    }
 else {
      tooltip.setTraceData(data,flag,false);
    }
  }
  contents=new ArrayList(getChildren());
  refreshCollapseStatus();
}