nus-yam/ex-repair huggingface dataset:
Program: 78898
Project: 78898
Buggy source:
/** 
 * Gets the property value by the following rule: <li>if the value existed on self, return it.</li> <li>if the value existed on parent, return null, else check the element selector.</li> <li>if the value existed on the self selector, return it.</li>
 */
private Object getFactoryPropertyFromElement(Module module,ElementPropertyDefn prop){
}

Fixed version (ground truth):
/** 
 * Gets the property value by the following rule: <li>if the value existed on self, return it.</li> <li>if the value existed on parent, return null, else check the element selector.</li> <li>if the value existed on the self selector, return it.</li>
 * @param module module
 * @param prop definition of the property to get
 * @return The property value, or null if no value is set.
 */
private Object getFactoryPropertyFromElement(Module module,ElementPropertyDefn prop){
}
Program: 78899
Project: 78899
Buggy source:
/** 
 * Exports the given element.
 * @param elementToExport handle of the element to export.
 * @param canOverride indicates whether the element with the same name in target library will be overriden.
 * @throws SemanticException if error encountered when adding this element to target library or duplicating property value from the given element.
 */
void exportElement(DesignElementHandle elementToExport,boolean canOverride) throws SemanticException {
  if (elementToExport instanceof StyleHandle) {
    exportStyle((StyleHandle)elementToExport,canOverride);
    return;
  }
  if (canOverride) {
    int nameSpaceID=((ElementDefn)elementToExport.getDefn()).getNameSpaceID();
    NameSpace nameSpace=targetLibraryHandle.getModule().getNameSpace(nameSpaceID);
    DesignElement duplicateElement=nameSpace.getElement(elementToExport.getName());
    if (duplicateElement != null)     duplicateElement.getHandle(elementToExport.getModule()).drop();
  }
  DesignElementHandle newElementHandle=duplicateElement(elementToExport,false);
  int slotID=getTopContainerSlot(elementToExport.getElement());
  if (slotID == ReportDesign.BODY_SLOT)   slotID=Module.COMPONENT_SLOT;
 else   if (slotID == Module.PAGE_SLOT && elementToExport.getContainer() != elementToExport.getModuleHandle())   slotID=Module.COMPONENT_SLOT;
  SlotHandle slotHandle=targetLibraryHandle.getSlot(slotID);
  addToSlot(slotHandle,newElementHandle);
}

Fixed version (ground truth):
/** 
 * Exports the given element.
 * @param elementToExport handle of the element to export.
 * @param canOverride indicates whether the element with the same name in target library will be overriden.
 * @throws SemanticException if error encountered when adding this element to target library or duplicating property value from the given element.
 */
void exportElement(DesignElementHandle elementToExport,boolean canOverride) throws SemanticException {
  if (elementToExport instanceof StyleHandle) {
    exportStyle((StyleHandle)elementToExport,canOverride);
    return;
  }
  if (canOverride) {
    int nameSpaceID=((ElementDefn)elementToExport.getDefn()).getNameSpaceID();
    NameSpace nameSpace=targetLibraryHandle.getModule().getNameSpace(nameSpaceID);
    DesignElement duplicateElement=nameSpace.getElement(elementToExport.getName());
    if (duplicateElement != null)     duplicateElement.getHandle(elementToExport.getModule()).drop();
  }
  DesignElementHandle newElementHandle=duplicateElement(elementToExport,false);
  int slotID=getTopContainerSlot(elementToExport.getElement());
  if (slotID == ReportDesign.BODY_SLOT)   slotID=Module.COMPONENT_SLOT;
 else   if (slotID == Module.PAGE_SLOT && elementToExport.getContainer() != elementToExport.getModuleHandle())   slotID=Module.COMPONENT_SLOT;
  if (slotID >= Library.SLOT_COUNT)   return;
  SlotHandle slotHandle=targetLibraryHandle.getSlot(slotID);
  addToSlot(slotHandle,newElementHandle);
}
Program: 78900
Project: 78900
Buggy source:
/** 
 * Exports the given design. The following rules are applied on exporting. <ul> <li>Only properties supported by library are exported. <li>Only top-level element with name are exported. </ul>
 * @param designToExport handle of the report design to export.
 * @throws SemanticException if error encountered when adding this element to target library or duplicating property value from the given element.
 */
