Program: 65561
Project: 65561
Buggy source:
protected void okPressed(){
  try {
    if (!isEdit) {
      TabularMeasureHandle measure;
      if (input == null)       measure=DesignElementFactory.getInstance().newTabularMeasure(nameText.getText());
 else {
        measure=input;
        input.setName(nameText.getText());
      }
      measure.setCalculated(derivedMeasureBtn.getSelection());
      measure.setFunction(getFunctions()[functionCombo.getSelectionIndex()].getName());
      measure.setDataType(getDataTypeNames()[typeCombo.getSelectionIndex()]);
      if (expressionText.isEnabled()) {
        ExpressionButtonUtil.saveExpressionButtonControl(expressionText,measure,MeasureHandle.MEASURE_EXPRESSION_PROP);
      }
      if (securityHelper != null) {
        securityHelper.validate();
        measure.setExpressionProperty(MeasureHandle.ACL_EXPRESSION_PROP,(Expression)securityHelper.getProperty(BuilderConstants.SECURITY_EXPRESSION_PROPERTY));
      }
      if (alignmentHelper != null) {
        measure.setAlignment((String)alignmentHelper.getProperty(BuilderConstants.ALIGNMENT_VALUE));
      }
      if (formatHelper != null && formatHelper.getProperty(BuilderConstants.FORMAT_VALUE_RESULT) instanceof Object[]) {
        Object[] formatValue=(Object[])formatHelper.getProperty(BuilderConstants.FORMAT_VALUE_RESULT);
        Object value=measure.getProperty(Measure.FORMAT_PROP);
        if (value == null) {
          FormatValue formatValueToSet=new FormatValue();
          formatValueToSet.setCategory((String)formatValue[0]);
          formatValueToSet.setPattern((String)formatValue[1]);
          formatValueToSet.setLocale((ULocale)formatValue[2]);
          measure.setProperty(Measure.FORMAT_PROP,formatValueToSet);
        }
 else {
          PropertyHandle propHandle=measure.getPropertyHandle(Measure.FORMAT_PROP);
          FormatValue formatValueToSet=(FormatValue)value;
          FormatValueHandle formatHandle=(FormatValueHandle)formatValueToSet.getHandle(propHandle);
          formatHandle.setCategory((String)formatValue[0]);
          formatHandle.setPattern((String)formatValue[1]);
          formatHandle.setLocale((ULocale)formatValue[2]);
        }
      }
      measure.setVisible(!visibilityBtn.getSelection());
      result=measure;
    }
 else {
      input.setName(nameText.getText());
      input.setCalculated(derivedMeasureBtn.getSelection());
      input.setFunction(getFunctions()[functionCombo.getSelectionIndex()].getName());
      input.setDataType(getDataTypeNames()[typeCombo.getSelectionIndex()]);
      if (expressionText.isEnabled()) {
        ExpressionButtonUtil.saveExpressionButtonControl(expressionText,input,MeasureHandle.MEASURE_EXPRESSION_PROP);
      }
 else       input.setMeasureExpression(null);
      if (securityHelper != null) {
        securityHelper.validate();
        input.setExpressionProperty(MeasureHandle.ACL_EXPRESSION_PROP,(Expression)securityHelper.getProperty(BuilderConstants.SECURITY_EXPRESSION_PROPERTY));
      }
      if (alignmentHelper != null) {
        input.setAlignment((String)alignmentHelper.getProperty(BuilderConstants.ALIGNMENT_VALUE));
      }
      if (formatHelper != null && formatHelper.getProperty(BuilderConstants.FORMAT_VALUE_RESULT) instanceof Object[]) {
        Object[] formatValue=(Object[])formatHelper.getProperty(BuilderConstants.FORMAT_VALUE_RESULT);
        Object value=input.getProperty(Measure.FORMAT_PROP);
        if (value == null) {
          FormatValue formatValueToSet=new FormatValue();
          formatValueToSet.setCategory((String)formatValue[0]);
          formatValueToSet.setPattern((String)formatValue[1]);
          formatValueToSet.setLocale((ULocale)formatValue[2]);
          input.setProperty(Measure.FORMAT_PROP,formatValueToSet);
        }
 else {
          PropertyHandle propHandle=input.getPropertyHandle(Measure.FORMAT_PROP);
          FormatValue formatValueToSet=(FormatValue)value;
          FormatValueHandle formatHandle=(FormatValueHandle)formatValueToSet.getHandle(propHandle);
          formatHandle.setCategory((String)formatValue[0]);
          formatHandle.setPattern((String)formatValue[1]);
          formatHandle.setLocale((ULocale)formatValue[2]);
        }
      }
      input.setVisible(!visibilityBtn.getSelection());
      result=input;
    }
  }
 catch (  SemanticException e) {
    ExceptionUtil.handle(e);
    return;
  }
  super.okPressed();
}

