Program: 69240
Project: 69240
Buggy source:
/** 
 * Sets the value of a property. If the mask of a property is "lock", throws one exception. <p> If the mask of this property has been set to "lock", no value will be set. To set the value of a property, the mask value must be "hide" or "change".
 * @param prop definition of the property to set
 * @param value the new property value.
 * @throws SemanticException if the value is invalid or the property mask is "lock".
 */
public void setProperty(ElementPropertyDefn prop,Object value) throws SemanticException {
  checkAllowedOperation();
  if (prop.isElementType()) {
    setElementTypeProperty(prop,value);
    return;
  }
  String propName=prop.getName();
  if ((IReportItemModel.TOC_PROP.equals(propName) || IGroupElementModel.TOC_PROP.equals(propName)) && (value instanceof String)) {
    Structure oldValue=(Structure)element.getLocalProperty(module,prop);
    if (oldValue != null) {
      StructureContext ref=new StructureContext(oldValue,(PropertyDefn)oldValue.getDefn().getMember(TOC.TOC_EXPRESSION),null);
      setMember(ref,value);
      return;
    }
    value=StructureFactory.createTOC((String)value);
  }
  if (IExtendedItemModel.EXTENSION_NAME_PROP.equals(prop.getName()) && element instanceof IExtendedItemModel) {
    throw new PropertyValueException(element,IExtendedItemModel.EXTENSION_NAME_PROP,value,PropertyValueException.DESIGN_EXCEPTION_EXTENSION_SETTING_FORBIDDEN);
  }
  String mask=element.getPropertyMask(module,prop.getName());
  if (DesignChoiceConstants.PROPERTY_MASK_TYPE_LOCK.equalsIgnoreCase(mask)) {
    throw new PropertyValueException(element,prop,value,PropertyValueException.DESIGN_EXCEPTION_VALUE_LOCKED);
  }
  if (element.isVirtualElement() && element instanceof Cell) {
    propName=prop.getName();
    if (ICellModel.COL_SPAN_PROP.equalsIgnoreCase(propName) || ICellModel.ROW_SPAN_PROP.equalsIgnoreCase(propName) || ICellModel.DROP_PROP.equalsIgnoreCase(propName)|| ICellModel.COLUMN_PROP.equalsIgnoreCase(propName)) {
      throw new PropertyValueException(element,prop,value,PropertyValueException.DESIGN_EXCEPTION_PROPERTY_CHANGE_FORBIDDEN);
    }
  }
  if (element instanceof MasterPage) {
    propName=prop.getName();
    if (!((MasterPage)element).isCustomType(module) && (IMasterPageModel.WIDTH_PROP.equals(propName) || IMasterPageModel.HEIGHT_PROP.equals(propName))) {
      throw new SemanticError(element,SemanticError.DESIGN_EXCEPTION_CANNOT_SPECIFY_PAGE_SIZE);
    }
  }
  value=validateCompatibleObject(prop,value);
  if (value instanceof Structure) {
    Structure struct=(Structure)value;
    if (struct.getContext() != null)     value=struct.copy();
  }
  value=validateValue(prop,value);
  if (value instanceof ElementRefValue && prop.getTypeCode() == IPropertyType.ELEMENT_REF_TYPE) {
    checkRecursiveElementReference(prop,(ElementRefValue)value);
    checkDataBindingReference(prop,(ElementRefValue)value);
  }
  if (element instanceof GroupElement && IGroupElementModel.GROUP_NAME_PROP.equals(prop.getName())) {
    if (!isGroupNameValidInContext((String)value))     throw new NameException(element,(String)value,NameException.DESIGN_EXCEPTION_DUPLICATE);
  }
  if (prop.isIntrinsic()) {
    setIntrinsicProperty(prop,value);
    return;
  }
  if (IDesignElementModel.REF_TEMPLATE_PARAMETER_PROP.equals(prop.getName()) && value == null) {
    clearRefTemplateParameterProp(prop,value);
    return;
  }
  if (element instanceof ContentElement) {
    if (!((ContentElement)element).isLocal()) {
      ContentElementCommand attrCmd=new ContentElementCommand(module,element,((ContentElement)element).getValueContainer());
      attrCmd.doSetProperty(prop,value);
      return;
    }
  }
  doSetProperty(prop,value);
}