void exportDesign(ReportDesignHandle designToExport) throws SemanticException {
  ModelUtil.duplicateProperties(designToExport,targetLibraryHandle,false);
  int slotCount=designToExport.getDefn().getSlotCount();
  for (int i=0; i < slotCount; i++) {
    SlotHandle sourceSlotHandle=designToExport.getSlot(i);
    Iterator iter=sourceSlotHandle.iterator();
    while (iter.hasNext()) {
      DesignElementHandle contentHandle=(DesignElementHandle)iter.next();
      if (!StringUtil.isBlank(contentHandle.getName())) {
        exportElement(contentHandle,false);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Exports the given design. The following rules are applied on exporting. <ul> <li>Only properties supported by library are exported. <li>Only top-level element with name are exported. </ul>
 * @param designToExport handle of the report design to export.
 * @throws SemanticException if error encountered when adding this element to target library or duplicating property value from the given element.
 */
void exportDesign(ReportDesignHandle designToExport) throws SemanticException {
  ModelUtil.duplicateProperties(designToExport,targetLibraryHandle,false);
  int slotCount=designToExport.getDefn().getSlotCount();
  for (int i=0; i < slotCount; i++) {
    SlotHandle sourceSlotHandle=designToExport.getSlot(i);
    Iterator iter=sourceSlotHandle.iterator();
    while (iter.hasNext()) {
      DesignElementHandle contentHandle=(DesignElementHandle)iter.next();
      if (!StringUtil.isBlank(contentHandle.getName()))       exportElement(contentHandle,false);
    }
  }
}
Program: 78901
Project: 78901
Buggy source:
/** 
 * Checks whether the element to insert can reside in the given module.
 * @param module the root module of the element to add
 * @param slotID the slot ID to insert
 * @param defn the definition of element to insert
 * @return false if the module is a library and the element to insert is atemplate element or its content is a template element; or the container is report design and slot is component slot and the element to insert is a template element or its content is a template element; otherwise true
 */
private boolean canContainTemplateElement(Module module,int slotID,IElementDefn defn){
  if (defn != null && defn.isKindOf(MetaDataDictionary.getInstance().getElement(ReportDesignConstants.TEMPLATE_ELEMENT))) {
    DesignElement container=this;
    int slot=slotID;
    while (container != null) {
      if ((container instanceof Module && slot == Module.COMPONENT_SLOT) || container instanceof Library)       return false;
      slot=container.getContainerSlot();
      container=container.getContainer();
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Checks whether the element to insert can reside in the given module.
 * @param module the root module of the element to add
 * @param slotID the slot ID to insert
 * @param defn the definition of element to insert
 * @return false if the module is a library and the element to insert is atemplate element or its content is a template element; or the container is report design and slot is component slot and the element to insert is a template element or its content is a template element; otherwise true
 */
private boolean canContainTemplateElement(Module module,int slotID,IElementDefn defn){
  if (defn != null && defn.isKindOf(MetaDataDictionary.getInstance().getElement(ReportDesignConstants.TEMPLATE_ELEMENT))) {
    DesignElement container=this;
    int slot=slotID;
    while (container != null) {
      if ((container instanceof Module && slot == Module.COMPONENT_SLOT) || container instanceof Library)       return false;
      slot=container.getContainerSlot();
      container=container.getContainer();
    }
    if (module instanceof Library)     return false;
  }
  return true;
}
Program: 78902
Project: 78902
Buggy source:
/** 
 * Checks whether a property is visible in the property sheet. The visible property is visible in all <code>elements</code>.
 * @param propName the property name
 * @return <code>true</code> if it is visible. Otherwise<code>false</code>.
 */
protected boolean isPropertyVisible(String propName){
  boolean isVisible=true;
  for (int i=0; i < elements.size(); i++) {
    IElementDefn elementDefn=((DesignElementHandle)elements.get(i)).getDefn();
    if (!elementDefn.isPropertyVisible(propName)) {
      isVisible=false;
      break;
    }
  }
  return isVisible;
}

Fixed version (ground truth):
/** 
 * Checks whether a property is visible in the property sheet. The visible property is visible in all <code>elements</code>.
 * @param propName the property name
 * @return <code>true</code> if it is visible. Otherwise<code>false</code>.
 */
protected boolean isPropertyVisible(String propName){
  boolean isVisible=true;
  for (int i=0; i < elements.size(); i++) {
    PropertyHandle propertyHandle=((DesignElementHandle)elements.get(i)).getPropertyHandle(propName);
    if (propertyHandle != null && !propertyHandle.isVisible() || propertyHandle == null) {
      isVisible=false;
      break;
    }
  }
  return isVisible;
}
Program: 78903
Project: 78903
Buggy source:
/** 
 * Checks whether a property is read-only in the property sheet. The visible property is read-only in all <code>elements</code>.
 * @param propName the property name
 * @return <code>true</code> if it is read-only. Otherwise<code>false</code>.
 */
protected boolean isPropertyReadOnly(String propName){
  boolean isReadOnly=false;
  for (int i=0; i < elements.size(); i++) {
    PropertyHandle propertyHandle=((DesignElementHandle)elements.get(i)).getPropertyHandle(propName);
    if (propertyHandle != null && propertyHandle.isReadOnly()) {
      isReadOnly=true;
      break;
    }
  }
  return isReadOnly;
}

Fixed version (ground truth):
/** 
 * Checks whether a property is read-only in the property sheet. The visible property is read-only in all <code>elements</code>.
 * @param propName the property name
 * @return <code>true</code> if it is read-only. Otherwise<code>false</code>.
 */
protected boolean isPropertyReadOnly(String propName){
  boolean isReadOnly=false;
  for (int i=0; i < elements.size(); i++) {
    PropertyHandle propertyHandle=((DesignElementHandle)elements.get(i)).getPropertyHandle(propName);
    if (propertyHandle != null && propertyHandle.isReadOnly() || propertyHandle == null) {
      isReadOnly=true;
      break;
    }
  }
  return isReadOnly;
}
Program: 78904
Project: 78904
Buggy source:
public boolean isVisible(){
  IElementDefn elementDefn=getElementHandle().getDefn();
  return elementDefn.isPropertyVisible(propDefn.getName());
}

Fixed version (ground truth):
public boolean isVisible(){
  IElementDefn elementDefn=getElementHandle().getDefn();
  if (elementDefn.isPropertyVisible(propDefn.getName()))   return true;
  if (propDefn.isUserProperty())   return true;
  return false;
}
Program: 78905
Project: 78905
Buggy source:
/** 
 * Gets the choice set of one property
 * @param item ReportItem object
 * @param key Property key
 * @return Choice set
 */
public String[] getChoiceSet(Object item,String key){
  if (key.equals(FilterCondition.OPERATOR_MEMBER)) {
    choiceSet=ChoiceSetFactory.getStructChoiceSet(FilterCondition.FILTER_COND_STRUCT,key);
    return ChoiceSetFactory.getDisplayNamefromChoiceSet(choiceSet);
  }
  if (!(item instanceof ReportItemHandle))   return EMPTY;
  return getDataSetColumns((ReportItemHandle)item);
}

Fixed version (ground truth):
/** 
 * Gets the choice set of one property
 * @param item ReportItem object
 * @param key Property key
 * @return Choice set
 */
public String[] getChoiceSet(Object item,String key){
  if (key.equals(FilterCondition.OPERATOR_MEMBER)) {
    choiceSet=ChoiceSetFactory.getStructChoiceSet(FilterCondition.FILTER_COND_STRUCT,key);
    return ChoiceSetFactory.getDisplayNamefromChoiceSet(choiceSet);
  }
  if (item instanceof GroupHandle) {
    item=((GroupHandle)item).getContainer();
  }
  if (!(item instanceof ReportItemHandle))   return EMPTY;
  return getDataSetColumns((ReportItemHandle)item);
}
Program: 78906
Project: 78906
Buggy source:
/** 
 * Gets the choice set of one property
 * @param item ReportItem object
 * @param key Property key
 * @return Choice set
 */
public String[] getChoiceSet(Object item,String key){
  if (key.equals(SortKey.DIRECTION_MEMBER)) {
    choiceSet=ChoiceSetFactory.getStructChoiceSet(SortKey.SORT_STRUCT,key);
    return ChoiceSetFactory.getDisplayNamefromChoiceSet(choiceSet);
  }
  if (!(item instanceof ReportItemHandle))   return EMPTY;
  return getDataSetColumns((ReportItemHandle)item);
}

Fixed version (ground truth):
/** 
 * Gets the choice set of one property
 * @param item ReportItem object
 * @param key Property key
 * @return Choice set
 */
public String[] getChoiceSet(Object item,String key){
  if (key.equals(SortKey.DIRECTION_MEMBER)) {
    choiceSet=ChoiceSetFactory.getStructChoiceSet(SortKey.SORT_STRUCT,key);
    return ChoiceSetFactory.getDisplayNamefromChoiceSet(choiceSet);
  }
  if (item instanceof GroupHandle) {
    item=((GroupHandle)item).getContainer();
  }
  if (!(item instanceof ReportItemHandle)) {
    return EMPTY;
  }
  return getDataSetColumns((ReportItemHandle)item);
}
Program: 78907
Project: 78907
Buggy source:
/** 
 * Insert a text string into the text area
 * @param text
 */
protected void insertText(String text){
  StyledText textWidget=sourceViewer.getTextWidget();
  if (!textWidget.isEnabled()) {
    return;
  }
  int selectionStart=textWidget.getSelection().x;
  StringBuffer insertText=new StringBuffer();
  for (int index; (index=text.indexOf("String_Node_Str")) != -1; ) {
    insertText.append(text.substring(0,index));
    if (index == text.length() - 1) {
      insertText.append(textWidget.getSelectionText());
      text="String_Node_Str";
    }
 else     if (text.charAt(index + 1) != '@') {
      insertText.append(textWidget.getSelectionText());
      text=text.substring(index + 1);
    }
 else {
      insertText.append("String_Node_Str");
      text=text.substring(index + 2);
    }
  }
  insertText.append(text);
  text=insertText.toString();
  textWidget.insert(text);
  textWidget.setSelection(selectionStart + text.length());
  textWidget.setFocus();
  if (text.endsWith("String_Node_Str")) {
    textWidget.setCaretOffset(textWidget.getCaretOffset() - 1);
  }
}

Fixed version (ground truth):
/** 
 * Insert a text string into the text area
 * @param text
 */
protected void insertText(String text){
  StyledText textWidget=sourceViewer.getTextWidget();
  if (!textWidget.isEnabled()) {
    return;
  }
  int selectionStart=textWidget.getSelection().x;
  textWidget.insert(text);
  textWidget.setSelection(selectionStart + text.length());
  textWidget.setFocus();
  if (text.endsWith("String_Node_Str")) {
    textWidget.setCaretOffset(textWidget.getCaretOffset() - 1);
  }
}
Program: 78908
Project: 78908
Buggy source:
protected void okPressed(){
  UserPropertyDefn def=new UserPropertyDefn();
  def.setName(nameEditor.getText().trim());
switch (style) {
case USER_PROPERTY:
    def.setType(PROPERTY_TYPES[typeChooser.getSelectionIndex()]);
  break;
case NAMED_EXPRESSION:
def.setType(EXPRESSION_TYPE);
break;
}
setResult(def);
super.okPressed();
}

Fixed version (ground truth):
protected void okPressed(){
  UserPropertyDefn def=new UserPropertyDefn();
  def.setName(nameEditor.getText().trim());
switch (style) {
case USER_PROPERTY:
    def.setType(PROPERTY_TYPES[typeChooser.getSelectionIndex()]);
  break;
case NAMED_EXPRESSION:
def.setType(EXPRESSION_TYPE);
def.setDefault(UIUtil.convertToModelString(defaultValueEditor.getText(),false));
break;
}
setResult(def);
super.okPressed();
}
Program: 78909
Project: 78909
Buggy source:
public boolean equals(Object obj){
  if (obj instanceof ElementRefValue) {
    ElementRefValue value=(ElementRefValue)obj;
    if (this.isResolved() == value.isResolved()) {
      if (value.isResolved()) {
        return getElement().equals(value.getElement());
      }
      return getLibraryNamespace().equals(value.getLibraryNamespace()) && getName().equals(value.getName());
    }
    return false;
  }
  return false;
}

Fixed version (ground truth):
public boolean equals(Object obj){
  if (!(obj instanceof ElementRefValue))   return false;
  ElementRefValue value=(ElementRefValue)obj;
  if (isResolved() != value.isResolved())   return false;
  if (value.isResolved())   return getElement().equals(value.getElement());
  if (!getName().equals(value.getName()))   return false;
  String myNameSpace=getLibraryNamespace();
  String objNameSpace=value.getLibraryNamespace();
  if (myNameSpace == null && objNameSpace == null)   return true;
  if (myNameSpace != null && myNameSpace.equals(objNameSpace))   return true;
  return false;
}
Program: 78910
Project: 78910
Buggy source:
/** 
 * Returns the name of the user-defined property.
 * @return the name of the user-defined property
 */
public String getName(){
  return getDefn().getName();
}

Fixed version (ground truth):
/** 
 * Returns the name of the user-defined property.
 * @return the name of the user-defined property
 */
public String getName(){
  return propDefn.getName();
}
Program: 78911
Project: 78911
Buggy source:
/** 
 * Returns the type of the user-defined property.
 * @return the type of the user-defined property
 * @see org.eclipse.birt.report.model.metadata.PropertyType
 */
public int getType(){
  return getDefn().getTypeCode();
}

Fixed version (ground truth):
/** 
 * Returns the type of the user-defined property.
 * @return the type of the user-defined property
 * @see org.eclipse.birt.report.model.metadata.PropertyType
 */
public int getType(){
  return propDefn.getTypeCode();
}
Program: 78912
Project: 78912
Buggy source:
/** 
 * Returns the display name of the user-defined property.
 * @return the display name of the user-defined property
 */
public String getDisplayName(){
  return getDefn().getDisplayName();
}

Fixed version (ground truth):
/** 
 * Returns the display name of the user-defined property.
 * @return the display name of the user-defined property
 */
public String getDisplayName(){
  return propDefn.getDisplayName();
}
Program: 78913
Project: 78913
Buggy source:
/** 
 * Returns the copy of the property definition for this user-defined property.
 * @return the copy of the property definition
 */
public UserPropertyDefn getCopy(){
  UserPropertyDefn prop=(UserPropertyDefn)((UserPropertyDefn)getDefn()).copy();
  return prop;
}

Fixed version (ground truth):
/** 
 * Returns the copy of the property definition for this user-defined property.
 * @return the copy of the property definition
 */
public UserPropertyDefn getCopy(){
  UserPropertyDefn prop=(UserPropertyDefn)(propDefn).copy();
  return prop;
}
Program: 78914
Project: 78914
Buggy source:
/** 
 * Sets the definition for the user-defined property.
 * @param prop the new definition of the user-defined property
 * @throws UserPropertyException if the property is not found, is not a user property, or is not defined on this element, or the user property definition is inconsistent.
 * @throws PropertyValueException if the type changes, the value becomes invalid.
 */
public void setUserPropertyDefn(UserPropertyDefn prop) throws UserPropertyException, PropertyValueException {
  UserPropertyCommand cmd=new UserPropertyCommand(elementHandle.getModule(),getElement());
  cmd.setPropertyDefn((UserPropertyDefn)getDefn(),prop);
}

Fixed version (ground truth):
/** 
 * Sets the definition for the user-defined property.
 * @param prop the new definition of the user-defined property
 * @throws UserPropertyException if the property is not found, is not a user property, or is not defined on this element, or the user property definition is inconsistent.
 * @throws PropertyValueException if the type changes, the value becomes invalid.
 */
public void setUserPropertyDefn(UserPropertyDefn prop) throws UserPropertyException, PropertyValueException {
  UserPropertyCommand cmd=new UserPropertyCommand(elementHandle.getModule(),getElement());
  cmd.setPropertyDefn(propDefn,prop);
}
Program: 78915
Project: 78915
Buggy source:
/** 
 * Constructs a handle for the user-defined property with the given element handle and the name of the user-defined property.
 * @param element a handle to a report element
 * @param propName The name of the user-defined property.
 */
public UserPropertyDefnHandle(DesignElementHandle element,String propName){
  super(element,propName);
}

Fixed version (ground truth):
/** 
 * Constructs a handle for the user-defined property with the given element handle and the name of the user-defined property.
 * @param element a handle to a report element
 * @param propName The name of the user-defined property.
 */
public UserPropertyDefnHandle(DesignElementHandle element,String propName){
  super(element);
  propDefn=element.getElement().getUserPropertyDefn(propName);
  if (propDefn == null)   throw new IllegalArgumentException("String_Node_Str" + propName + "String_Node_Str");
}
Program: 78916
Project: 78916
Buggy source:
public String getLocalizedMessage(){
  if (sResourceKey == DESIGN_EXCEPTION_NOT_FOUND || sResourceKey == DESIGN_EXCEPTION_DUPLICATE_NAME || sResourceKey == DESIGN_EXCEPTION_INVALID_DISPLAY_ID || sResourceKey == DESIGN_EXCEPTION_CHOICE_NAME_REQUIRED || sResourceKey == DESIGN_EXCEPTION_CHOICE_VALUE_REQUIRED || sResourceKey == DESIGN_EXCEPTION_INVALID_CHOICE_VALUE) {
    return ModelMessages.getMessage(sResourceKey,new String[]{propertyName});
  }
 else   if (sResourceKey == DESIGN_EXCEPTION_USER_PROP_DISALLOWED) {
    return ModelMessages.getMessage(sResourceKey,new String[]{getElementName(element)});
  }
  return ModelMessages.getMessage(sResourceKey);
}

Fixed version (ground truth):
public String getLocalizedMessage(){
}
Program: 78917
Project: 78917
Buggy source:
/** 
 * Constructor.
 * @param obj the element to be changed
 * @param name the name of the user property
 * @param errCode the error code
 * @param cause the nested exception
 */
public UserPropertyException(DesignElement obj,String name,String errCode,MetaDataException cause){
  super(obj,errCode,cause);
  propertyName=name;
}

Fixed version (ground truth):
/** 
 * Constructor.
 * @param obj the element to be changed
 * @param name the name of the user property
 * @param errCode the error code
 * @param cause the nested exception
 * @param args argument array used for error message
 */
public UserPropertyException(DesignElement obj,String name,String errCode,ModelException cause,String[] args){
  super(obj,args,errCode,cause);
  propertyName=name;
}
Program: 78918
Project: 78918
Buggy source:
/** 
 * Gets valid types for user property. Each one in the list is an instance of <code>IPropertyType</code>.
 * @return the list of allowed property types for user property.
 */
public static List getAllowedTypes(){
  if (allowedTypes != null)   return allowedTypes;
  allowedTypes=new ArrayList();
  Iterator iter=MetaDataDictionary.getInstance().getPropertyTypes().iterator();
  while (iter.hasNext()) {
    PropertyType propType=(PropertyType)iter.next();
    if (propType instanceof StructPropertyType || propType instanceof StructRefPropertyType || propType instanceof ElementRefPropertyType|| propType instanceof ExtendsPropertyType)     continue;
    allowedTypes.add(propType);
  }
  return allowedTypes;
}

Fixed version (ground truth):
/** 
 * Gets valid types for user property. Each one in the list is an instance of <code>IPropertyType</code>.
 * @return the list of allowed property types for user property.
 */
public static List getAllowedTypes(){
  if (allowedTypes != null)   return allowedTypes;
  allowedTypes=new ArrayList();
  Iterator iter=MetaDataDictionary.getInstance().getPropertyTypes().iterator();
  while (iter.hasNext()) {
    PropertyType propType=(PropertyType)iter.next();
    int type=propType.getTypeCode();
switch (type) {
case PropertyType.STRUCT_TYPE:
case PropertyType.STRUCT_REF_TYPE:
case PropertyType.ELEMENT_REF_TYPE:
case PropertyType.EXTENDS_TYPE:
      break;
default :
    allowedTypes.add(propType);
}
}
return allowedTypes;
}
Program: 78921
Project: 78921
Buggy source:
/** 
 * Determines if this element is editable or not. If the element comes from a library, it can not be edited in the report design.
 * @return true if it can be edited. false if it can't.
 */
public boolean canEdit(){
  boolean canEdit=true;
  if ((getRoot() != null) && (getRoot().getElement() != getModule()))   canEdit=false;
  return canEdit;
}

Fixed version (ground truth):
/** 
 * Determines if this element is editable or not. If the element comes from a library, it can not be edited in the report design.
 * @return true if it can be edited. false if it can't.
 */
public boolean canEdit(){
}
Program: 78922
Project: 78922
Buggy source:
public boolean isReadOnly(){
  IElementDefn elementDefn=getElementHandle().getDefn();
  return elementDefn.isPropertyReadOnly(propDefn.getName());
}

Fixed version (ground truth):
public boolean isReadOnly(){
}
Program: 78925
Project: 78925
Buggy source:
/** 
 * Checks whether a property is read-only in the property sheet. The visible property is read-only in all <code>elements</code>.
 * @param propName the property name
 * @return <code>true</code> if it is read-only. Otherwise<code>false</code>.
 */
protected boolean isPropertyReadOnly(String propName){
  boolean isReadOnly=false;
  for (int i=0; i < elements.size(); i++) {
    IElementDefn elementDefn=((DesignElementHandle)elements.get(i)).getDefn();
    if (elementDefn.isPropertyReadOnly(propName)) {
      isReadOnly=true;
      break;
    }
  }
  return isReadOnly;
}

Fixed version (ground truth):
/** 
 * Checks whether a property is read-only in the property sheet. The visible property is read-only in all <code>elements</code>.
 * @param propName the property name
 * @return <code>true</code> if it is read-only. Otherwise<code>false</code>.
 */
protected boolean isPropertyReadOnly(String propName){
  boolean isReadOnly=false;
  for (int i=0; i < elements.size(); i++) {
    PropertyHandle propertyHandle=((DesignElementHandle)elements.get(i)).getPropertyHandle(propName);
    if (propertyHandle != null && propertyHandle.isReadOnly()) {
      isReadOnly=true;
      break;
    }
  }
  return isReadOnly;
}
Program: 78926
Project: 78926
Buggy source:
protected List getPostTasks(){
  List retValue=new ArrayList();
  retValue.addAll(super.getPostTasks());
  if (container instanceof TableItem || container instanceof TableGroup || container instanceof TableRow) {
    TableItem table=LayoutUtil.getTableContainer(container);
    if (table != null)     retValue.add(new LayoutActivityTask(module,table));
  }
  NotificationEvent event=null;
  event=getContainerEvent();
  retValue.add(new NotificationRecordTask(container,event));
  if (state != UNDONE_STATE) {
    if (isSelector(newElement))     retValue.add(new NotificationRecordTask(newElement,event,container.getRoot()));
  }
 else {
    if (isSelector(oldElement))     retValue.add(new NotificationRecordTask(oldElement,event,container.getRoot()));
  }
  if (state != UNDONE_STATE) {
    event=new ElementDeletedEvent(container,oldElement);
    retValue.add(new NotificationRecordTask(oldElement,event,container.getRoot()));
  }
 else {
    event=new ElementDeletedEvent(container,newElement);
    retValue.add(new NotificationRecordTask(newElement,event,container.getRoot()));
  }
  if (state == DONE_STATE)   event.setSender(sender);
  return retValue;
}

Fixed version (ground truth):
protected List getPostTasks(){
  List retValue=new ArrayList();
  retValue.addAll(super.getPostTasks());
  if (container instanceof TableItem || container instanceof TableGroup || container instanceof TableRow) {
    TableItem table=LayoutUtil.getTableContainer(container);
    if (table != null)     retValue.add(new LayoutActivityTask(module,table));
  }
  NotificationEvent event=null;
  event=getContainerEvent();
  retValue.add(new NotificationRecordTask(container,event));
  if (state != UNDONE_STATE) {
    if (isSelector(newElement))     retValue.add(new NotificationRecordTask(newElement,event,container.getRoot()));
  }
 else {
    if (isSelector(oldElement))     retValue.add(new NotificationRecordTask(oldElement,event,container.getRoot()));
  }
  return retValue;
}
Program: 78927
Project: 78927
Buggy source:
/** 
 * Performs a semantic check of this element, and all its contained elements. Records errors in the module context. <p> Checks the contents of this element.
 * @param module the module information needed for the check, and records any errors
 */
public final void semanticCheck(Module module){
  allExceptions=validateWithContents(module);
}

Fixed version (ground truth):
/** 
 * Performs a semantic check of this element, and all its contained elements. Records errors in the module context. <p> Checks the contents of this element.
 * @param module the module information needed for the check, and records any errors
 */
public final void semanticCheck(Module module){
}
Program: 78928
Project: 78928
Buggy source:
public void setWordSpacing(String wordSpacing) throws DOMException {
}

Fixed version (ground truth):
public void setWordSpacing(String wordSpacing) throws DOMException {
  setCssText(STYLE_WORD_SPACING,wordSpacing);
}
Program: 78931
Project: 78931
Buggy source:
public Element popParent(){
  Element popElement=(Element)parentStack.pop();
  if (!parentStack.isEmpty())   currentParent=(Element)parentStack.peek();
  return popElement;
}

Fixed version (ground truth):
public Element popParent(){
  Element popElement=null;
  if (!parentStack.isEmpty())   popElement=(Element)parentStack.pop();
  if (!parentStack.isEmpty())   currentParent=(Element)parentStack.peek();
  return popElement;
}
Program: 78934
Project: 78934
Buggy source:
/** 
 * Creates the context menu
 * @param sourceViewer the source viewer
 * @param object the object
 * @param menu the menu
 */
public void createContextMenu(TreeViewer sourceViewer,Object object,IMenuManager menu){
  menu.add(new Separator());
  InsertInLayoutAction insertAction=new InsertInLayoutAction(object);
  if (insertAction.isTypeAvailable()) {
    menu.add(insertAction);
  }
  menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
  RenameAction renameAction=new RenameAction(sourceViewer);
  if (renameAction.isEnabled()) {
    menu.add(renameAction);
  }
  DeleteAction deleteAction=new DeleteAction(object);
  if (deleteAction.isEnabled()) {
    menu.add(deleteAction);
  }
  CutAction cutAction=new CutAction(object);
  if (cutAction.isEnabled())   menu.add(cutAction);
  CopyAction copyAction=new CopyAction(object);
  if (copyAction.isEnabled())   menu.add(copyAction);
  menu.add(new PasteAction(object));
  menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS + "String_Node_Str"));
  Action action=new CodePageAction(object);
  if (action.isEnabled())   menu.add(action);
  menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS + "String_Node_Str"));
  action=new ExportToLibraryAction(object);
  if (action.isEnabled())   menu.add(action);
}

Fixed version (ground truth):
/** 
 * Creates the context menu
 * @param sourceViewer the source viewer
 * @param object the object
 * @param menu the menu
 */
public void createContextMenu(TreeViewer sourceViewer,Object object,IMenuManager menu){
  menu.add(new Separator());
  InsertInLayoutAction insertAction=new InsertInLayoutAction(object);
  if (insertAction.isTypeAvailable()) {
    menu.add(insertAction);
  }
  menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
  RenameAction renameAction=new RenameAction(sourceViewer);
  if (renameAction.isEnabled()) {
    menu.add(renameAction);
  }
  DeleteAction deleteAction=new DeleteAction(object);
  if (deleteAction.isEnabled()) {
    menu.add(deleteAction);
  }
  CutAction cutAction=new CutAction(object);
  if (cutAction.isEnabled())   menu.add(cutAction);
  CopyAction copyAction=new CopyAction(object);
  if (copyAction.isEnabled())   menu.add(copyAction);
  menu.add(new PasteAction(object));
  menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS + "String_Node_Str"));
  Action action=new CodePageAction(object);
  if (action.isEnabled())   menu.add(action);
  menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS + "String_Node_Str"));
  action=new ExportToLibraryAction(object);
  if (object instanceof ReportDesignHandle || (object instanceof ReportElementHandle && !(((ReportElementHandle)object).getRoot() instanceof LibraryHandle)))   menu.add(action);
}
Program: 78935
Project: 78935
Buggy source:
public boolean isEnabled(){
  if (getSelection() instanceof ReportElementHandle)   return ((ReportElementHandle)getSelection()).getName() != null;
  return false;
}

