nus-yam/ex-repair huggingface dataset:
Program: 11812
Project: 11812
Buggy source:
/** 
 * Handles the exception thrown during demand load  by recording it as an error diagnostic  and throwing a wrapping runtime exception.
 * @param resource the resource that threw an exception while loading.
 * @param resource the exception thrown from the resource while loading.
 * @see #demandLoadHelper(Resource)
 */
protected void handleDemandLoadException(Resource resource,IOException exception) throws RuntimeException {
  final String location=resource.getURI() == null ? null : resource.getURI().toString();
class DiagnosticWrappedException extends WrappedException implements Resource.Diagnostic {
    private static final long serialVersionUID=1L;
    public DiagnosticWrappedException(    Exception exception){
      super(exception);
    }
    public String getLocation(){
      return location;
    }
    public int getColumn(){
      return 0;
    }
    public int getLine(){
      return 0;
    }
  }
  Exception cause=exception instanceof Resource.IOWrappedException ? (Exception)exception.getCause() : exception;
  DiagnosticWrappedException wrappedException=new DiagnosticWrappedException(cause);
  if (resource.getErrors().isEmpty()) {
    resource.getErrors().add(exception instanceof Resource.Diagnostic ? (Resource.Diagnostic)exception : wrappedException);
  }
  throw wrappedException;
}

Fixed version (ground truth):
/** 
 * Handles the exception thrown during demand load  by recording it as an error diagnostic  and throwing a wrapping runtime exception.
 * @param resource the resource that threw an exception while loading.
 * @param exception the exception thrown from the resource while loading.
 * @see #demandLoadHelper(Resource)
 */
protected void handleDemandLoadException(Resource resource,IOException exception) throws RuntimeException {
  final String location=resource.getURI() == null ? null : resource.getURI().toString();
class DiagnosticWrappedException extends WrappedException implements Resource.Diagnostic {
    private static final long serialVersionUID=1L;
    public DiagnosticWrappedException(    Exception exception){
      super(exception);
    }
    public String getLocation(){
      return location;
    }
    public int getColumn(){
      return 0;
    }
    public int getLine(){
      return 0;
    }
  }
  Exception cause=exception instanceof Resource.IOWrappedException ? (Exception)exception.getCause() : exception;
  DiagnosticWrappedException wrappedException=new DiagnosticWrappedException(cause);
  if (resource.getErrors().isEmpty()) {
    resource.getErrors().add(exception instanceof Resource.Diagnostic ? (Resource.Diagnostic)exception : wrappedException);
  }
  throw wrappedException;
}
Program: 11813
Project: 11813
Buggy source:
/** 
 * Creates an input stream for the archive paths and returns it. It uses   {@link ArchiveReader} to implement read access.</p>
 * @return an open input stream.
 * @exception IOException if there is a problem obtaining an open input stream.
 */
protected InputStream createArchiveInputStream(URI archiveURI) throws IOException {
  return createArchive(archiveURI).getInputStream();
}

Fixed version (ground truth):
/** 
 * Creates an input stream for the archive paths and returns it. It uses   {@link Archive} to implement read access.</p>
 * @return an open input stream.
 * @exception IOException if there is a problem obtaining an open input stream.
 */
protected InputStream createArchiveInputStream(URI archiveURI) throws IOException {
  return createArchive(archiveURI).getInputStream();
}
Program: 11815
Project: 11815
Buggy source:
/** 
 * @since 2.3
 * @param eObject
 * @param eReference
 * @param diagnostics
 * @param context
 * @return
 */
