Program: 66286
Project: 66286
Buggy source:
public ComputedColumnHandle editBinding(ComputedColumnHandle binding) throws SemanticException {
  if (isAggregate()) {
    binding.setDisplayName(txtDisplayName.getText());
    binding.setDisplayNameID(txtDisplayNameID.getText());
    for (int i=0; i < DATA_TYPE_CHOICES.length; i++) {
      if (DATA_TYPE_CHOICES[i].getDisplayName().equals(cmbType.getText())) {
        binding.setDataType(DATA_TYPE_CHOICES[i].getName());
        break;
      }
    }
    binding.setAggregateFunction(getFunctionByDisplayName(cmbFunction.getText()).getName());
    ExpressionButtonUtil.saveExpressionButtonControl(txtFilter,binding,ComputedColumn.FILTER_MEMBER);
    binding.clearAggregateOnList();
    if (!isTimePeriod()) {
      String aggStr=cmbAggOn.getText();
      StringTokenizer token=new StringTokenizer(aggStr,"String_Node_Str");
      while (token.hasMoreTokens()) {
        String agg=token.nextToken();
        if (!agg.equals(ALL))         binding.addAggregateOn(agg);
      }
    }
    binding.setExpression(null);
    binding.clearArgumentList();
    for (Iterator iterator=paramsMap.keySet().iterator(); iterator.hasNext(); ) {
      String arg=(String)iterator.next();
      String value=getControlValue(paramsMap.get(arg));
      if (value != null) {
        AggregationArgument argHandle=StructureFactory.createAggregationArgument();
        argHandle.setName(arg);
        if (ExpressionButtonUtil.getExpressionButton(paramsMap.get(arg)) != null) {
          ExpressionButtonUtil.saveExpressionButtonControl(paramsMap.get(arg),argHandle,AggregationArgument.VALUE_MEMBER);
        }
 else {
          Expression expression=new Expression(value,ExpressionType.JAVASCRIPT);
          argHandle.setExpressionProperty(AggregationArgument.VALUE_MEMBER,expression);
        }
        binding.addArgument(argHandle);
      }
    }
  }
 else {
    for (int i=0; i < DATA_TYPE_CHOICES.length; i++) {
      if (DATA_TYPE_CHOICES[i].getDisplayName().equals(cmbType.getText())) {
        binding.setDataType(DATA_TYPE_CHOICES[i].getName());
        break;
      }
    }
    binding.setDisplayName(txtDisplayName.getText());
    binding.setDisplayNameID(txtDisplayNameID.getText());
    if (ExpressionButtonUtil.getExpressionButton(txtExpression) != null) {
      ExpressionButtonUtil.saveExpressionButtonControl(txtExpression,binding,ComputedColumn.EXPRESSION_MEMBER);
    }
 else {
      Expression expression=new Expression(getControlValue(txtExpression),ExpressionType.JAVASCRIPT);
      binding.setExpressionProperty(AggregationArgument.VALUE_MEMBER,expression);
    }
  }
  if (isTimePeriod()) {
    ITimeFunction timeFunction=getTimeFunctionByIndex(calculationType.getSelectionIndex());
    String dimensionName=timeDimension.getText();
    Expression dimensionExpression=new Expression(dimensionName,ExpressionType.JAVASCRIPT);
    binding.setExpressionProperty(ComputedColumn.TIME_DIMENSION_MEMBER,dimensionExpression);
    binding.setCalculationType(timeFunction.getName());
    binding.setProperty(ComputedColumn.CALCULATION_ARGUMENTS_MEMBER,null);
    for (Iterator iterator=calculationParamsMap.keySet().iterator(); iterator.hasNext(); ) {
      CalculationArgument argument=StructureFactory.createCalculationArgument();
      String arg=(String)iterator.next();
      argument.setName(arg);
      String value=getControlValue(calculationParamsMap.get(arg));
      if (value != null) {
        if (ExpressionButtonUtil.getExpressionButton(calculationParamsMap.get(arg)) != null) {
          Expression expr=getExpressionByControl(calculationParamsMap.get(arg));
          argument.setValue(expr);
        }
 else {
          Expression expr=new Expression(value,ExpressionType.JAVASCRIPT);
          argument.setValue(expr);
        }
        binding.addCalculationArgument(argument);
      }
    }
    if (todayButton.getSelection()) {
      binding.setReferenceDateType(DesignChoiceConstants.REFERENCE_DATE_TYPE_TODAY);
    }
 else     if (dateSelectionButton.getSelection()) {
      binding.setReferenceDateType(DesignChoiceConstants.REFERENCE_DATE_TYPE_FIXED_DATE);
      ExpressionButtonUtil.saveExpressionButtonControl(dateText,binding,ComputedColumn.REFERENCE_DATE_VALUE_MEMBER);
    }
 else     if (recentButton.getSelection()) {
      binding.setReferenceDateType(DesignChoiceConstants.REFERENCE_DATE_TYPE_ENDING_DATE_IN_DIMENSION);
    }
  }
  return binding;
}