Fixed version (ground truth):
public boolean isEnabled(){
  if (getSelection() instanceof ReportDesignHandle)   return true;
 else   if (getSelection() instanceof ReportElementHandle)   return ((ReportElementHandle)getSelection()).getName() != null;
  return false;
}
Program: 78937
Project: 78937
Buggy source:
protected void perform(boolean undo){
  if (undo) {
    unresolveStyles(newTheme);
    if (oldTheme instanceof String)     module.setThemeName((String)oldTheme);
 else     module.setTheme((Theme)oldTheme);
  }
 else {
    unresolveStyles(oldTheme);
    module.setTheme(newTheme);
  }
}

Fixed version (ground truth):
protected void perform(boolean undo){
  if (undo) {
    if (oldTheme instanceof String)     module.setThemeName((String)oldTheme);
 else     module.setTheme((Theme)oldTheme);
    updateStyles(newTheme);
  }
 else {
    module.setTheme(newTheme);
    updateStyles(oldTheme);
  }
}
Program: 78938
Project: 78938
Buggy source:
/** 
 * Updates the element reference which refers to the given referenceable element.
 * @param referred the element whose element references are updated
 */
public void updateClientReferences(ReferenceableElement referred){
  List clients=referred.getClientList();
  Iterator iter=clients.iterator();
  while (iter.hasNext()) {
    BackRef ref=(BackRef)iter.next();
    DesignElement client=ref.element;
    ElementRefValue value=(ElementRefValue)client.getLocalProperty(this,ref.propName);
    value.unresolved(value.getName());
    referred.dropClient(client);
    client.resolveElementReference(this,client.getPropertyDefn(ref.propName));
  }
}