Fixed version (ground truth):
/** 
 * Sets the value of a property. If the mask of a property is "lock", throws one exception. <p> If the mask of this property has been set to "lock", no value will be set. To set the value of a property, the mask value must be "hide" or "change".
 * @param prop definition of the property to set
 * @param value the new property value.
 * @throws SemanticException if the value is invalid or the property mask is "lock".
 */
public void setProperty(ElementPropertyDefn prop,Object value) throws SemanticException {
  checkAllowedOperation();
  if (prop.isElementType()) {
    setElementTypeProperty(prop,value);
    return;
  }
  String propName=prop.getName();
  if ((IReportItemModel.TOC_PROP.equals(propName) || IGroupElementModel.TOC_PROP.equals(propName)) && (value instanceof String)) {
    Structure oldValue=(Structure)element.getLocalProperty(module,prop);
    if (oldValue != null) {
      StructureContext ref=new StructureContext(oldValue,(PropertyDefn)oldValue.getDefn().getMember(TOC.TOC_EXPRESSION),null);
      setMember(ref,value);
      return;
    }
    value=StructureFactory.createTOC((String)value);
  }
  if (IExtendedItemModel.EXTENSION_NAME_PROP.equals(prop.getName()) && element instanceof IExtendedItemModel) {
    throw new PropertyValueException(element,IExtendedItemModel.EXTENSION_NAME_PROP,value,PropertyValueException.DESIGN_EXCEPTION_EXTENSION_SETTING_FORBIDDEN);
  }
  String mask=element.getPropertyMask(module,prop.getName());
  if (DesignChoiceConstants.PROPERTY_MASK_TYPE_LOCK.equalsIgnoreCase(mask)) {
    throw new PropertyValueException(element,prop,value,PropertyValueException.DESIGN_EXCEPTION_VALUE_LOCKED);
  }
  if (element.isVirtualElement() && element instanceof Cell) {
    propName=prop.getName();
    if (ICellModel.COL_SPAN_PROP.equalsIgnoreCase(propName) || ICellModel.ROW_SPAN_PROP.equalsIgnoreCase(propName) || ICellModel.DROP_PROP.equalsIgnoreCase(propName)|| ICellModel.COLUMN_PROP.equalsIgnoreCase(propName)) {
      throw new PropertyValueException(element,prop,value,PropertyValueException.DESIGN_EXCEPTION_PROPERTY_CHANGE_FORBIDDEN);
    }
  }
  if (element instanceof MasterPage) {
    propName=prop.getName();
    if (!((MasterPage)element).isCustomType(module) && (IMasterPageModel.WIDTH_PROP.equals(propName) || IMasterPageModel.HEIGHT_PROP.equals(propName))) {
      throw new SemanticError(element,SemanticError.DESIGN_EXCEPTION_CANNOT_SPECIFY_PAGE_SIZE);
    }
  }
  value=validateCompatibleObject(prop,value);
  if (value instanceof Structure) {
    Structure struct=(Structure)value;
    if (struct.getContext() != null)     value=struct.copy();
  }
  value=validateValue(prop,value);
  if (value instanceof ElementRefValue && prop.getTypeCode() == IPropertyType.ELEMENT_REF_TYPE) {
    checkRecursiveElementReference(prop,(ElementRefValue)value);
    checkDataBindingReference(prop,(ElementRefValue)value);
  }
  if (element instanceof GroupElement && IGroupElementModel.GROUP_NAME_PROP.equals(prop.getName())) {
    if (!isGroupNameValidInContext((String)value))     throw new NameException(element,(String)value,NameException.DESIGN_EXCEPTION_DUPLICATE);
  }
  if (prop.isIntrinsic()) {
    setIntrinsicProperty(prop,value);
    return;
  }
  if (IDesignElementModel.REF_TEMPLATE_PARAMETER_PROP.equals(prop.getName()) && value == null) {
    clearRefTemplateParameterProp(prop,null);
    return;
  }
  if (element instanceof ContentElement) {
    if (!((ContentElement)element).isLocal()) {
      ContentElementCommand attrCmd=new ContentElementCommand(module,element,((ContentElement)element).getValueContainer());
      attrCmd.doSetProperty(prop,value);
      return;
    }
  }
  doSetProperty(prop,value);
}