Fixed version (ground truth):
public ComputedColumnHandle editBinding(ComputedColumnHandle binding) throws SemanticException {
  if (isAggregate()) {
    binding.setDisplayName(txtDisplayName.getText());
    binding.setDisplayNameID(txtDisplayNameID.getText());
    for (int i=0; i < DATA_TYPE_CHOICES.length; i++) {
      if (DATA_TYPE_CHOICES[i].getDisplayName().equals(cmbType.getText())) {
        binding.setDataType(DATA_TYPE_CHOICES[i].getName());
        break;
      }
    }
    binding.setAggregateFunction(getFunctionByDisplayName(cmbFunction.getText()).getName());
    ExpressionButtonUtil.saveExpressionButtonControl(txtFilter,binding,ComputedColumn.FILTER_MEMBER);
    binding.clearAggregateOnList();
    if (!isTimePeriod()) {
      String aggStr=cmbAggOn.getText();
      StringTokenizer token=new StringTokenizer(aggStr,"String_Node_Str");
      while (token.hasMoreTokens()) {
        String agg=token.nextToken();
        if (!agg.equals(ALL))         binding.addAggregateOn(agg);
      }
    }
    binding.setExpression(null);
    binding.clearArgumentList();
    for (Iterator iterator=paramsMap.keySet().iterator(); iterator.hasNext(); ) {
      String arg=(String)iterator.next();
      String value=getControlValue(paramsMap.get(arg));
      if (value != null) {
        AggregationArgument argHandle=StructureFactory.createAggregationArgument();
        argHandle.setName(arg);
        if (ExpressionButtonUtil.getExpressionButton(paramsMap.get(arg)) != null) {
          ExpressionButtonUtil.saveExpressionButtonControl(paramsMap.get(arg),argHandle,AggregationArgument.VALUE_MEMBER);
        }
 else {
          Expression expression=new Expression(value,ExpressionType.JAVASCRIPT);
          argHandle.setExpressionProperty(AggregationArgument.VALUE_MEMBER,expression);
        }
        binding.addArgument(argHandle);
      }
    }
  }
 else {
    for (int i=0; i < DATA_TYPE_CHOICES.length; i++) {
      if (DATA_TYPE_CHOICES[i].getDisplayName().equals(cmbType.getText())) {
        binding.setDataType(DATA_TYPE_CHOICES[i].getName());
        break;
      }
    }
    binding.setDisplayName(txtDisplayName.getText());
    binding.setDisplayNameID(txtDisplayNameID.getText());
    if (ExpressionButtonUtil.getExpressionButton(txtExpression) != null) {
      ExpressionButtonUtil.saveExpressionButtonControl(txtExpression,binding,ComputedColumn.EXPRESSION_MEMBER);
    }
 else {
      Expression expression=new Expression(getControlValue(txtExpression),ExpressionType.JAVASCRIPT);
      binding.setExpressionProperty(AggregationArgument.VALUE_MEMBER,expression);
    }
  }
  if (isTimePeriod()) {
    ITimeFunction timeFunction=getTimeFunctionByIndex(calculationType.getSelectionIndex());
    String dimensionName=timeDimension.getText();
    binding.setProperty(ComputedColumn.TIME_DIMENSION_MEMBER,dimensionName);
    binding.setCalculationType(timeFunction.getName());
    binding.setProperty(ComputedColumn.CALCULATION_ARGUMENTS_MEMBER,null);
    for (Iterator iterator=calculationParamsMap.keySet().iterator(); iterator.hasNext(); ) {
      CalculationArgument argument=StructureFactory.createCalculationArgument();
      String arg=(String)iterator.next();
      argument.setName(arg);
      String value=getControlValue(calculationParamsMap.get(arg));
      if (value != null) {
        if (ExpressionButtonUtil.getExpressionButton(calculationParamsMap.get(arg)) != null) {
          Expression expr=getExpressionByControl(calculationParamsMap.get(arg));
          argument.setValue(expr);
        }
 else {
          Expression expr=new Expression(value,ExpressionType.JAVASCRIPT);
          argument.setValue(expr);
        }
        binding.addCalculationArgument(argument);
      }
    }
    if (todayButton.getSelection()) {
      binding.setReferenceDateType(DesignChoiceConstants.REFERENCE_DATE_TYPE_TODAY);
    }
 else     if (dateSelectionButton.getSelection()) {
      binding.setReferenceDateType(DesignChoiceConstants.REFERENCE_DATE_TYPE_FIXED_DATE);
      ExpressionButtonUtil.saveExpressionButtonControl(dateText,binding,ComputedColumn.REFERENCE_DATE_VALUE_MEMBER);
    }
 else     if (recentButton.getSelection()) {
      binding.setReferenceDateType(DesignChoiceConstants.REFERENCE_DATE_TYPE_ENDING_DATE_IN_DIMENSION);
    }
  }
  return binding;
}