Fixed version (ground truth):
/** 
 * Updates the element reference which refers to the given referenceable element.
 * @param referred the element whose element references are updated
 */
public void updateClientReferences(ReferenceableElement referred){
  List clients=referred.getClientList();
  Iterator iter=clients.iterator();
  while (iter.hasNext()) {
    BackRef ref=(BackRef)iter.next();
    DesignElement client=ref.element;
    ElementRefValue value=(ElementRefValue)client.getLocalProperty(this,ref.propName);
    value.unresolved(value.getName());
    referred.dropClient(client);
    if (IStyledElementModel.STYLE_PROP.equalsIgnoreCase(ref.propName))     client.broadcast(new StyleEvent(client));
 else     client.resolveElementReference(this,client.getPropertyDefn(ref.propName));
  }
}
Program: 78940
Project: 78940
Buggy source:
/** 
 * Returns the object can be deleted. If the parent can be deleted, the children will be skippedl
 * @param source single or multiple objects
 */
protected boolean canDrop(Object source){
  if (source == null) {
    return false;
  }
  if (source instanceof StructuredSelection) {
    return canDrop(((StructuredSelection)source).toArray());
  }
  if (source instanceof Object[]) {
    Object[] array=(Object[])source;
    if (array.length == 0) {
      return false;
    }
    for (int i=0; i < array.length; i++) {
      if (DNDUtil.checkContainerExists(array[i],array))       continue;
      if (canDrop(array[i]))       return true;
    }
    return false;
  }
  source=DNDUtil.unwrapToModel(source);
  if (source instanceof SlotHandle) {
    SlotHandle slot=(SlotHandle)source;
    DesignElementHandle handle=slot.getElementHandle();
    return slot.getContents().size() > 0 && ((handle instanceof ListHandle && ((ListHandle)handle).canDrop() || (handle instanceof ListGroupHandle) && ((ListGroupHandle)handle).canDrop())) && canDrop(slot.getContents());
  }
  if (source instanceof EmbeddedImageHandle) {
    return true;
  }
  if (source instanceof CellHandle) {
    return ((CellHandle)source).getContent().getContents().size() > 0 && ((CellHandle)source).canDrop();
  }
  if (source instanceof MasterPageHandle) {
    return false;
  }
 else   if (source instanceof ReportElementHandle) {
    return ((ReportElementHandle)source).canDrop();
  }
 else   return false;
}