protected boolean validate_MapEntryUnique(EObject eObject,EReference eReference,DiagnosticChain diagnostics,Map<Object,Object> context){
  boolean result=true;
  Object value=eObject.eGet(eReference);
  if (value instanceof EMap) {
    EMap<?,?> eMap=(EMap<?,?>)value;
    for (int i=0, size=eMap.size(); i < size; ++i) {
      Map.Entry<?,?> entry=eMap.get(i);
      Object key=entry.getKey();
      int index=eMap.indexOfKey(key);
      if (index != i) {
        result=false;
        if (diagnostics == null) {
          break;
        }
 else {
          diagnostics.add(new BasicDiagnostic(Diagnostic.ERROR,DIAGNOSTIC_SOURCE,EOBJECT__EVERY_MAP_ENTRY_UNIQUE,getEcoreResourceLocator().getString("String_Node_Str",new Object[]{getFeatureLabel(eReference,context),i,index}),new Object[]{eObject,eReference,entry,eMap.get(index)}));
        }
      }
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * @since 2.3
 * @param eObject
 * @param eReference
 * @param diagnostics
 * @param context
 * @return whether every map entry is unique.
 */
protected boolean validate_MapEntryUnique(EObject eObject,EReference eReference,DiagnosticChain diagnostics,Map<Object,Object> context){
  boolean result=true;
  Object value=eObject.eGet(eReference);
  if (value instanceof EMap) {
    EMap<?,?> eMap=(EMap<?,?>)value;
    for (int i=0, size=eMap.size(); i < size; ++i) {
      Map.Entry<?,?> entry=eMap.get(i);
      Object key=entry.getKey();
      int index=eMap.indexOfKey(key);
      if (index != i) {
        result=false;
        if (diagnostics == null) {
          break;
        }
 else {
          diagnostics.add(new BasicDiagnostic(Diagnostic.ERROR,DIAGNOSTIC_SOURCE,EOBJECT__EVERY_MAP_ENTRY_UNIQUE,getEcoreResourceLocator().getString("String_Node_Str",new Object[]{getFeatureLabel(eReference,context),i,index}),new Object[]{eObject,eReference,entry,eMap.get(index)}));
        }
      }
    }
  }
  return result;
}
Program: 11816
Project: 11816
Buggy source:
/** 
 * Creates an instance for the given collection of objects.
 * @param emfObjects the collection of objects to iterate over.
 */
protected ContentTreeIterator(Object object,boolean isResolveProxies){
  super(object,false);
  this.isResolveProxies=isResolveProxies;
}

Fixed version (ground truth):
/** 
 * Creates an instance for the given collection of objects.
 * @param object the collection of objects to iterate over.
 * @param isResolveProxies whether proxies should be resolved during the traversal.
 */
protected ContentTreeIterator(Object object,boolean isResolveProxies){
  super(object,false);
  this.isResolveProxies=isResolveProxies;
}
Program: 11818
Project: 11818
Buggy source:
/** 
 * Returns the text associated to be displayed in the detail text when a a dignostic is selected in the tree.
 * @param diagnostic
 * @return a not null String
 */
public String getDetail(Diagnostic diagnostic){
  Throwable throwable=diagnostic.getException();
  if (throwable != null) {
    StringWriter in=new StringWriter();
    PrintWriter ps=new PrintWriter(in);
    throwable.printStackTrace(ps);
    return in.getBuffer().toString();
  }
  for (  Object datum : diagnostic.getData()) {
    if (datum instanceof StringBuilder) {
      return datum.toString();
    }
  }
  return "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * Returns the text associated to be displayed in the detail text when a a diagnostic is selected in the tree.
 * @param diagnostic
 * @return a not null String
 */
public String getDetail(Diagnostic diagnostic){
  Throwable throwable=diagnostic.getException();
  if (throwable != null) {
    StringWriter in=new StringWriter();
    PrintWriter ps=new PrintWriter(in);
    throwable.printStackTrace(ps);
    return in.getBuffer().toString();
  }
  for (  Object datum : diagnostic.getData()) {
    if (datum instanceof StringBuilder) {
      return datum.toString();
    }
  }
  return "String_Node_Str";
}
Program: 11819
Project: 11819
Buggy source:
/** 
 * Create a pulldown menu on the action bar.
 */
private void createPulldownMenu(){
  if (systemBar != null) {
    ToolItem ti=new ToolItem(systemBar,SWT.PUSH,0);
    try {
      pullDownImage=ImageDescriptor.createFromURL(new URL(CommonUIPlugin.INSTANCE.getImage("String_Node_Str").toString())).createImage();
      ti.setImage(pullDownImage);
      ti.addSelectionListener(new SelectionAdapter(){
        @Override public void widgetSelected(        SelectionEvent e){
          showViewMenu();
        }
      }
);
    }
 catch (    MalformedURLException exception) {
    }
  }
}

Fixed version (ground truth):
/** 
 * Create a pull-down menu on the action bar.
 */
private void createPulldownMenu(){
  if (systemBar != null) {
    ToolItem ti=new ToolItem(systemBar,SWT.PUSH,0);
    try {
      pullDownImage=ImageDescriptor.createFromURL(new URL(CommonUIPlugin.INSTANCE.getImage("String_Node_Str").toString())).createImage();
      ti.setImage(pullDownImage);
      ti.addSelectionListener(new SelectionAdapter(){
        @Override public void widgetSelected(        SelectionEvent e){
          showViewMenu();
        }
      }
);
    }
 catch (    MalformedURLException exception) {
    }
  }
}
Program: 11820
Project: 11820
Buggy source:
/** 
 * Indicates that a property has changed.
 * @param source the object whose property has changed
 * @param propId the id of the property which has changed; property idsare generally defined as constants on the source class
 */
public void propertyChanged(Object source,int propId){
  if (propId == IWorkbenchPart.PROP_TITLE) {
    updateTitles();
  }
}

Fixed version (ground truth):
/** 
 * Indicates that a property has changed.
 * @param source the object whose property has changed
 * @param propID the ID of the property which has changed; property IDsare generally defined as constants on the source class
 */
public void propertyChanged(Object source,int propID){
  if (propID == IWorkbenchPart.PROP_TITLE) {
    updateTitles();
  }
}
Program: 11821
Project: 11821
Buggy source:
/** 
 * Handles the pressing of the Ok or Details button in this dialog. If the Ok button was pressed then close this dialog. If the Details button was pressed then toggle the displaying of the diagnostic details area. Note that the Details button will only be visible if the diagnostic being displayed specifies child details.
 */
@Override protected void buttonPressed(int id){
  if (id == IDialogConstants.DETAILS_ID) {
    toggleDetailsArea();
  }
 else {
    super.buttonPressed(id);
  }
}

Fixed version (ground truth):
/** 
 * Handles the pressing of the OK or Details button in this dialog. If the OK button was pressed then close this dialog. If the Details button was pressed then toggle the displaying of the diagnostic details area. Note that the Details button will only be visible if the diagnostic being displayed specifies child details.
 */
@Override protected void buttonPressed(int id){
  if (id == IDialogConstants.DETAILS_ID) {
    toggleDetailsArea();
  }
 else {
    super.buttonPressed(id);
  }
}
Program: 11822
Project: 11822
Buggy source:
/** 
 * Returns the value of the '<em><b>EAttribute Type</b></em>' reference. <!-- begin-user-doc --> <p> The   {@link #getEType type} of an attribute must always be a data type; this method provides access to it.</p> <!-- end-user-doc -->
 * @return the value of the '<em>EAttribute Type</em>' reference.
 * @see org.eclipse.emf.ecore.EcorePackage#getEAttribute_EAttributeType()
 * @model required="true" transient="true" changeable="false" volatile="true" derived="true"
 * @generated
 */
EDataType getEAttributeType();

Fixed version (ground truth):
/** 
 * Returns the value of the '<em><b>EAttribute Type</b></em>' reference. <!-- begin-user-doc --> <p> The   {@link #getEType() type} of an attribute must always be a data type; this method provides access to it.</p> <!-- end-user-doc -->
 * @return the value of the '<em>EAttribute Type</em>' reference.
 * @see org.eclipse.emf.ecore.EcorePackage#getEAttribute_EAttributeType()
 * @model required="true" transient="true" changeable="false" volatile="true" derived="true"
 * @generated
 */
EDataType getEAttributeType();
Program: 11823
Project: 11823
Buggy source:
/** 
 * Returns the value of the '<em><b>EID Attribute</b></em>' reference. <!-- begin-user-doc --> <p> It represents the attribute that will be used as the ID of an instace.
 * @see org.eclipse.emf.ecore.EAttribute#isID()
 * @ignore </p> <!-- end-user-doc -->
 * @return the value of the '<em>EID Attribute</em>' reference.
 * @see org.eclipse.emf.ecore.EcorePackage#getEClass_EIDAttribute()
 * @model resolveProxies="false" transient="true" changeable="false" volatile="true" derived="true"
 * @generated
 */
EAttribute getEIDAttribute();

Fixed version (ground truth):
/** 
 * Returns the value of the '<em><b>EID Attribute</b></em>' reference. <!-- begin-user-doc --> <p> It represents the attribute that will be used as the ID of an instance.
 * @see org.eclipse.emf.ecore.EAttribute#isID()
 * @ignore </p> <!-- end-user-doc -->
 * @return the value of the '<em>EID Attribute</em>' reference.
 * @see org.eclipse.emf.ecore.EcorePackage#getEClass_EIDAttribute()
 * @model resolveProxies="false" transient="true" changeable="false" volatile="true" derived="true"
 * @generated
 */
EAttribute getEIDAttribute();
Program: 11824
Project: 11824
Buggy source:
/** 
 * Returns the value of the '<em><b>Serializable</b></em>' attribute. The default value is <code>"true"</code>. <!-- begin-user-doc --> <p> It represents whether values of this type will be   {@link org.eclipse.emf.ecore.resource.Resource#save(java.util.Map) serialized}. For a serializable datatype, there will be factory methods of the form: <pre> String convertXyzToString(EDataType metaObject, Object instanceValue) Object createXyzFromString(EDataType metaObject, String initialValue) </pre> in the generated factory implementation. Clients will typically need to hand write the bodies of these generated methods. </p> <!-- end-user-doc -->
 * @return the value of the '<em>Serializable</em>' attribute.
 * @see #setSerializable(boolean)
 * @see org.eclipse.emf.ecore.EcorePackage#getEDataType_Serializable()
 * @model default="true"
 * @generated
 */
boolean isSerializable();

Fixed version (ground truth):
/** 
 * Returns the value of the '<em><b>Serializable</b></em>' attribute. The default value is <code>"true"</code>. <!-- begin-user-doc --> <p> It represents whether values of this type will be   {@link org.eclipse.emf.ecore.resource.Resource#save(java.util.Map) serialized}. For a serializable data type, there will be factory methods of the form: <pre> String convertXyzToString(EDataType metaObject, Object instanceValue) Object createXyzFromString(EDataType metaObject, String initialValue) </pre> in the generated factory implementation. Clients will typically need to hand write the bodies of these generated methods. </p> <!-- end-user-doc -->
 * @return the value of the '<em>Serializable</em>' attribute.
 * @see #setSerializable(boolean)
 * @see org.eclipse.emf.ecore.EcorePackage#getEDataType_Serializable()
 * @model default="true"
 * @generated
 */
boolean isSerializable();
Program: 11825
Project: 11825
Buggy source:
/** 
 * <!-- begin-user-doc --> Returns whether the feature of the object is considered to be set. <p> If the feature is   {@link EStructuralFeature#isMany many-valued}, the value must be an   {@link EList}and the feature is considered set if the list is not empty. If the feature is   {@link EAttribute#isUnsettable unsettable}, the modeled state is directly available and is used. Otherwise,  the   {@link #eGet(EStructuralFeature,boolean) unresolved value} of the feature of the object is compared against the feature's  {@link EStructuralFeature#getDefaultValue() default value}or the   {@link #eClass meta class}'s   {@link EStructuralFeature#getDefaultValue() default value}, as appropriate; the feature is considered set if it's not the same as the default. </p> <p> This property can affect serialization, since defaults are typically omitted in a compact serialization. </p>
 * @param feature the feature in question.
 * @exception IllegalArgumentException if the feature is not one the  {@link #eClass meta class}'s   {@link EClass#getEAllStructuralFeatures features}.
 * @return whether the feature of the object is set.
 * @see #eSet(EStructuralFeature,Object)
 * @see #eUnset(EStructuralFeature)
 * @see #eGet(EStructuralFeature,boolean)
 * @ignore <!-- end-user-doc -->
 * @model
 * @generated
 */
boolean eIsSet(EStructuralFeature feature);

Fixed version (ground truth):
/** 
 * <!-- begin-user-doc --> Returns whether the feature of the object is considered to be set. <p> If the feature is   {@link ETypedElement#isMany() many-valued}, the value must be an   {@link EList}and the feature is considered set if the list is not empty. If the feature is   {@link EStructuralFeature#isUnsettable unsettable}, the modeled state is directly available and is used. Otherwise,  the   {@link #eGet(EStructuralFeature,boolean) unresolved value} of the feature of the object is compared against the feature's  {@link EStructuralFeature#getDefaultValue() default value}or the   {@link #eClass meta class}'s   {@link EStructuralFeature#getDefaultValue() default value}, as appropriate; the feature is considered set if it's not the same as the default. </p> <p> This property can affect serialization, since defaults are typically omitted in a compact serialization. </p>
 * @param feature the feature in question.
 * @exception IllegalArgumentException if the feature is not one the  {@link #eClass meta class}'s   {@link EClass#getEAllStructuralFeatures features}.
 * @return whether the feature of the object is set.
 * @see #eSet(EStructuralFeature,Object)
 * @see #eUnset(EStructuralFeature)
 * @see #eGet(EStructuralFeature,boolean)
 * @ignore <!-- end-user-doc -->
 * @model
 * @generated
 */
boolean eIsSet(EStructuralFeature feature);
Program: 11826
Project: 11826
Buggy source:
/** 
 * <!-- begin-user-doc --> Indicates whether this object is a proxy. <p>  A proxy is an object that is defined in a <code>Resource</code> that has not been loaded. An object may be a proxy either because proxy resolution was disabled  when the object was accessed (see   {@link #eGet(EStructuralFeature,boolean)}) or because proxy   {@link org.eclipse.emf.ecore.util.EcoreUtil#resolve resolution} failed.</p>
 * @return <code>true</code> if this object is a proxy or <code>false</code>, otherwise.
 * @see Resource#unload
 * @see org.eclipse.emf.ecore.util.EcoreUtil#resolve(EObject,org.eclipse.emf.ecore.resource.ResourceSet)
 * @ignore <!-- end-user-doc -->
 * @model
 * @generated
 */
boolean eIsProxy();

Fixed version (ground truth):
/** 
 * <!-- begin-user-doc --> Indicates whether this object is a proxy. <p>  A proxy is an object that is defined in a <code>Resource</code> that has not been loaded. An object may be a proxy either because proxy resolution was disabled  when the object was accessed (see   {@link #eGet(EStructuralFeature,boolean)}) or because proxy   {@link org.eclipse.emf.ecore.util.EcoreUtil#resolve(EObject,EObject) resolution} failed.</p>
 * @return <code>true</code> if this object is a proxy or <code>false</code>, otherwise.
 * @see Resource#unload
 * @see org.eclipse.emf.ecore.util.EcoreUtil#resolve(EObject,org.eclipse.emf.ecore.resource.ResourceSet)
 * @ignore <!-- end-user-doc -->
 * @model
 * @generated
 */
boolean eIsProxy();
Program: 11827
Project: 11827
Buggy source:
/** 
 * <!-- begin-user-doc --> Returns the containing object, or <code>null</code>. <p> An object is contained by another object  if it appears in the   {@link #eContents contents} of that object.The object will be contained by a  {@link #eContainmentFeature containment feature} of the containing object.</p>
 * @return the containing object.
 * @see #eResource
 * @see org.eclipse.emf.ecore.util.EcoreUtil#remove(EObject)
 * @see #eContainmentFeature
 * @see #eContainingFeature
 * @see org.eclipse.emf.ecore.util.EcoreUtil#getRootContainer
 * @see #eContents
 * @ignore <!-- end-user-doc -->
 * @model
 * @generated
 */
EObject eContainer();

Fixed version (ground truth):
/** 
 * <!-- begin-user-doc --> Returns the containing object, or <code>null</code>. <p> An object is contained by another object  if it appears in the   {@link #eContents contents} of that object.The object will be contained by a  {@link #eContainmentFeature containment feature} of the containing object.</p>
 * @return the containing object.
 * @see #eResource
 * @see org.eclipse.emf.ecore.util.EcoreUtil#remove(EObject)
 * @see #eContainmentFeature
 * @see #eContainingFeature
 * @see org.eclipse.emf.ecore.util.EcoreUtil#getRootContainer(EObject)
 * @see #eContents
 * @ignore <!-- end-user-doc -->
 * @model
 * @generated
 */
EObject eContainer();
Program: 11829
Project: 11829
Buggy source:
/** 
 * <!-- begin-user-doc --> Returns a tree iterator that iterates over all the   {@link #eContents direct contents} and indirect contents of this object.
 * @return a tree iterator that iterates over all contents.
 * @see Resource#getAllContents
 * @see org.eclipse.emf.ecore.util.EcoreUtil#getAllContents
 * @ignore <!-- end-user-doc -->
 * @model
 * @generated
 */
TreeIterator<EObject> eAllContents();

Fixed version (ground truth):
/** 
 * <!-- begin-user-doc --> Returns a tree iterator that iterates over all the   {@link #eContents direct contents} and indirect contents of this object.
 * @return a tree iterator that iterates over all contents.
 * @see Resource#getAllContents
 * @see org.eclipse.emf.ecore.util.EcoreUtil#getAllContents(EObject,boolean)
 * @ignore <!-- end-user-doc -->
 * @model
 * @generated
 */
TreeIterator<EObject> eAllContents();
Program: 11830
Project: 11830
Buggy source:
/** 
 * <!-- begin-user-doc --> Returns the value of the given feature of the object;  the value is optionally   {@link org.eclipse.emf.ecore.util.EcoreUtil#resolve resolved} before it is returned.<p> If the feature is  {@link EStructuralFeature#isMany many-valued}, the result will be an   {@link EList}and each object in the list will be   {@link EClassifier#isInstance an instance of} the feature's  {@link EStructuralFeature#getEType type}; the list's contents are <b>not</b> affected by <code>resolve</code> argument. Otherwise the result directly will be an instance of the feature's type; if it is a   {@link #eIsProxy proxy}, it is resolved.
 * @param feature the feature of the value to fetch.
 * @param resolve whether to resolve.
 * @return the value of the given feature of the object.
 * @exception IllegalArgumentException if the feature is not one the  {@link #eClass meta class}'s   {@link EClass#getEAllStructuralFeatures features}.
 * @see org.eclipse.emf.ecore.util.InternalEList#basicIterator
 * @see org.eclipse.emf.ecore.util.InternalEList#basicList
 * @see org.eclipse.emf.ecore.util.EcoreUtil#resolve(EObject,org.eclipse.emf.ecore.resource.ResourceSet) EcoreUtil.resolve(EObject, org.eclipse.emf.ecore.resource.ResourceSet)
 * @see #eSet(EStructuralFeature,Object)
 * @see #eUnset(EStructuralFeature)
 * @see #eIsSet(EStructuralFeature)
 * @see #eGet(EStructuralFeature)
 * @ignore <!-- end-user-doc -->
 * @model
 * @generated
 */
Object eGet(EStructuralFeature feature,boolean resolve);

Fixed version (ground truth):
/** 
 * <!-- begin-user-doc --> Returns the value of the given feature of the object;  the value is optionally   {@link org.eclipse.emf.ecore.util.EcoreUtil#resolve(EObject,EObject) resolved} before it is returned.<p> If the feature is  {@link ETypedElement#isMany() many-valued}, the result will be an   {@link EList}and each object in the list will be   {@link EClassifier#isInstance an instance of} the feature's  {@link ETypedElement#getEType() type}; the list's contents are <b>not</b> affected by <code>resolve</code> argument. Otherwise the result directly will be an instance of the feature's type; if it is a   {@link #eIsProxy proxy}, it is resolved.
 * @param feature the feature of the value to fetch.
 * @param resolve whether to resolve.
 * @return the value of the given feature of the object.
 * @exception IllegalArgumentException if the feature is not one the  {@link #eClass meta class}'s   {@link EClass#getEAllStructuralFeatures features}.
 * @see org.eclipse.emf.ecore.util.InternalEList#basicIterator
 * @see org.eclipse.emf.ecore.util.InternalEList#basicList
 * @see org.eclipse.emf.ecore.util.EcoreUtil#resolve(EObject,org.eclipse.emf.ecore.resource.ResourceSet) EcoreUtil.resolve(EObject, org.eclipse.emf.ecore.resource.ResourceSet)
 * @see #eSet(EStructuralFeature,Object)
 * @see #eUnset(EStructuralFeature)
 * @see #eIsSet(EStructuralFeature)
 * @see #eGet(EStructuralFeature)
 * @ignore <!-- end-user-doc -->
 * @model
 * @generated
 */
Object eGet(EStructuralFeature feature,boolean resolve);
Program: 11831
Project: 11831
Buggy source:
/** 
 * <!-- begin-user-doc --> Unsets the feature of the object. <p> If the feature is   {@link EStructuralFeature#isMany many-valued}, the value must be an   {@link EList}and that list is cleared. Otherwise,  the value of the feature of the object  is set to the feature's   {@link EStructuralFeature#getDefaultValue() default value}or the   {@link #eClass meta class}'s   {@link EStructuralFeature#getDefaultValue() default value}, as appropriate. If the feature is   {@link EAttribute#isUnsettable unsettable}, the modeled state becomes unset. In any case, the feature will no longer be considered   {@link #eIsSet set}. </p>
 * @param feature the feature in question.
 * @exception IllegalArgumentException if the feature is not one the  {@link #eClass meta class}'s   {@link EClass#getEAllStructuralFeatures features}, or it isn't   {@link EStructuralFeature#isChangeable changeable}.
 * @see #eIsSet(EStructuralFeature)
 * @see #eSet(EStructuralFeature,Object)
 * @see #eGet(EStructuralFeature,boolean)
 * @ignore <!-- end-user-doc -->
 * @model
 * @generated
 */
void eUnset(EStructuralFeature feature);

Fixed version (ground truth):
/** 
 * <!-- begin-user-doc --> Unsets the feature of the object. <p> If the feature is   {@link ETypedElement#isMany() many-valued}, the value must be an   {@link EList}and that list is cleared. Otherwise,  the value of the feature of the object  is set to the feature's   {@link EStructuralFeature#getDefaultValue() default value}or the   {@link #eClass meta class}'s   {@link EStructuralFeature#getDefaultValue() default value}, as appropriate. If the feature is   {@link EStructuralFeature#isUnsettable() unsettable}, the modeled state becomes unset. In any case, the feature will no longer be considered   {@link #eIsSet set}. </p>
 * @param feature the feature in question.
 * @exception IllegalArgumentException if the feature is not one the  {@link #eClass meta class}'s   {@link EClass#getEAllStructuralFeatures features}, or it isn't   {@link EStructuralFeature#isChangeable changeable}.
 * @see #eIsSet(EStructuralFeature)
 * @see #eSet(EStructuralFeature,Object)
 * @see #eGet(EStructuralFeature,boolean)
 * @ignore <!-- end-user-doc -->
 * @model
 * @generated
 */
void eUnset(EStructuralFeature feature);
Program: 11832
Project: 11832
Buggy source:
/** 
 * Returns the value of the '<em><b>Ns Prefix</b></em>' attribute. <!-- begin-user-doc --> <p> It represents the prefered XMLNS prefix to be used for this package's the   {@link #getNsURI namespace URI}. It will be used in an XMI serialization. </p> <!-- end-user-doc -->
 * @return the value of the '<em>Ns Prefix</em>' attribute.
 * @see #setNsPrefix(String)
 * @see org.eclipse.emf.ecore.EcorePackage#getEPackage_NsPrefix()
 * @model
 * @generated
 */
String getNsPrefix();

Fixed version (ground truth):
/** 
 * Returns the value of the '<em><b>Ns Prefix</b></em>' attribute. <!-- begin-user-doc --> <p> It represents the preferred XMLNS prefix to be used for this package's the   {@link #getNsURI namespace URI}. It will be used in an XMI serialization. </p> <!-- end-user-doc -->
 * @return the value of the '<em>Ns Prefix</em>' attribute.
 * @see #setNsPrefix(String)
 * @see org.eclipse.emf.ecore.EcorePackage#getEPackage_NsPrefix()
 * @model
 * @generated
 */
String getNsPrefix();
Program: 11833
Project: 11833
Buggy source:
/** 
 * Returns the value of the '<em><b>EClassifiers</b></em>' containment reference list. The list contents are of type   {@link org.eclipse.emf.ecore.EClassifier}. It is bidirectional and its opposite is '  {@link org.eclipse.emf.ecore.EClassifier#getEPackage <em>EPackage</em>}'. <!-- begin-user-doc --> <p> It represents the meta objects, i.e., classes and datatypes, defined in this package. </p> <!-- end-user-doc -->
 * @return the value of the '<em>EClassifiers</em>' containment reference list.
 * @see org.eclipse.emf.ecore.EcorePackage#getEPackage_EClassifiers()
 * @see org.eclipse.emf.ecore.EClassifier#getEPackage
 * @model opposite="ePackage" containment="true" resolveProxies="true"
 * @generated
 */
EList<EClassifier> getEClassifiers();

Fixed version (ground truth):
/** 
 * Returns the value of the '<em><b>EClassifiers</b></em>' containment reference list. The list contents are of type   {@link org.eclipse.emf.ecore.EClassifier}. It is bidirectional and its opposite is '  {@link org.eclipse.emf.ecore.EClassifier#getEPackage <em>EPackage</em>}'. <!-- begin-user-doc --> <p> It represents the meta objects, i.e., classes and data types, defined in this package. </p> <!-- end-user-doc -->
 * @return the value of the '<em>EClassifiers</em>' containment reference list.
 * @see org.eclipse.emf.ecore.EcorePackage#getEPackage_EClassifiers()
 * @see org.eclipse.emf.ecore.EClassifier#getEPackage
 * @model opposite="ePackage" containment="true" resolveProxies="true"
 * @generated
 */
EList<EClassifier> getEClassifiers();
Program: 11834
Project: 11834
Buggy source:
/** 
 * Returns the value of the '<em><b>EReference Type</b></em>' reference. <!-- begin-user-doc --> <p> The   {@link #getEType type} of a reference must always be a class; this method provides access to it.</p> <!-- end-user-doc -->
 * @return the value of the '<em>EReference Type</em>' reference.
 * @see org.eclipse.emf.ecore.EcorePackage#getEReference_EReferenceType()
 * @model required="true" transient="true" changeable="false" volatile="true" derived="true"
 * @generated
 */
EClass getEReferenceType();

Fixed version (ground truth):
/** 
 * Returns the value of the '<em><b>EReference Type</b></em>' reference. <!-- begin-user-doc --> <p> The   {@link #getEType() type} of a reference must always be a class; this method provides access to it.</p> <!-- end-user-doc -->
 * @return the value of the '<em>EReference Type</em>' reference.
 * @see org.eclipse.emf.ecore.EcorePackage#getEReference_EReferenceType()
 * @model required="true" transient="true" changeable="false" volatile="true" derived="true"
 * @generated
 */
EClass getEReferenceType();
Program: 11835
Project: 11835
Buggy source:
/** 
 * Returns the value held by the feature of the object; it optionally   {@link org.eclipse.emf.ecore.util.EcoreUtil#resolve resolves} the value.
 * @param resolve whether to resolve.
 * @return the value held by the feature of the object.
 * @see EObject#eGet(EStructuralFeature,boolean)
 */
Object get(boolean resolve);

Fixed version (ground truth):
/** 
 * Returns the value held by the feature of the object; it optionally   {@link org.eclipse.emf.ecore.util.EcoreUtil#resolve(EObject,EObject) resolves} the value.
 * @param resolve whether to resolve.
 * @return the value held by the feature of the object.
 * @see EObject#eGet(EStructuralFeature,boolean)
 */
Object get(boolean resolve);
Program: 11836
Project: 11836
Buggy source:
/** 
 * This supports a non-headless invocation. The variable VABASE or ECLIPSE.
 * @deprecated It is not possible to generate code withtout using Eclipse.  Ifyou are invoking this method, you should instantiate a Generator and call {@link #run(Object)}.  This method will be removed in a future release.
 */
@Deprecated public static void main(String args[]){
  new Generator().run(args);
}

Fixed version (ground truth):
/** 
 * This supports a non-headless invocation. The variable VABASE or ECLIPSE.
 * @deprecated It is not possible to generate code without using Eclipse.  Ifyou are invoking this method, you should instantiate a Generator and call {@link #run(Object)}.  This method will be removed in a future release.
 */
@Deprecated public static void main(String args[]){
  new Generator().run(args);
}
Program: 11837
Project: 11837
Buggy source:
/** 
 * If code can be generated for the object, as determined by   {@link #canGenerate(Object,Object)}, delegates code generation to   {@link #doGenerate(Object,Object,Monitor)}. Otherwise, simply returns  {@link Diagnostic#OK_INSTANCE OK}. The object is cached as   {@link #generatingObject} and the {@link #message} iscleared before calling  {@link #doGenerate(Object,Object,Monitor)}; both are cleared again afterwards.
 * @link #canGenerate(Object, Object)
 * @link #doGenerate(Object, Object, Monitor)
 */
public final Diagnostic generate(Object object,Object projectType,Monitor monitor){
  try {
    if (canGenerate(object,projectType)) {
      generatingObject=object;
      message=null;
      return doGenerate(object,projectType,monitor);
    }
    return Diagnostic.OK_INSTANCE;
  }
 catch (  Exception exception) {
    return toDiagnostic(exception,message);
  }
 finally {
    generatingObject=null;
    message=null;
    monitor.done();
  }
}

Fixed version (ground truth):
/** 
 * If code can be generated for the object, as determined by   {@link #canGenerate(Object,Object)}, delegates code generation to   {@link #doGenerate(Object,Object,Monitor)}. Otherwise, simply returns  {@link Diagnostic#OK_INSTANCE OK}. The object is cached as   {@link #generatingObject} and the {@link #message} iscleared before calling  {@link #doGenerate(Object,Object,Monitor)}; both are cleared again afterwards.
 * @see #canGenerate(Object,Object)
 * @see #doGenerate(Object,Object,Monitor)
 */
public final Diagnostic generate(Object object,Object projectType,Monitor monitor){
  try {
    if (canGenerate(object,projectType)) {
      generatingObject=object;
      message=null;
      return doGenerate(object,projectType,monitor);
    }
    return Diagnostic.OK_INSTANCE;
  }
 catch (  Exception exception) {
    return toDiagnostic(exception,message);
  }
 finally {
    generatingObject=null;
    message=null;
    monitor.done();
  }
}
Program: 11838
Project: 11838
Buggy source:
/** 
 * If   {@link Generator.Options#dynamicTemplates dynamic templates} are not being used, attempts to set the emitter touse an existing, pre-compiled template class.
 */
protected void setStaticTemplateClass(JETEmitter jetEmitter,String className){
  if (!getGenerator().getOptions().dynamicTemplates) {
    try {
      Class<?> templateClass=getClass().getClassLoader().loadClass(className);
      Method emitterMethod=templateClass.getDeclaredMethod("String_Node_Str",OBJECT_ARGUMENT);
      jetEmitter.setMethod(emitterMethod);
    }
 catch (    Exception exception) {
    }
  }
}

Fixed version (ground truth):
/** 
 * If   {@link Generator.Options#dynamicTemplates dynamic templates} are not being used, attempts to set the emitter touse an existing, precompiled template class.
 */
protected void setStaticTemplateClass(JETEmitter jetEmitter,String className){
  if (!getGenerator().getOptions().dynamicTemplates) {
    try {
      Class<?> templateClass=getClass().getClassLoader().loadClass(className);
      Method emitterMethod=templateClass.getDeclaredMethod("String_Node_Str",OBJECT_ARGUMENT);
      jetEmitter.setMethod(emitterMethod);
    }
 catch (    Exception exception) {
    }
  }
}
Program: 11839
Project: 11839
Buggy source:
/** 
 * Creates and returns a sub-monitor for the given progress monitor. When running standalone, the same monitor is actually returned.
 * @param monitor the parent monitor
 * @param ticks the number of work ticks allocated from the parent monitor
 */
protected Monitor createMonitor(Monitor monitor,int ticks){
  return CodeGenUtil.createMonitor(monitor,ticks);
}

Fixed version (ground truth):
/** 
 * Creates and returns a sub-monitor for the given progress monitor. When running stand-alone, the same monitor is actually returned.
 * @param monitor the parent monitor
 * @param ticks the number of work ticks allocated from the parent monitor
 */
protected Monitor createMonitor(Monitor monitor,int ticks){
  return CodeGenUtil.createMonitor(monitor,ticks);
}
Program: 11844
Project: 11844
Buggy source:
/** 
 * Override this to   {@link org.eclipse.emf.codegen.jet.JETEmitter#addVariable(String,String) add classpath variables}to the JETEmitter. These will be used to build and execute dynamic templates.
 * @link org.eclipse.emf.codegen.jet.JETEmitter#addVariable(String, String)
 */
protected void addClasspathEntries(JETEmitter jetEmitter) throws JETException {
  if (getGenerator().getOptions().templateClasspath != null) {
    for (    String additionalClasspathEntry : getGenerator().getOptions().templateClasspath) {
      int index=additionalClasspathEntry.indexOf('=');
      if (index == -1) {
        jetEmitter.addVariable(additionalClasspathEntry,additionalClasspathEntry);
      }
 else {
        jetEmitter.addVariable(additionalClasspathEntry.substring(0,index),additionalClasspathEntry.substring(index + 1));
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Override this to   {@link org.eclipse.emf.codegen.jet.JETEmitter#addVariable(String,String) add classpath variables}to the JETEmitter. These will be used to build and execute dynamic templates.
 * @see org.eclipse.emf.codegen.jet.JETEmitter#addVariable(String,String)
 */
protected void addClasspathEntries(JETEmitter jetEmitter) throws JETException {
  if (getGenerator().getOptions().templateClasspath != null) {
    for (    String additionalClasspathEntry : getGenerator().getOptions().templateClasspath) {
      int index=additionalClasspathEntry.indexOf('=');
      if (index == -1) {
        jetEmitter.addVariable(additionalClasspathEntry,additionalClasspathEntry);
      }
 else {
        jetEmitter.addVariable(additionalClasspathEntry.substring(0,index),additionalClasspathEntry.substring(index + 1));
      }
    }
  }
}
Program: 11845
Project: 11845
Buggy source:
/** 
 * Converts the given workspace path to a <code>URI</code>. No encoding is performed, so the URI may contain invalid characters. Such a URI is only used to easily acess and manipulate parts of the workspace path. It can then be converted back to a string and an   {@link org.eclipse.core.runtime.IPath IPath} for use in the workspace, or to an encoded  {@link #toPlatformResourceURI(URI) platform resource URI} for direct use with the EMF persistenceframework.
 */
protected URI toURI(String pathName){
  return URI.createURI(pathName);
}

Fixed version (ground truth):
/** 
 * Converts the given workspace path to a <code>URI</code>. No encoding is performed, so the URI may contain invalid characters. Such a URI is only used to easily access and manipulate parts of the workspace path. It can then be converted back to a string and an   {@link org.eclipse.core.runtime.IPath IPath} for use in the workspace, or to an encoded  {@link #toPlatformResourceURI(URI) platform resource URI} for direct use with the EMF persistenceframework.
 */
protected URI toURI(String pathName){
  return URI.createURI(pathName);
}
Program: 11846
Project: 11846
Buggy source:
/** 
 * Performs initialization for the given model-level input object. This implementaiton does nothing; it should be overridden when   {@link Generator#getOptions() options} should be set on the generator, or other initializationis required.
 */
public void initialize(Object input){
}

Fixed version (ground truth):
/** 
 * Performs initialization for the given model-level input object. This implementation does nothing; it should be overridden when   {@link Generator#getOptions() options} should be set on the generator, or other initializationis required.
 */
public void initialize(Object input){
}
Program: 11849
Project: 11849
Buggy source:
/** 
 * Returns whether code of the given poject type can be generated for the specified object.
 */
boolean canGenerate(Object object,Object projectType);

Fixed version (ground truth):
/** 
 * Returns whether code of the given object type can be generated for the specified object.
 */
boolean canGenerate(Object object,Object projectType);
Program: 11850
Project: 11850
Buggy source:
/** 
 * Record the DOM node and its corresponding EMF values.
 * @param node the DOM node
 * @param container the {@link org.eclipse.emf.ecore.EObject} which is the node's container
 * @param feature the feature for DOM node value
 * @param object the EMF value which is obtained by querying the value of the specified feature on the container {@link  org.eclipse.emf.ecore.EObject#eGet(EStructuralFeature};  this value is used to create the <emf>node</emf>
 */
void recordValues(Node node,EObject container,EStructuralFeature feature,Object value);

Fixed version (ground truth):
/** 
 * Record the DOM node and its corresponding EMF values.
 * @param node the DOM node
 * @param container the {@link org.eclipse.emf.ecore.EObject} which is the node's container
 * @param feature the feature for DOM node value
 * @param object the EMF value which is obtained by querying the value of the specified feature on the container {@link EObject#eGet(EStructuralFeature)};  this value is used to create the <emf>node</emf>
 */
void recordValues(Node node,EObject container,EStructuralFeature feature,Object value);
Program: 11851
Project: 11851
Buggy source:
/** 
 * Converts the given valuevalue to string while saving an XML document. 
 */
public String convertToString(EFactory factory,EDataType dataType,Object data);

Fixed version (ground truth):
/** 
 * Converts the given data value to a string while saving an XML document. 
 */
public String convertToString(EFactory factory,EDataType dataType,Object data);
Program: 11852
Project: 11852
Buggy source:
/** 
 * Create an object given an EFactory and a type 
 * @since 2.2
 * @param eFactory
 * @param type
 * @return
 * @see #createObject(EFactory,String)
 */
EObject createObject(EFactory eFactory,EClassifier type);

Fixed version (ground truth):
/** 
 * Create an object given an EFactory and a type 
 * @since 2.2
 * @param eFactory
 * @param type
 * @return the created object.
 * @see #createObject(EFactory,String)
 */
EObject createObject(EFactory eFactory,EClassifier type);
Program: 11853
Project: 11853
Buggy source:
/** 
 * Retrives XMLDefaultHandler from the pool and initializes / prepares it.
 * @param resource - the resource
 * @param xmlLoad - the XMLLoad
 * @param helper - XMLHelper
 * @param options
 */
public XMLDefaultHandler getDefaultHandler(XMLResource resource,XMLLoad xmlLoad,XMLHelper helper,Map<?,?> options);

Fixed version (ground truth):
/** 
 * Retrieves XMLDefaultHandler from the pool and initializes / prepares it.
 * @param resource - the resource
 * @param xmlLoad - the XMLLoad
 * @param helper - XMLHelper
 * @param options
 */
public XMLDefaultHandler getDefaultHandler(XMLResource resource,XMLLoad xmlLoad,XMLHelper helper,Map<?,?> options);
Program: 11854
Project: 11854
Buggy source:
/** 
 * Returns the name associated with the entity value;  a new name will be generated if there is not yet a name assocaited with the entity value.
 * @param entityValue the entity value for which a named entity is needed.
 * @return the name associated with the entity value.
 */
String getEntityName(String entityValue);

Fixed version (ground truth):
/** 
 * Returns the name associated with the entity value;  a new name will be generated if there is not yet a name associated with the entity value.
 * @param entityValue the entity value for which a named entity is needed.
 * @return the name associated with the entity value.
 */
String getEntityName(String entityValue);
Program: 11855
Project: 11855
Buggy source:
/** 
 * Get the XML version for this resource. The default is 1.0.
 * @return
 */
String getXMLVersion();

Fixed version (ground truth):
/** 
 * Returns the XML version for this resource. The default is 1.0.
 * @return the XML version.
 */
String getXMLVersion();
Program: 11856
Project: 11856
Buggy source:
/** 
 * Creates an instance that will generate entity names based on the given entity name  followed by the   {@link #count} starting from 1 to ensure uniquenss.
 * @param entityName
 */
public ResourceEntityHandlerImpl(String entityName){
  this.entityName=entityName;
}

Fixed version (ground truth):
/** 
 * Creates an instance that will generate entity names based on the given entity name  followed by the   {@link #count} starting from 1 to ensure uniqueness.
 * @param entityName
 */
public ResourceEntityHandlerImpl(String entityName){
  this.entityName=entityName;
}
Program: 11858
Project: 11858
Buggy source:
/** 
 * Create an XML processor that is aware of XML Schemas specified.
 * @param schemaURIs - a list of URI {@link org.eclipse.common.util.URI} which point to XML Schemas
 * @throws SAXException
 */
public XMLProcessor(Collection<URI> schemaURIs) throws SAXException {
  this(new EPackageRegistryImpl());
  loadOptions.put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE,Boolean.TRUE);
  loadOptions.put(XMLResource.OPTION_USE_LEXICAL_HANDLER,Boolean.TRUE);
  saveOptions.put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE,Boolean.TRUE);
  saveOptions.put(XMLResource.OPTION_SCHEMA_LOCATION,Boolean.TRUE);
  try {
    for (    Resource resource : ecoreBuilder.generate(schemaURIs)) {
      for (      EPackage ePackage : EcoreUtil.<EPackage>getObjectsByType(resource.getContents(),EcorePackage.eINSTANCE.getEPackage())) {
        EcoreUtil.freeze(ePackage);
      }
    }
  }
 catch (  InvocationTargetException ie) {
    throw new SAXException((Exception)ie.getTargetException());
  }
catch (  Exception e) {
    throw new SAXException(e);
  }
}

Fixed version (ground truth):
/** 
 * Create an XML processor that is aware of XML Schemas specified.
 * @param schemaURIs - a list of URI {@link URI} which point to XML Schemas
 * @throws SAXException
 */
public XMLProcessor(Collection<URI> schemaURIs) throws SAXException {
  this(new EPackageRegistryImpl());
  loadOptions.put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE,Boolean.TRUE);
  loadOptions.put(XMLResource.OPTION_USE_LEXICAL_HANDLER,Boolean.TRUE);
  saveOptions.put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE,Boolean.TRUE);
  saveOptions.put(XMLResource.OPTION_SCHEMA_LOCATION,Boolean.TRUE);
  try {
    for (    Resource resource : ecoreBuilder.generate(schemaURIs)) {
      for (      EPackage ePackage : EcoreUtil.<EPackage>getObjectsByType(resource.getContents(),EcorePackage.eINSTANCE.getEPackage())) {
        EcoreUtil.freeze(ePackage);
      }
    }
  }
 catch (  InvocationTargetException ie) {
    throw new SAXException((Exception)ie.getTargetException());
  }
catch (  Exception e) {
    throw new SAXException(e);
  }
}
Program: 11860
Project: 11860
Buggy source:
/** 
 * This can be overriden to determine the parent of an object; this implementation uses   {@link EditingDomain#getParent}.
 */
protected Object getParent(Object object){
  return domain.getParent(object);
}

Fixed version (ground truth):
/** 
 * This can be overridden to determine the parent of an object; this implementation uses   {@link EditingDomain#getParent}.
 */
protected Object getParent(Object object){
  return domain.getParent(object);
}
Program: 11861
Project: 11861
Buggy source:
/** 
 * This can be overriden to determine the children of an object; this implementation uses   {@link EditingDomain#getChildren}.
 */
protected Collection<?> getChildren(Object object){
  return domain.getChildren(object);
}

Fixed version (ground truth):
/** 
 * This can be overridden to determine the children of an object; this implementation uses   {@link EditingDomain#getChildren}.
 */
protected Collection<?> getChildren(Object object){
  return domain.getChildren(object);
}
Program: 11862
Project: 11862
Buggy source:
/** 
 * This returns the orginal position to which the object will be moved upon undo.
 */
public int getOldIndex(){
  return oldIndex;
}

Fixed version (ground truth):
/** 
 * This returns the original position to which the object will be moved upon undo.
 */
public int getOldIndex(){
  return oldIndex;
}
Program: 11863
Project: 11863
Buggy source:
/** 
 * Removes the first occurence of the given target object, itself, from the collection.
 */
protected boolean removeExact(Collection<?> collection,Object target){
  for (Iterator<?> i=collection.iterator(); i.hasNext(); ) {
    if (i.next() == target) {
      i.remove();
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Removes the first occurrence of the given target object, itself, from the collection.
 */
protected boolean removeExact(Collection<?> collection,Object target){
  for (Iterator<?> i=collection.iterator(); i.hasNext(); ) {
    if (i.next() == target) {
      i.remove();
      return true;
    }
  }
  return false;
}