Fixed version (ground truth):
protected void okPressed(){
  try {
    if (!isEdit) {
      TabularMeasureHandle measure;
      if (input == null) {
        measure=DesignElementFactory.getInstance().newTabularMeasure(nameText.getText());
        if (displayNameText.getText().trim().length() > 0) {
          measure.setDisplayName(displayNameText.getText().trim());
        }
 else {
          measure.setDisplayName(null);
        }
      }
 else {
        measure=input;
        input.setName(nameText.getText());
        if (displayNameText.getText().trim().length() > 0) {
          input.setDisplayName(displayNameText.getText().trim());
        }
 else {
          input.setDisplayName(null);
        }
      }
      measure.setCalculated(derivedMeasureBtn.getSelection());
      if (derivedMeasureBtn.getSelection()) {
        measure.setFunction(null);
      }
 else {
        measure.setFunction(getFunctions()[functionCombo.getSelectionIndex()].getName());
      }
      measure.setDataType(getDataTypeNames()[typeCombo.getSelectionIndex()]);
      if (expressionText.isEnabled()) {
        ExpressionButtonUtil.saveExpressionButtonControl(expressionText,measure,MeasureHandle.MEASURE_EXPRESSION_PROP);
      }
      if (!derivedMeasureBtn.getSelection()) {
        if (securityHelper != null) {
          securityHelper.validate();
          measure.setExpressionProperty(MeasureHandle.ACL_EXPRESSION_PROP,(Expression)securityHelper.getProperty(BuilderConstants.SECURITY_EXPRESSION_PROPERTY));
        }
      }
 else {
        measure.setExpressionProperty(MeasureHandle.ACL_EXPRESSION_PROP,null);
      }
      if (securityHelper != null) {
      }
      if (alignmentHelper != null) {
        measure.setAlignment((String)alignmentHelper.getProperty(BuilderConstants.ALIGNMENT_VALUE));
      }
      if (formatHelper != null && formatHelper.getProperty(BuilderConstants.FORMAT_VALUE_RESULT) instanceof Object[]) {
        Object[] formatValue=(Object[])formatHelper.getProperty(BuilderConstants.FORMAT_VALUE_RESULT);
        Object value=measure.getProperty(Measure.FORMAT_PROP);
        if (value == null) {
          FormatValue formatValueToSet=new FormatValue();
          formatValueToSet.setCategory((String)formatValue[0]);
          formatValueToSet.setPattern((String)formatValue[1]);
          formatValueToSet.setLocale((ULocale)formatValue[2]);
          measure.setProperty(Measure.FORMAT_PROP,formatValueToSet);
        }
 else {
          PropertyHandle propHandle=measure.getPropertyHandle(Measure.FORMAT_PROP);
          FormatValue formatValueToSet=(FormatValue)value;
          FormatValueHandle formatHandle=(FormatValueHandle)formatValueToSet.getHandle(propHandle);
          formatHandle.setCategory((String)formatValue[0]);
          formatHandle.setPattern((String)formatValue[1]);
          formatHandle.setLocale((ULocale)formatValue[2]);
        }
      }
      measure.setVisible(!visibilityBtn.getSelection());
      result=measure;
    }
 else {
      input.setName(nameText.getText());
      if (displayNameText.getText().trim().length() > 0) {
        input.setDisplayName(displayNameText.getText().trim());
      }
 else {
        input.setDisplayName(null);
      }
      input.setCalculated(derivedMeasureBtn.getSelection());
      if (derivedMeasureBtn.getSelection()) {
        input.setFunction(null);
      }
 else {
        input.setFunction(getFunctions()[functionCombo.getSelectionIndex()].getName());
      }
      input.setDataType(getDataTypeNames()[typeCombo.getSelectionIndex()]);
      if (expressionText.isEnabled()) {
        ExpressionButtonUtil.saveExpressionButtonControl(expressionText,input,MeasureHandle.MEASURE_EXPRESSION_PROP);
      }
 else       input.setMeasureExpression(null);
      if (!derivedMeasureBtn.getSelection()) {
        if (securityHelper != null) {
          securityHelper.validate();
          input.setExpressionProperty(MeasureHandle.ACL_EXPRESSION_PROP,(Expression)securityHelper.getProperty(BuilderConstants.SECURITY_EXPRESSION_PROPERTY));
        }
      }
 else {
        input.setExpressionProperty(MeasureHandle.ACL_EXPRESSION_PROP,null);
      }
      if (alignmentHelper != null) {
        input.setAlignment((String)alignmentHelper.getProperty(BuilderConstants.ALIGNMENT_VALUE));
      }
      if (formatHelper != null && formatHelper.getProperty(BuilderConstants.FORMAT_VALUE_RESULT) instanceof Object[]) {
        Object[] formatValue=(Object[])formatHelper.getProperty(BuilderConstants.FORMAT_VALUE_RESULT);
        Object value=input.getProperty(Measure.FORMAT_PROP);
        if (value == null) {
          FormatValue formatValueToSet=new FormatValue();
          formatValueToSet.setCategory((String)formatValue[0]);
          formatValueToSet.setPattern((String)formatValue[1]);
          formatValueToSet.setLocale((ULocale)formatValue[2]);
          input.setProperty(Measure.FORMAT_PROP,formatValueToSet);
        }
 else {
          PropertyHandle propHandle=input.getPropertyHandle(Measure.FORMAT_PROP);
          FormatValue formatValueToSet=(FormatValue)value;
          FormatValueHandle formatHandle=(FormatValueHandle)formatValueToSet.getHandle(propHandle);
          formatHandle.setCategory((String)formatValue[0]);
          formatHandle.setPattern((String)formatValue[1]);
          formatHandle.setLocale((ULocale)formatValue[2]);
        }
      }
      input.setVisible(!visibilityBtn.getSelection());
      result=input;
    }
  }
 catch (  SemanticException e) {
    ExceptionUtil.handle(e);
    return;
  }
  super.okPressed();
}