Fixed version (ground truth):
/** 
 * Returns the object can be deleted. If the parent can be deleted, the children will be skippedl
 * @param source single or multiple objects
 */
protected boolean canDrop(Object source){
  if (source == null) {
    return false;
  }
  if (source instanceof List) {
    return canDrop(((List)source).toArray());
  }
  if (source instanceof StructuredSelection) {
    return canDrop(((StructuredSelection)source).toArray());
  }
  if (source instanceof Object[]) {
    Object[] array=(Object[])source;
    if (array.length == 0) {
      return false;
    }
    for (int i=0; i < array.length; i++) {
      if (DNDUtil.checkContainerExists(array[i],array))       continue;
      if (canDrop(array[i]))       return true;
    }
    return false;
  }
  source=DNDUtil.unwrapToModel(source);
  if (source instanceof SlotHandle) {
    SlotHandle slot=(SlotHandle)source;
    DesignElementHandle handle=slot.getElementHandle();
    return slot.getContents().size() > 0 && ((handle instanceof ListHandle && ((ListHandle)handle).canDrop()) || (handle instanceof ListGroupHandle && ((ListGroupHandle)handle).canDrop())) && canDrop(slot.getContents());
  }
  if (source instanceof EmbeddedImageHandle) {
    return true;
  }
  if (source instanceof CellHandle) {
    return ((CellHandle)source).getContent().getContents().size() > 0 && ((CellHandle)source).canDrop();
  }
  if (source instanceof MasterPageHandle) {
    return false;
  }
 else   if (source instanceof ReportElementHandle) {
    return ((ReportElementHandle)source).canDrop();
  }
 else   return false;
}
Program: 78941
Project: 78941
Buggy source:
public void selectionChanged(IAction action,ISelection selection){
  IEditorPart editor=UIUtil.getActiveEditor(true);
  action.setEnabled(editor.getEditorInput().getName().endsWith("String_Node_Str"));
}

