nus-yam/ex-repair huggingface dataset:
Program: 11864
Project: 11864
Buggy source:
/** 
 * Create an instance from the adapter factory, the specialized command stack, and the specialized resource set. If the resource set's context is null, one will be created here; otherwize, the existing context should implement   {@link org.eclipse.emf.edit.domain.IEditingDomainProvider}.
 */
public AdapterFactoryEditingDomain(AdapterFactory adapterFactory,CommandStack commandStack,ResourceSet resourceSet){
  this.adapterFactory=adapterFactory;
  this.commandStack=commandStack;
  this.resourceSet=resourceSet;
}

Fixed version (ground truth):
/** 
 * Create an instance from the adapter factory, the specialized command stack, and the specialized resource set. If the resource set's context is null, one will be created here; otherwise, the existing context should implement   {@link org.eclipse.emf.edit.domain.IEditingDomainProvider}.
 */
public AdapterFactoryEditingDomain(AdapterFactory adapterFactory,CommandStack commandStack,ResourceSet resourceSet){
  this.adapterFactory=adapterFactory;
  this.commandStack=commandStack;
  this.resourceSet=resourceSet;
}
Program: 11866
Project: 11866
Buggy source:
/** 
 * Creates a new project
 * @param projectName Name of the project
 * @return Project
 * @throws CoreException 
 * @throws Exception
 */
protected IProject createProject(String projectName,IProgressMonitor monitor) throws CoreException {
  monitor.beginTask(CheatSheetsPlugin.INSTANCE.getString("String_Node_Str",new String[]{projectName}),2);
  IWorkspaceRoot workspaceRoot=ResourcesPlugin.getWorkspace().getRoot();
  IProject project=workspaceRoot.getProject(projectName);
  if (!project.exists()) {
    project.create(new SubProgressMonitor(monitor,1));
  }
  project.open(new SubProgressMonitor(monitor,1));
  monitor.done();
  return project;
}

Fixed version (ground truth):
/** 
 * Creates a new project
 * @param projectName Name of the project
 * @return Project
 * @throws CoreException 
 * @throws CoreException
 */
protected IProject createProject(String projectName,IProgressMonitor monitor) throws CoreException {
  monitor.beginTask(CheatSheetsPlugin.INSTANCE.getString("String_Node_Str",new String[]{projectName}),2);
  IWorkspaceRoot workspaceRoot=ResourcesPlugin.getWorkspace().getRoot();
  IProject project=workspaceRoot.getProject(projectName);
  if (!project.exists()) {
    project.create(new SubProgressMonitor(monitor,1));
  }
  project.open(new SubProgressMonitor(monitor,1));
  monitor.done();
  return project;
}
Program: 11867
Project: 11867
Buggy source:
/** 
 * This constructs an instance of an action that creates a child descripted by newChildDescriptor.
 */
public CreateChildAction(IEditorPart editorPart,ISelection selection,CommandParameter newChildDescriptor){
  super(editorPart);
  this.newChildDescriptor=newChildDescriptor;
  configureAction(selection);
}

Fixed version (ground truth):
/** 
 * This constructs an instance of an action that creates a child described by newChildDescriptor.
 */
public CreateChildAction(IEditorPart editorPart,ISelection selection,CommandParameter newChildDescriptor){
  super(editorPart);
  this.newChildDescriptor=newChildDescriptor;
  configureAction(selection);
}
Program: 11868
Project: 11868
Buggy source:
/** 
 * Returns a not null list with the GenPackages that should be selected  in the Rereferenced Tree Viewer.  The list passed in the genPackage is not null and contains all GenPackages that can be marked.  This list can be both changed and returned. 
 */
protected List<GenPackage> getReferencedGenPackagesToCheck(List<GenPackage> genPackages,boolean reloadReferencedGenPackagesTable){
  return genPackages;
}

Fixed version (ground truth):
/** 
 * Returns a not null list with the GenPackages that should be selected  in the referenced Tree Viewer.  The list passed in the genPackage is not null and contains all GenPackages that can be marked.  This list can be both changed and returned. 
 */
protected List<GenPackage> getReferencedGenPackagesToCheck(List<GenPackage> genPackages,boolean reloadReferencedGenPackagesTable){
  return genPackages;
}
Program: 11869
Project: 11869
Buggy source:
/** 
 * <p>Subclasses should overwrite this method, adding the code that performs the actions required when this wizard is &quot;finished&quot;.</p> <p>The   {@link Diagnostic} returned by this method should be used to providethe user some information regarding a <b>successfull</b> convertion.  If the coversion fails, an exception should be thrown.<p>
 * @param monitor
 * @return {@link Diagnostic}
 * @throws Exception
 */
protected Diagnostic doPerformFinish(Monitor monitor) throws Exception {
  return Diagnostic.OK_INSTANCE;
}

Fixed version (ground truth):
/** 
 * <p>Subclasses should overwrite this method, adding the code that performs the actions required when this wizard is &quot;finished&quot;.</p> <p>The   {@link Diagnostic} returned by this method should be used to providethe user some information regarding a <b>successful</b> conversion.  If the conversion fails, an exception should be thrown.<p>
 * @param monitor
 * @return {@link Diagnostic}
 * @throws Exception
 */
protected Diagnostic doPerformFinish(Monitor monitor) throws Exception {
  return Diagnostic.OK_INSTANCE;
}
Program: 11870
Project: 11870
Buggy source:
/** 
 * This contructs and instance in this editing domain.
 */
public CommandActionHandler(EditingDomain domain,String label){
  super(label);
  this.domain=domain;
}

Fixed version (ground truth):
/** 
 * This constructs and instance in this editing domain.
 */
public CommandActionHandler(EditingDomain domain,String label){
  super(label);
  this.domain=domain;
}
Program: 11871
Project: 11871
Buggy source:
/** 
 * This returns the transfer ids that this agent supports.
 */
@Override protected int[] getTypeIds(){
  return new int[]{TYPE_ID};
}

Fixed version (ground truth):
/** 
 * This returns the transfer IDs that this agent supports.
 */