Fixed version (ground truth):
public void selectionChanged(IAction action,ISelection selection){
  action.setEnabled(isEnable());
}
Program: 78943
Project: 78943
Buggy source:
/** 
 * Creates a new extended item.
 * @param name the optional extended item name. Can be <code>null</code>.
 * @param extensionName the required extension name
 * @return a handle to extended item, return <code>null</code> if thedefinition with the given extension name is not found
 */
public ExtendedItemHandle newExtendedItem(String name,String extensionName){
}

Fixed version (ground truth):
/** 
 * Creates a new extended item which extends from a given parent.
 * @param name the optional extended item name. Can be <code>null</code>.
 * @param extensionName the required extension name
 * @param parent a given parent element.
 * @return a handle to extended item, return <code>null</code> if thedefinition with the given extension name is not found
 * @throws ExtendsException
 */
private ExtendedItemHandle newExtendedItem(String name,String extensionName,ExtendedItemHandle parent) throws ExtendsException {
}
Program: 78945
Project: 78945
Buggy source:
private void switchToURI(){
  new Label(displayArea,SWT.NONE).setText(LABEL_LOCATION);
  locationEditor=new Text(displayArea,SWT.BORDER | SWT.SINGLE);
  locationEditor.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  locationEditor.addModifyListener(new ModifyListener(){
    public void modifyText(    ModifyEvent e){
      updateButtons();
    }
  }
);
  Composite buttonArea=new Composite(displayArea,SWT.NONE);
  buttonArea.setLayout(UIUtil.createGridLayoutWithoutMargin(2,true));
  buttonArea.setLayoutData(new GridData());
  createBrowerButton(buttonArea,locationEditor,true);
  createExpressionButton(buttonArea,locationEditor);
  createTargetBar();
}

Fixed version (ground truth):
private void switchToURI(){
  new Label(displayArea,SWT.NONE).setText(LABEL_LOCATION);
  locationEditor=new Text(displayArea,SWT.BORDER | SWT.SINGLE);
  locationEditor.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  locationEditor.addModifyListener(new ModifyListener(){
    public void modifyText(    ModifyEvent e){
      updateButtons();
    }
  }
);
  Composite buttonArea=new Composite(displayArea,SWT.NONE);
  buttonArea.setLayout(UIUtil.createGridLayoutWithoutMargin(2,true));
  buttonArea.setLayoutData(new GridData());
  createBrowerButton(buttonArea,locationEditor,true,false);
  createExpressionButton(buttonArea,locationEditor);
  createTargetBar();
}
Program: 78946
Project: 78946
Buggy source:
public HyperlinkBuilder(String title){
  super(title);
}

Fixed version (ground truth):
public HyperlinkBuilder(Shell parentShell){
  super(parentShell,"String_Node_Str");
}
Program: 78947
Project: 78947
Buggy source:
private void switchToDrillthrough(){
  new Label(displayArea,SWT.NONE).setText(LABEL_REPORT);
  locationEditor=new Text(displayArea,SWT.BORDER | SWT.SINGLE);
  locationEditor.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  locationEditor.addModifyListener(new ModifyListener(){
    public void modifyText(    ModifyEvent e){
      initParamterBindings();
      updateButtons();
    }
  }
);
  createBrowerButton(displayArea,locationEditor,false);
  UIUtil.createBlankLabel(displayArea);
  messageLine=new CLabel(displayArea,SWT.NONE);
  GridData gd=new GridData(GridData.FILL_HORIZONTAL);
  gd.horizontalSpan=2;
  messageLine.setLayoutData(gd);
  createBindingTable();
  createBookmarkBar();
  createTargetBar();
  createFormatBar();
}