@Override protected int[] getTypeIds(){
  return new int[]{TYPE_ID};
}
Program: 11872
Project: 11872
Buggy source:
/** 
 * Sets the containers where the template sources are located.
 * @param templateContainers the new locations.
 * @param templateSourceContainers the new sourcelocations.
 * @since 2.1.0
 */
public void setTemplateContainers(List<Object> templateContainers,List<Object> templateSourceContainers);

Fixed version (ground truth):
/** 
 * Sets the containers where the template sources are located.
 * @param templateContainers the new locations.
 * @param templateSourceContainers the new source locations.
 * @since 2.1.0
 */
public void setTemplateContainers(List<Object> templateContainers,List<Object> templateSourceContainers);
Program: 11873
Project: 11873
Buggy source:
/** 
 * Considers all the files of a container and all it's subcontainer.
 */
protected void consider(IContainer container) throws CoreException {
  IResource[] children=container.members();
  if (children != null) {
    for (int i=0; i < children.length; ++i) {
      IResource resource=children[i];
      if (resource instanceof IFile) {
        consider((IFile)resource);
      }
 else       if (resource instanceof IContainer) {
        consider((IContainer)resource);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Considers all the files of a container and all its subcontainer.
 */
protected void consider(IContainer container) throws CoreException {
  IResource[] children=container.members();
  if (children != null) {
    for (int i=0; i < children.length; ++i) {
      IResource resource=children[i];
      if (resource instanceof IFile) {
        consider((IFile)resource);
      }
 else       if (resource instanceof IContainer) {
        consider((IContainer)resource);
      }
    }
  }
}
Program: 11875
Project: 11875
Buggy source:
/** 
 * Returns the method that will be invoked when   {@link #generate generate} called.
 * @return the generator method.
 */
public Method getMethod(){
  return method;
}

Fixed version (ground truth):
/** 
 * Returns the method that will be invoked when   {@link #generate(Monitor,Object[]) generate} called.
 * @return the generator method.
 */
public Method getMethod(){
  return method;
}
Program: 11876
Project: 11876
Buggy source:
/** 
 * Set the method that will be invoked when   {@link #generate generate} called.
 * @param method the generator method.
 */
public void setMethod(Method method){
  this.method=method;
  if ((method.getModifiers() & Modifier.STATIC) == 0 && object == null) {
    try {
      object=method.getDeclaringClass().newInstance();
    }
 catch (    IllegalAccessException exception) {
      CodeGenPlugin.INSTANCE.log(exception);
    }
catch (    InstantiationException exception) {
      CodeGenPlugin.INSTANCE.log(exception);
    }
  }
}

Fixed version (ground truth):
/** 
 * Set the method that will be invoked when   {@link #generate(Monitor,Object[]) generate} called.
 * @param method the generator method.
 */
public void setMethod(Method method){
  this.method=method;
  if ((method.getModifiers() & Modifier.STATIC) == 0 && object == null) {
    try {
      object=method.getDeclaringClass().newInstance();
    }
 catch (    IllegalAccessException exception) {
      CodeGenPlugin.INSTANCE.log(exception);
    }
catch (    InstantiationException exception) {
      CodeGenPlugin.INSTANCE.log(exception);
    }
  }
}
Program: 11877
Project: 11877
Buggy source:
/** 
 * Returns a list of classpath entries that will be added to the classpath of the internal   {@link #getProjectName project}where emitted JET templates are compiled. <p> This method must be called <b>before</b>  {@link #initialize initialize} or {@link #generate generate}are called.
 * @return a list of classpath entries.
 */
public List<IClasspathEntry> getClasspathEntries(){
  return classpathEntries;
}

Fixed version (ground truth):
/** 
 * Returns a list of classpath entries that will be added to the classpath of the internal   {@link #getProjectName project}where emitted JET templates are compiled. <p> This method must be called <b>before</b>  {@link #initialize(Monitor) initialize} or {@link #generate(Monitor,Object[]) generate}are called.
 * @return a list of classpath entries.
 */
public List<IClasspathEntry> getClasspathEntries(){
  return classpathEntries;
}
Program: 11878
Project: 11878
Buggy source:
/** 
 * Adds a builder to the build spec for the given project.
 */
protected void addToFrontOfBuildSpec(String builderID) throws CoreException {
  IProjectDescription description=getProject().getDescription();
  ICommand[] commands=description.getBuildSpec();
  boolean found=false;
  for (int i=0; i < commands.length; ++i) {
    if (commands[i].getBuilderName().equals(builderID)) {
      found=true;
      break;
    }
  }
  if (!found) {
    ICommand command=description.newCommand();
    command.setBuilderName(builderID);
    ICommand[] newCommands=new ICommand[commands.length + 1];
    System.arraycopy(commands,0,newCommands,1,commands.length);
    newCommands[0]=command;
    description.setBuildSpec(newCommands);
    getProject().setDescription(description,null);
  }
}

Fixed version (ground truth):
/** 
 * Adds a builder to the build specification for the given project.
 */
protected void addToFrontOfBuildSpec(String builderID) throws CoreException {
  IProjectDescription description=getProject().getDescription();
  ICommand[] commands=description.getBuildSpec();
  boolean found=false;
  for (int i=0; i < commands.length; ++i) {
    if (commands[i].getBuilderName().equals(builderID)) {
      found=true;
      break;
    }
  }
  if (!found) {
    ICommand command=description.newCommand();
    command.setBuilderName(builderID);
    ICommand[] newCommands=new ICommand[commands.length + 1];
    System.arraycopy(commands,0,newCommands,1,commands.length);
    newCommands[0]=command;
    description.setBuildSpec(newCommands);
    getProject().setDescription(description,null);
  }
}
Program: 11879
Project: 11879
Buggy source:
/** 
 * Register a new baseURI. This method is used to implement file inclusion. Each included file gets a uniq identifier (which is the index in the array of base URIs).
 * @return The index of the now registered file.
 */
protected void registerBaseURI(String baseURI){
  baseURIs.add(baseURI);
}

Fixed version (ground truth):
/** 
 * Register a new baseURI. This method is used to implement file inclusion. Each included file gets a unique identifier (which is the index in the array of base URIs).
 */
protected void registerBaseURI(String baseURI){
  baseURIs.add(baseURI);
}
Program: 11881
Project: 11881
Buggy source:
/** 
 * Register a new source file. This method is used to implement file inclusion. Each included file gets a uniq identifier (which is the index in the array of source files).
 * @return The index of the now registered file.
 */
protected int registerSourceFile(String file){
  sourceFiles.add(file);
  ++this.size;
  return sourceFiles.size() - 1;
}

Fixed version (ground truth):
/** 
 * Register a new source file. This method is used to implement file inclusion. Each included file gets a unique identifier (which is the index in the array of source files).
 * @return The index of the now registered file.
 */
protected int registerSourceFile(String file){
  sourceFiles.add(file);
  ++this.size;
  return sourceFiles.size() - 1;
}
Program: 11882
Project: 11882
Buggy source:
/** 
 * Parse utils - Is current character a token delimiter ? Delimiters are currently defined to be =, &gt;, &lt;, ", and ' or any any space character as defined by <code>isSpace</code>.
 * @return A boolean.
 */
protected boolean isDelimiter(){
  if (!isSpace()) {
    int ch=peekChar();
    if (ch == '=' || ch == endTagFinalChar || ch == '"' || ch == '\'' || ch == '/') {
      return true;
    }
    if (ch == '-') {
      JETMark mark=mark();
      if (((ch=nextChar()) == endTagFinalChar) || ((ch == '-') && (nextChar() == endTagFinalChar))) {
        reset(mark);
        return true;
      }
 else {
        reset(mark);
        return false;
      }
    }
    return false;
  }
 else {
    return true;
  }
}

Fixed version (ground truth):
/** 
 * Parse utilities - Is current character a token delimiter ? Delimiters are currently defined to be =, &gt;, &lt;, ", and ' or any any space character as defined by <code>isSpace</code>.
 * @return A boolean.
 */
protected boolean isDelimiter(){
  if (!isSpace()) {
    int ch=peekChar();
    if (ch == '=' || ch == endTagFinalChar || ch == '"' || ch == '\'' || ch == '/') {
      return true;
    }
    if (ch == '-') {
      JETMark mark=mark();
      if (((ch=nextChar()) == endTagFinalChar) || ((ch == '-') && (nextChar() == endTagFinalChar))) {
        reset(mark);
        return true;
      }
 else {
        reset(mark);
        return false;
      }
    }
    return false;
  }
 else {
    return true;
  }
}
Program: 11883
Project: 11883
Buggy source:
/** 
 * Utilitiy for headless operations.
 * @param mergeXML
 * @param sourceURI
 * @param targetURI
 * @return the merged content
 * @since 2.1.0
 */
public String execute(IProgressMonitor progressMonitor,String[] arguments){
  String mergeXML=arguments[0];
  String sourceURI=arguments[1];
  String targetURI=arguments[2];
  jControlModel=new JControlModel(mergeXML);
  sourceCompilationUnit=createCompilationUnitForURI(sourceURI);
  targetCompilationUnit=createCompilationUnitForURI(targetURI);
  sourcePatternDictionary=new JPatternDictionary(sourceCompilationUnit,jControlModel);
  targetPatternDictionary=new JPatternDictionary(targetCompilationUnit,jControlModel);
  merge();
  return targetCompilationUnit.getContents();
}

Fixed version (ground truth):
/** 
 * Utility for headless operations.
 * @return the merged content
 * @since 2.1.0
 */
public String execute(IProgressMonitor progressMonitor,String[] arguments){
  String mergeXML=arguments[0];
  String sourceURI=arguments[1];
  String targetURI=arguments[2];
  jControlModel=new JControlModel(mergeXML);
  sourceCompilationUnit=createCompilationUnitForURI(sourceURI);
  targetCompilationUnit=createCompilationUnitForURI(targetURI);
  sourcePatternDictionary=new JPatternDictionary(sourceCompilationUnit,jControlModel);
  targetPatternDictionary=new JPatternDictionary(targetCompilationUnit,jControlModel);
  merge();
  return targetCompilationUnit.getContents();
}
Program: 11884
Project: 11884
Buggy source:
/** 
 * Creates an input stream for the nested URL by calling   {@link URL#openStream()opening} a stream on it.
 * @param nestedURL the nested URL for which a stream is required.
 * @return the open stream of the nested URL.
 */
protected OutputStream createOutputStream(String nestedURL) throws IOException {
  URL url=new URL(nestedURL.toString());
  URLConnection urlConnection=url.openConnection();
  urlConnection.setDoOutput(true);
  return urlConnection.getOutputStream();
}

Fixed version (ground truth):
/** 
 * Creates an output stream for the nested URL by calling   {@link URL#openConnection() opening} a stream on it.
 * @param nestedURL the nested URL for which a stream is required.
 * @return the open stream of the nested URL.
 */
protected OutputStream createOutputStream(String nestedURL) throws IOException {
  URL url=new URL(nestedURL.toString());
  URLConnection urlConnection=url.openConnection();
  urlConnection.setDoOutput(true);
  return urlConnection.getOutputStream();
}
Program: 11885
Project: 11885
Buggy source:
/** 
 * Creates an input stream for the nested URL by calling   {@link URL#openStream()opening} a stream on it.
 * @param nestedURL the nested URL for which a stream is required.
 * @return the open stream of the nested URL.
 */
protected InputStream createInputStream(String nestedURL) throws IOException {
  return new URL(nestedURL).openStream();
}

Fixed version (ground truth):
/** 
 * Creates an input stream for the nested URL by calling   {@link URL#openStream() opening} a stream on it.
 * @param nestedURL the nested URL for which a stream is required.
 * @return the open stream of the nested URL.
 */
protected InputStream createInputStream(String nestedURL) throws IOException {
  return new URL(nestedURL).openStream();
}
Program: 11886
Project: 11886
Buggy source:
/** 
 * Returns whether the comamad is valid to <code>execute</code>. The   {@link UnexecutableCommand#INSTANCE}.<code>canExecute()</code> always returns <code>false</code>. This <b>must</b> be called before calling <code>execute</code>.
 * @return whether the comamad is valid to <code>execute</code>.
 */
boolean canExecute();

Fixed version (ground truth):
/** 
 * Returns whether the command is valid to <code>execute</code>. The   {@link UnexecutableCommand#INSTANCE}.<code>canExecute()</code> always returns <code>false</code>. This <b>must</b> be called before calling <code>execute</code>.
 * @return whether the command is valid to <code>execute</code>.
 */
boolean canExecute();
Program: 11887
Project: 11887
Buggy source:
/** 
 * Returns a command that represents the composition of this command with the given command. The resulting command may just be this, if this command is capabable of composition. Otherwise, it will be a new command created to compose the two. <p> Instead of the following pattern of usage <pre> Command result = x; if (condition) result = result.chain(y); </pre> you should consider using a   {@link org.eclipse.emf.common.command.CompoundCommand} and using  {@link org.eclipse.emf.common.command.CompoundCommand#unwrap()} to optimize the result:<pre> CompoundCommand subcommands = new CompoundCommand(); subcommands.append(x); if (condition) subcommands.append(y); Command result = subcommands.unwrap(); </pre> This gives you more control over how the compound command composes it's result and affected objects.
 * @param command the command to chain.
 * @return a command that represents the composition of this command with the given command.
 */
Command chain(Command command);

Fixed version (ground truth):
/** 
 * Returns a command that represents the composition of this command with the given command. The resulting command may just be this, if this command is capable of composition. Otherwise, it will be a new command created to compose the two. <p> Instead of the following pattern of usage <pre> Command result = x; if (condition) result = result.chain(y); </pre> you should consider using a   {@link org.eclipse.emf.common.command.CompoundCommand} and using  {@link org.eclipse.emf.common.command.CompoundCommand#unwrap()} to optimize the result:<pre> CompoundCommand subcommands = new CompoundCommand(); subcommands.append(x); if (condition) subcommands.append(y); Command result = subcommands.unwrap(); </pre> This gives you more control over how the compound command composes it's result and affected objects.
 * @param command the command to chain.
 * @return a command that represents the composition of this command with the given command.
 */
Command chain(Command command);
Program: 11888
Project: 11888
Buggy source:
/** 
 * Returns one of three things:   {@link org.eclipse.emf.common.command.UnexecutableCommand#INSTANCE}, if there are no commands, the one command, if there is exactly one command, or <code>this</code>, if there are multiple commands; this command is   {@link #dispose}d in the first two cases. You should only unwrap a compound command if you created it for that purpose, e.g., <pre> CompoundCommand subcommands = new CompoundCommand(); subcommands.append(x); if (condition) subcommands.append(y); Command result = subcommands.unwrap(); </pre> is a good way to create an efficient accumulated result.
 * @return the unwapped command.
 */
public Command unwrap(){
switch (commandList.size()) {
case 0:
{
      dispose();
      return UnexecutableCommand.INSTANCE;
    }
case 1:
{
    Command result=commandList.remove(0);
    dispose();
    return result;
  }
default :
{
  return this;
}
}
}

Fixed version (ground truth):
/** 
 * Returns one of three things:   {@link org.eclipse.emf.common.command.UnexecutableCommand#INSTANCE}, if there are no commands, the one command, if there is exactly one command, or <code>this</code>, if there are multiple commands; this command is   {@link #dispose}d in the first two cases. You should only unwrap a compound command if you created it for that purpose, e.g., <pre> CompoundCommand subcommands = new CompoundCommand(); subcommands.append(x); if (condition) subcommands.append(y); Command result = subcommands.unwrap(); </pre> is a good way to create an efficient accumulated result.
 * @return the unwrapped command.
 */
public Command unwrap(){
switch (commandList.size()) {
case 0:
{
      dispose();
      return UnexecutableCommand.INSTANCE;
    }
case 1:
{
    Command result=commandList.remove(0);
    dispose();
    return result;
  }
default :
{
  return this;
}
}
}
Program: 11889
Project: 11889
Buggy source:
/** 
 * Unsets the target from which the adapter will receive notification. This method is only to be called by a notifier when this adapter is removed from its adapter list. In general, an adapter may be shared by more than one notifier, so this mechanism allows the adapter to know specifically which notifier will no longer be notifying.
 * @param oldTarget the old notifier.
 * @see #getTarget
 * @see #setTarget
 */
void unsetTarget(Notifier oldTarget);

Fixed version (ground truth):
/** 
 * Unsets the target from which the adapter will receive notification. This method is only to be called by a notifier when this adapter is removed from its adapter list. In general, an adapter may be shared by more than one notifier, so this mechanism allows the adapter to know specifically which notifier will no longer be notifying.
 * @param oldTarget the old notifier.
 * @see #getTarget()
 * @see #setTarget(Notifier)
 */
void unsetTarget(Notifier oldTarget);
Program: 11890
Project: 11890
Buggy source:
/** 
 * Returns true if this notification represents an event that did not change the state of the notifying object. For the events   {@link #ADD},   {@link #ADD_MANY},   {@link #REMOVE},   {@link #REMOVE_MANY},   {@link #MOVE},  it always returns false. For the events   {@link #RESOLVE} and {@link #REMOVING_ADAPTER} it always returns true.For the events  {@link #SET} and {@link #UNSET} it returns true if the old and the new value are equal;In addition, for certain types of features there may be a distiction between  being set to a default value and not being set at all, which implies that it has the default value. In this situation, even in the case that the old and new values are equal,  isTouch may never the less return false in order to indicate that, although the value has not changed, the feature has gone from simply having a default value to being set to that same default value, or has gone from being set to the default value back to being unset.
 * @return whether or not this is a state changing modification.
 */
boolean isTouch();

Fixed version (ground truth):
/** 
 * Returns true if this notification represents an event that did not change the state of the notifying object. For the events   {@link #ADD},   {@link #ADD_MANY},   {@link #REMOVE},   {@link #REMOVE_MANY},   {@link #MOVE},  it always returns false. For the events   {@link #RESOLVE} and {@link #REMOVING_ADAPTER} it always returns true.For the events  {@link #SET} and {@link #UNSET} it returns true if the old and the new value are equal;In addition, for certain types of features there may be a distinction between  being set to a default value and not being set at all, which implies that it has the default value. In this situation, even in the case that the old and new values are equal,  isTouch may never the less return false in order to indicate that, although the value has not changed, the feature has gone from simply having a default value to being set to that same default value, or has gone from being set to the default value back to being unset.
 * @return whether or not this is a state changing modification.
 */
boolean isTouch();
Program: 11891
Project: 11891
Buggy source:
/** 
 * Returns the position within a list-based feature at which the change occurred. It returns   {@link #NO_INDEX} when not applicable.
 * @return the positition at which the change occurred.
 */
int getPosition();

Fixed version (ground truth):
/** 
 * Returns the position within a list-based feature at which the change occurred. It returns   {@link #NO_INDEX} when not applicable.
 * @return the position at which the change occurred.
 */
int getPosition();
Program: 11895
Project: 11895
Buggy source:
public void validate(){
  Resource mainResource=editingDomain.getResourceSet().getResources().get(0);
  GenModel genModel=(GenModel)mainResource.getContents().get(0);
  genModel.setValidateModel(true);
  Diagnostic diagnostic=genModel.diagnose();
  if (diagnostic.getSeverity() != Diagnostic.OK) {
    Diagnostic mapDiagnostic=resourceToDiagnosticMap.get(mainResource);
    if (mapDiagnostic != null) {
      ((DiagnosticChain)diagnostic).add(mapDiagnostic);
    }
    resourceToDiagnosticMap.put(mainResource,diagnostic);
  }
}

Fixed version (ground truth):
public void validate(){
  Resource mainResource=editingDomain.getResourceSet().getResources().get(0);
  GenModel genModel=(GenModel)mainResource.getContents().get(0);
  genModel.setValidateModel(true);
  Diagnostic diagnostic=genModel.diagnose();
  if (diagnostic.getSeverity() != Diagnostic.OK) {
    markerHelper=new ValidateAction.EclipseResourcesUtil();
    Diagnostic mapDiagnostic=resourceToDiagnosticMap.get(mainResource);
    if (mapDiagnostic != null) {
      ((DiagnosticChain)diagnostic).add(mapDiagnostic);
    }
    resourceToDiagnosticMap.put(mainResource,diagnostic);
  }
}
Program: 11896
Project: 11896
Buggy source:
/** 
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated
 */
public void gotoMarker(IMarker marker){
  try {
    if (marker.getType().equals(EValidator.MARKER)) {
      String uriAttribute=marker.getAttribute(EValidator.URI_ATTRIBUTE,null);
      if (uriAttribute != null) {
        URI uri=URI.createURI(uriAttribute);
        EObject eObject=editingDomain.getResourceSet().getEObject(uri,true);
        if (eObject != null) {
          setSelectionToViewer(Collections.singleton(editingDomain.getWrapper(eObject)));
        }
      }
    }
  }
 catch (  CoreException exception) {
    GenModelEditPlugin.INSTANCE.log(exception);
  }
}

Fixed version (ground truth):
/** 
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated NOT
 */
public void gotoMarker(IMarker marker){
  try {
    if (marker.exists() && marker.getType().equals(EValidator.MARKER)) {
      String uriAttribute=marker.getAttribute(EValidator.URI_ATTRIBUTE,null);
      if (uriAttribute != null) {
        URI uri=URI.createURI(uriAttribute);
        EObject eObject=editingDomain.getResourceSet().getEObject(uri,true);
        if (eObject != null) {
          setSelectionToViewer(Collections.singleton(editingDomain.getWrapper(eObject)));
        }
      }
    }
  }
 catch (  CoreException exception) {
    GenModelEditPlugin.INSTANCE.log(exception);
  }
}
Program: 11897
Project: 11897
Buggy source:
/** 
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated NOT
 */
protected EStructuralFeature getChildFeature(Object object,Object child){
  EOperation eOperation=(EOperation)object;
  if (child instanceof EObject) {
    EObject eObject=(EObject)child;
    if (eObject.eContainer() == eOperation) {
      return eObject.eContainingFeature();
    }
  }
  if (eOperation.getEGenericType() == null) {
    return EcorePackage.Literals.ETYPED_ELEMENT__EGENERIC_TYPE;
  }
 else {
    return EcorePackage.Literals.EOPERATION__EGENERIC_EXCEPTIONS;
  }
}

Fixed version (ground truth):
/** 
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated NOT
 */
protected EStructuralFeature getChildFeature(Object object,Object child){
  EOperation eOperation=(EOperation)object;
  if (child instanceof EObject) {
    EObject eObject=(EObject)child;
    if (eObject.eContainer() == eOperation) {
      return eObject.eContainingFeature();
    }
  }
  if (child instanceof EGenericType) {
    if (eOperation.getEGenericType() == null) {
      return EcorePackage.Literals.ETYPED_ELEMENT__EGENERIC_TYPE;
    }
 else {
      return EcorePackage.Literals.EOPERATION__EGENERIC_EXCEPTIONS;
    }
  }
 else {
    return super.getChildFeature(object,child);
  }
}
Program: 11901
Project: 11901
Buggy source:
protected void verifyMerge(String targetContents){
  StringBuffer mergeResult=new StringBuffer(targetContents);
  for (int i=mergeResult.length() - 1; i >= 0; i--) {
    if ('\r' == mergeResult.charAt(i)) {
      mergeResult.deleteCharAt(i);
    }
  }
  String expectedMerge=TestUtil.readFile(expected,false);
  String actualMerge=mergeResult.toString();
  if (expectedMerge == null ? actualMerge == null : expectedMerge.equals(actualMerge)) {
    System.out.println("String_Node_Str");
  }
 else {
    System.out.println("String_Node_Str");
    System.out.println("String_Node_Str" + expectedMerge);
    System.out.println("String_Node_Str" + actualMerge);
  }
  assertEquals("String_Node_Str",expectedMerge,actualMerge);
}

Fixed version (ground truth):
protected void verifyMerge(String targetContents){
  StringBuffer mergeResult=new StringBuffer(targetContents);
  for (int i=mergeResult.length() - 1; i >= 0; i--) {
    if ('\r' == mergeResult.charAt(i)) {
      mergeResult.deleteCharAt(i);
    }
  }
  String expectedMerge=TestUtil.readFile(expected,false);
  String actualMerge=mergeResult.toString();
  if (expectedMerge == null ? actualMerge == null : expectedMerge.equals(actualMerge)) {
    System.out.println("String_Node_Str" + getName());
  }
 else {
    System.out.println("String_Node_Str" + getName());
    System.out.println("String_Node_Str" + expectedMerge);
    System.out.println("String_Node_Str" + actualMerge);
  }
  assertEquals("String_Node_Str",expectedMerge,actualMerge);
}
Program: 11904
Project: 11904
Buggy source:
protected int sameDocSingle(EObject o,EStructuralFeature f){
  InternalEObject value=(InternalEObject)helper.getValue(o,f);
  if (value == null) {
    return SKIP;
  }
 else   if (value.eIsProxy()) {
    return CROSS_DOC;
  }
 else {
    Resource res=value.eResource();
    return res == helper.getResource() ? SAME_DOC : CROSS_DOC;
  }
}

Fixed version (ground truth):
protected int sameDocSingle(EObject o,EStructuralFeature f){
  InternalEObject value=(InternalEObject)helper.getValue(o,f);
  if (value == null) {
    return SKIP;
  }
 else   if (value.eIsProxy()) {
    return CROSS_DOC;
  }
 else {
    Resource res=value.eResource();
    return res == helper.getResource() || res == null ? SAME_DOC : CROSS_DOC;
  }
}
Program: 11905
Project: 11905
Buggy source:
protected void saveHref(EObject remote,EStructuralFeature f){
  String href=helper.getHREF(remote);
  if (href != null) {
    if (escapeURI != null) {
      href=escapeURI.convert(href);
    }
    if (!toDOM) {
      String name=helper.getQName(f);
      doc.startElement(name);
    }
 else {
      helper.populateNameInfo(nameInfo,f);
      Element elem=document.createElementNS(nameInfo.getNamespaceURI(),nameInfo.getQualifiedName());
      currentNode=currentNode.appendChild(elem);
      handler.recordValues(elem,remote.eContainer(),f,remote);
    }
    EClass eClass=remote.eClass();
    EClass expectedType=(EClass)f.getEType();
    if (saveTypeInfo ? xmlTypeInfo.shouldSaveType(eClass,expectedType,f) : eClass != expectedType && expectedType.isAbstract()) {
      saveTypeAttribute(eClass);
    }
    if (!toDOM) {
      doc.addAttribute(XMLResource.HREF,href);
      doc.endEmptyElement();
    }
 else {
      ((Element)currentNode).setAttributeNS(null,XMLResource.HREF,href);
      currentNode=currentNode.getParentNode();
    }
  }
}

Fixed version (ground truth):
protected void saveHref(EObject remote,EStructuralFeature f){
  String href=helper.getHREF(remote);
  if (href != null) {
    if (escapeURI != null) {
      href=escapeURI.convert(href);
    }
    if (!toDOM) {
      String name=helper.getQName(f);
      doc.startElement(name);
    }
 else {
      helper.populateNameInfo(nameInfo,f);
      Element elem=document.createElementNS(nameInfo.getNamespaceURI(),nameInfo.getQualifiedName());
      currentNode=currentNode.appendChild(elem);
      handler.recordValues(elem,remote.eContainer(),f,remote);
    }
    EClass eClass=remote.eClass();
    EClass expectedType=(EClass)f.getEType();
    if (saveTypeInfo ? xmlTypeInfo.shouldSaveType(eClass,expectedType,f) : eClass != expectedType && expectedType.isAbstract()) {
      saveTypeAttribute(eClass);
    }
    if (!toDOM) {
      doc.addAttribute(XMLResource.HREF,href);
      if (eObjectToExtensionMap != null) {
        processAttributeExtensions(remote);
        if (processElementExtensions(remote)) {
          doc.endElement();
        }
 else {
          doc.endEmptyElement();
        }
      }
 else {
        doc.endEmptyElement();
      }
    }
 else {
      ((Element)currentNode).setAttributeNS(null,XMLResource.HREF,href);
      if (eObjectToExtensionMap != null) {
        processAttributeExtensions(remote);
        processElementExtensions(remote);
      }
      currentNode=currentNode.getParentNode();
    }
  }
}
Program: 11906
Project: 11906
Buggy source:
protected int sameDocMany(EObject o,EStructuralFeature f){
  InternalEList values=(InternalEList)helper.getValue(o,f);
  if (values.isEmpty()) {
    return SKIP;
  }
  for (Iterator i=values.basicIterator(); i.hasNext(); ) {
    InternalEObject value=(InternalEObject)i.next();
    if (value.eIsProxy() || value.eResource() != helper.getResource()) {
      return CROSS_DOC;
    }
  }
  return SAME_DOC;
}

Fixed version (ground truth):
protected int sameDocMany(EObject o,EStructuralFeature f){
  InternalEList values=(InternalEList)helper.getValue(o,f);
  if (values.isEmpty()) {
    return SKIP;
  }
  for (Iterator i=values.basicIterator(); i.hasNext(); ) {
    InternalEObject value=(InternalEObject)i.next();
    if (value.eIsProxy()) {
      return CROSS_DOC;
    }
 else {
      Resource resource=value.eResource();
      if (resource != helper.getResource() && resource != null) {
        return CROSS_DOC;
      }
    }
  }
  return SAME_DOC;
}
Program: 11907
Project: 11907
Buggy source:
public boolean shouldSaveType(EClass objectType,EClass featureType,EStructuralFeature feature){
  return objectType != featureType;
}

Fixed version (ground truth):
public boolean shouldSaveType(EClass objectType,EClass featureType,EStructuralFeature feature){
  return objectType != featureType && featureType.isAbstract();
}
Program: 11908
Project: 11908
Buggy source:
/** 
 * Add object to extent and call processObject.
 */
protected void processTopObject(EObject object){
  if (object != null) {
    if (deferredExtent != null) {
      deferredExtent.add(object);
    }
 else {
      extent.addUnique(object);
    }
    if (extendedMetaData != null) {
      FeatureMap featureMap=(FeatureMap)mixedTargets.pop();
      EStructuralFeature target=extendedMetaData.getMixedFeature(object.eClass());
      if (target != null) {
        FeatureMap otherFeatureMap=(FeatureMap)object.eGet(target);
        for (Iterator i=featureMap.iterator(); i.hasNext(); ) {
          FeatureMap.Entry entry=(FeatureMap.Entry)i.next();
          if (entry.getEStructuralFeature() != XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__TEXT || !"String_Node_Str".equals(XMLTypeUtil.normalize(entry.getValue().toString(),true))) {
            otherFeatureMap.add(entry.getEStructuralFeature(),entry.getValue());
          }
        }
      }
      text=null;
    }
  }
  processObject(object);
}

Fixed version (ground truth):
/** 
 * Add object to extent and call processObject.
 */
protected void processTopObject(EObject object){
  if (object != null) {
    if (deferredExtent != null) {
      deferredExtent.add(object);
    }
 else {
      extent.addUnique(object);
    }
    if (extendedMetaData != null && !mixedTargets.isEmpty()) {
      FeatureMap featureMap=(FeatureMap)mixedTargets.pop();
      EStructuralFeature target=extendedMetaData.getMixedFeature(object.eClass());
      if (target != null) {
        FeatureMap otherFeatureMap=(FeatureMap)object.eGet(target);
        for (Iterator i=featureMap.iterator(); i.hasNext(); ) {
          FeatureMap.Entry entry=(FeatureMap.Entry)i.next();
          if (entry.getEStructuralFeature() != XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__TEXT || !"String_Node_Str".equals(XMLTypeUtil.normalize(entry.getValue().toString(),true))) {
            otherFeatureMap.add(entry.getEStructuralFeature(),entry.getValue());
          }
        }
      }
      text=null;
    }
  }
  processObject(object);
}
Program: 11909
Project: 11909
Buggy source:
protected void recordUnknownFeature(String prefix,String name,boolean isElement,EObject peekObject,String value){
  if (isElement) {
    AnyType anyType=getExtension(peekObject);
    objects.push(anyType);
    mixedTargets.push(anyType.getAny());
    types.push(UNKNOWN_FEATURE_TYPE);
    int unknownFeatureIndex=types.size() - 1;
    ;
    handleFeature(prefix,name);
    objects.remove(unknownFeatureIndex);
    mixedTargets.remove(unknownFeatureIndex);
    types.remove(unknownFeatureIndex);
  }
 else {
    AnyType anyType=getExtension(peekObject);
    setAttribValue(anyType,prefix == null ? name : prefix + "String_Node_Str" + name,value);
  }
}

Fixed version (ground truth):
protected void recordUnknownFeature(String prefix,String name,boolean isElement,EObject peekObject,String value){
  if (isElement) {
    AnyType anyType=getExtension(peekObject);
    int objectsIndex=objects.size();
    objects.push(anyType);
    int mixedTargetsIndex=mixedTargets.size();
    mixedTargets.push(anyType.getAny());
    int typesIndex=types.size();
    types.push(UNKNOWN_FEATURE_TYPE);
    handleFeature(prefix,name);
    objects.remove(objectsIndex);
    mixedTargets.remove(mixedTargetsIndex);
    types.remove(typesIndex);
  }
 else {
    AnyType anyType=getExtension(peekObject);
    setAttribValue(anyType,prefix == null ? name : prefix + "String_Node_Str" + name,value);
  }
}
Program: 11910
Project: 11910
Buggy source:
protected JNode insertClone(JNode sourceNode){
  Object context=targetCompilationUnit != null ? getControlModel().getFacadeHelper().getContext(targetCompilationUnit) : null;
  JNode targetNode=getControlModel().getFacadeHelper().cloneNode(context,sourceNode);
  if (targetNode != null) {
    map(sourceNode,targetNode);
    mapChildren(sourceNode,targetNode);
  }
 else {
  }
  for (JNode previousNode=getControlModel().getFacadeHelper().getPrevious(sourceNode); previousNode != null; previousNode=getControlModel().getFacadeHelper().getPrevious(previousNode)) {
    JNode targetSibling=(JNode)sourceToTargetMap.get(previousNode);
    if (targetSibling != null) {
      JNode targetNextSibling=getControlModel().getFacadeHelper().getNext(targetSibling);
      if (targetNextSibling == null) {
        getControlModel().getFacadeHelper().addChild(targetSibling.getParent(),targetNode);
      }
 else {
        getControlModel().getFacadeHelper().insertSibling(targetNextSibling,targetNode,true);
      }
      return targetNode;
    }
  }
  JNode sourceParent=sourceNode.getParent();
  if (sourceParent != null) {
    JNode targetParent=(JNode)sourceToTargetMap.get(sourceParent);
    JNode targetSibling=getControlModel().getFacadeHelper().getFirstChild(targetParent);
    if (targetSibling == null) {
      getControlModel().getFacadeHelper().addChild(targetParent.getParent(),targetNode);
    }
 else {
      getControlModel().getFacadeHelper().insertSibling(targetSibling,targetNode,true);
    }
  }
  return targetNode;
}

Fixed version (ground truth):
protected JNode insertClone(JNode sourceNode){
  Object context=targetCompilationUnit != null ? getControlModel().getFacadeHelper().getContext(targetCompilationUnit) : null;
  JNode targetNode=getControlModel().getFacadeHelper().cloneNode(context,sourceNode);
  if (targetNode != null) {
    map(sourceNode,targetNode);
    mapChildren(sourceNode,targetNode);
  }
 else {
  }
  for (JNode previousNode=getControlModel().getFacadeHelper().getPrevious(sourceNode); previousNode != null; previousNode=getControlModel().getFacadeHelper().getPrevious(previousNode)) {
    JNode targetSibling=(JNode)sourceToTargetMap.get(previousNode);
    if (targetSibling != null) {
      JNode targetNextSibling=getControlModel().getFacadeHelper().getNext(targetSibling);
      if (targetNextSibling == null) {
        getControlModel().getFacadeHelper().addChild(targetSibling.getParent(),targetNode);
      }
 else {
        getControlModel().getFacadeHelper().insertSibling(targetNextSibling,targetNode,true);
      }
      return targetNode;
    }
  }
  JNode sourceParent=sourceNode.getParent();
  if (sourceParent != null) {
    JNode targetParent=(JNode)sourceToTargetMap.get(sourceParent);
    JNode targetSibling=getControlModel().getFacadeHelper().getFirstChild(targetParent);
    if (targetSibling == null) {
      getControlModel().getFacadeHelper().addChild(targetParent,targetNode);
    }
 else {
      getControlModel().getFacadeHelper().insertSibling(targetSibling,targetNode,true);
    }
  }
  return targetNode;
}
Program: 11911
Project: 11911
Buggy source:
public void reset(){
  this.xmlResource=null;
  this.extendedMetaData=null;
  eClassFeatureNamePairToEStructuralFeatureMap=null;
  if (isOptionUseXMLNameToFeatureSet && helper instanceof XMLHelperImpl) {
    featuresToKinds=((XMLHelperImpl)helper).featuresToKinds;
  }
 else {
    featuresToKinds=null;
  }
  if (ecoreBuilder != null) {
    this.ecoreBuilder.setExtendedMetaData(null);
  }
  this.helper=null;
  elements.clear();
  objects.clear();
  mixedTargets.clear();
  contextFeature=null;
  eObjectToExtensionMap=null;
  externalURIToLocations=null;
  types.clear();
  prefixesToFactories.clear();
  forwardSingleReferences.clear();
  forwardManyReferences.clear();
  sameDocumentProxies.clear();
  for (int i=0; i < identifiers.length; i++) {
    identifiers[i]=null;
  }
  for (int i=0; i < positions.length; i++) {
    positions[i]=0;
  }
  capacity=ARRAY_SIZE;
  resourceSet=null;
  packageRegistry=null;
  resourceURI=null;
  extent=null;
  attribs=null;
  locator=null;
  urisToLocations=null;
}

Fixed version (ground truth):
public void reset(){
  this.xmlResource=null;
  this.extendedMetaData=null;
  eClassFeatureNamePair.eClass=null;
  eClassFeatureNamePairToEStructuralFeatureMap=null;
  if (isOptionUseXMLNameToFeatureSet && helper instanceof XMLHelperImpl) {
    featuresToKinds=((XMLHelperImpl)helper).featuresToKinds;
  }
 else {
    featuresToKinds=null;
  }
  if (ecoreBuilder != null) {
    this.ecoreBuilder.setExtendedMetaData(null);
  }
  this.helper=null;
  elements.clear();
  objects.clear();
  mixedTargets.clear();
  contextFeature=null;
  eObjectToExtensionMap=null;
  externalURIToLocations=null;
  types.clear();
  prefixesToFactories.clear();
  forwardSingleReferences.clear();
  forwardManyReferences.clear();
  sameDocumentProxies.clear();
  for (int i=0; i < identifiers.length; i++) {
    identifiers[i]=null;
  }
  for (int i=0; i < positions.length; i++) {
    positions[i]=0;
  }
  capacity=ARRAY_SIZE;
  resourceSet=null;
  packageRegistry=null;
  resourceURI=null;
  extent=null;
  attribs=null;
  locator=null;
  urisToLocations=null;
}
Program: 11913
Project: 11913
Buggy source:
/** 
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated NOT
 */
public void setReferenceValue(EObject newReferenceValue){
  EObject oldReferenceValue=basicGetReferenceValue();
  value=newReferenceValue;
  if (value instanceof EEnumLiteral) {
    eFlags&=~REFVALUE_FEATURECHANGE;
  }
 else {
    eFlags|=REFVALUE_FEATURECHANGE;
  }
  valueString=null;
  if (eNotificationRequired())   eNotify(new ENotificationImpl(this,Notification.SET,ChangePackage.FEATURE_CHANGE__REFERENCE_VALUE,oldReferenceValue,newReferenceValue));
}

Fixed version (ground truth):
/** 
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated NOT
 */
public void setReferenceValue(EObject newReferenceValue){
  EObject oldReferenceValue=basicGetReferenceValue();
  value=newReferenceValue;
  valueString=null;
  if (eNotificationRequired())   eNotify(new ENotificationImpl(this,Notification.SET,ChangePackage.FEATURE_CHANGE__REFERENCE_VALUE,oldReferenceValue,newReferenceValue));
}
Program: 11914
Project: 11914
Buggy source:
/** 
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated NOT
 */
public EObject basicGetReferenceValue(){
  return (eFlags & REFVALUE_FEATURECHANGE) != 0 ? (EObject)value : null;
}

Fixed version (ground truth):
/** 
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 * @generated NOT
 */
public EObject basicGetReferenceValue(){
  return (feature instanceof EReference && !feature.isMany()) ? (EObject)value : null;
}
Program: 11915
Project: 11915
Buggy source:
protected void setValue(Object value){
  EStructuralFeature feature=getFeature();
  if (!eNotificationRequired() || feature.isMany()) {
    valueString=null;
    this.value=value;
    if (value instanceof EObject && !(value instanceof EEnumLiteral)) {
      eFlags|=REFVALUE_FEATURECHANGE;
    }
 else {
      eFlags&=~REFVALUE_FEATURECHANGE;
    }
  }
 else {
    if (feature instanceof EAttribute) {
      EDataType type=(EDataType)feature.getEType();
      setDataValue(EcoreUtil.convertToString(type,value));
      this.value=value;
      eFlags&=~REFVALUE_FEATURECHANGE;
    }
 else {
      setReferenceValue((EObject)value);
    }
  }
}

Fixed version (ground truth):
protected void setValue(Object value){
  EStructuralFeature feature=getFeature();
  if (!eNotificationRequired() || feature.isMany()) {
    valueString=null;
    this.value=value;
  }
 else {
    if (feature instanceof EAttribute) {
      EDataType type=(EDataType)feature.getEType();
      setDataValue(EcoreUtil.convertToString(type,value));
      this.value=value;
    }
 else {
      setReferenceValue((EObject)value);
    }
  }
}