Fixed version (ground truth):
private void switchToDrillthrough(){
  new Label(displayArea,SWT.NONE).setText(LABEL_REPORT);
  locationEditor=new Text(displayArea,SWT.BORDER | SWT.SINGLE);
  locationEditor.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  locationEditor.addModifyListener(new ModifyListener(){
    public void modifyText(    ModifyEvent e){
      initParamterBindings();
      updateButtons();
    }
  }
);
  createBrowerButton(displayArea,locationEditor,false,true);
  UIUtil.createBlankLabel(displayArea);
  messageLine=new CLabel(displayArea,SWT.NONE);
  GridData gd=new GridData(GridData.FILL_HORIZONTAL);
  gd.horizontalSpan=2;
  messageLine.setLayoutData(gd);
  createBindingTable();
  createBookmarkBar();
  createTargetBar();
  createFormatBar();
}
Program: 78948
Project: 78948
Buggy source:
private void createBrowerButton(Composite parent,final Text text,final boolean needQuote){
  Button button=new Button(parent,SWT.PUSH);
  button.setLayoutData(new GridData());
  button.setImage(IMAGE_OPEN_FILE);
  button.setToolTipText(TOOLTIP_BROWSE_FILE);
  button.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      FileDialog dialog=new FileDialog(UIUtil.getDefaultShell());
      dialog.setFilterExtensions(new String[]{"String_Node_Str"});
      try {
        String filename=dialog.open();
        if (filename != null) {
          if (needQuote) {
            filename="String_Node_Str" + filename + "String_Node_Str";
          }
          text.setText(filename);
        }
 else {
          text.setText("String_Node_Str");
        }
        updateButtons();
      }
 catch (      Exception ex) {
        ExceptionHandler.handle(ex);
      }
    }
  }
);
}

Fixed version (ground truth):
private void createBrowerButton(Composite parent,final Text text,final boolean needQuote,final boolean needFilter){
  Button button=new Button(parent,SWT.PUSH);
  button.setLayoutData(new GridData());
  button.setImage(IMAGE_OPEN_FILE);
  button.setToolTipText(TOOLTIP_BROWSE_FILE);
  button.addSelectionListener(new SelectionAdapter(){
    public void widgetSelected(    SelectionEvent e){
      FileDialog dialog=new FileDialog(UIUtil.getDefaultShell());
      if (needFilter) {
        dialog.setFilterExtensions(new String[]{"String_Node_Str"});
      }
      try {
        String filename=dialog.open();
        if (filename != null) {
          if (needQuote) {
            filename="String_Node_Str" + filename + "String_Node_Str";
          }
          text.setText(filename);
        }
 else {
          text.setText("String_Node_Str");
        }
        updateButtons();
      }
 catch (      Exception ex) {
        ExceptionHandler.handle(ex);
      }
    }
  }
);
}
Program: 78949
Project: 78949
Buggy source:
public void first(){
}

Fixed version (ground truth):
public void first(){
  set.next();
}
Program: 78950
Project: 78950
Buggy source:
public void handleEvent(Event event){
  if (event.widget.equals(txtRadius)) {
    series.getDial().setRadius(Double.parseDouble(txtRadius.getText()));
  }
 else   if (event.widget.equals(iscStartAngle)) {
    series.getDial().setStartAngle(((Integer)event.data).intValue());
  }
 else   if (event.widget.equals(iscStopAngle)) {
    series.getDial().setStopAngle(((Integer)event.data).intValue());
  }
 else   if (event.widget.equals(liacNeedle)) {
    if (event.type == LineAttributesComposite.STYLE_CHANGED_EVENT) {
      series.getNeedle().getLineAttributes().setStyle((LineStyle)event.data);
    }
 else     if (event.type == LineAttributesComposite.WIDTH_CHANGED_EVENT) {
      series.getNeedle().getLineAttributes().setThickness(((Integer)event.data).intValue());
    }
  }
 else   if (event.widget.equals(cmbHeadStyle)) {
    if (event.type == HeadStyleAttributeComposite.STYLE_CHANGED_EVENT) {
      series.getNeedle().setDecorator((LineDecorator)event.data);
    }
  }
}

Fixed version (ground truth):
public void handleEvent(Event event){
  if (event.widget.equals(txtRadius)) {
    series.getDial().setRadius(Double.parseDouble(trimString(txtRadius.getText())));
  }
 else   if (event.widget.equals(iscStartAngle)) {
    series.getDial().setStartAngle(((Integer)event.data).intValue());
  }
 else   if (event.widget.equals(iscStopAngle)) {
    series.getDial().setStopAngle(((Integer)event.data).intValue());
  }
 else   if (event.widget.equals(liacNeedle)) {
    if (event.type == LineAttributesComposite.STYLE_CHANGED_EVENT) {
      series.getNeedle().getLineAttributes().setStyle((LineStyle)event.data);
    }
 else     if (event.type == LineAttributesComposite.WIDTH_CHANGED_EVENT) {
      series.getNeedle().getLineAttributes().setThickness(((Integer)event.data).intValue());
    }
  }
 else   if (event.widget.equals(cmbHeadStyle)) {
    if (event.type == HeadStyleAttributeComposite.STYLE_CHANGED_EVENT) {
      series.getNeedle().setDecorator((LineDecorator)event.data);
    }
  }
}
Program: 78952
Project: 78952
Buggy source:
public String execute(TextTemplate template,HashMap values){
  this.buffer=new StringBuffer();
  this.values=values;
  ArrayList nodes=template.getNodes();
  Iterator iter=nodes.iterator();
  while (iter.hasNext()) {
    TextTemplate.Node node=(TextTemplate.Node)iter.next();
    node.accept(this,null);
  }
  return buffer.toString();
}

Fixed version (ground truth):
public String execute(TextTemplate template,HashMap values){
  this.buffer=new StringBuffer();
  this.values=values;
  if (template == null) {
    return "String_Node_Str";
  }
  ArrayList nodes=template.getNodes();
  Iterator iter=nodes.iterator();
  while (iter.hasNext()) {
    TextTemplate.Node node=(TextTemplate.Node)iter.next();
    node.accept(this,null);
  }
  return buffer.toString();
}