nus-yam/ex-repair huggingface dataset:
Program: 11767
Project: 11767
Buggy source:
/** 
 * @return an observable manager where {@link ObservablesManager#runAndCollect(Runnable)} is working
 */
public static ObservablesManager getObservableManager(){
  return new CustomObservablesManager();
}

Fixed version (ground truth):
/** 
 * @return an observable manager where {@link ObservablesManager#runAndCollect(Runnable)} is working
 */
public static ObservablesManager getObservableManager(){
  return new EMFObservablesManager();
}
Program: 11768
Project: 11768
Buggy source:
private void addStatusSupport(final DataBindingContext ctx){
  final AggregateValidationStatus aggregateStatus=new AggregateValidationStatus(ctx.getValidationStatusProviders(),AggregateValidationStatus.MAX_SEVERITY);
  aggregateStatus.addValueChangeListener(new IValueChangeListener(){
    public void handleValueChange(    ValueChangeEvent event){
      handleStateChange((IStatus)event.diff.getNewValue(),ctx);
    }
  }
);
}

Fixed version (ground truth):
private void addStatusSupport(final DataBindingContext ctx){
  aggregateStatus=new AggregateValidationStatus(ctx.getValidationStatusProviders(),AggregateValidationStatus.MAX_SEVERITY);
  aggregateStatus.addValueChangeListener(new IValueChangeListener(){
    public void handleValueChange(    ValueChangeEvent event){
      handleStateChange((IStatus)event.diff.getNewValue(),ctx);
    }
  }
);
}
Program: 11769
Project: 11769
Buggy source:
/** 
 * release all sources allocated
 */
public void dispose(){
  if (projectImage != null) {
    projectImage.dispose();
  }
  committerPart.dispose();
  if (ctx != null) {
    ctx.dispose();
  }
}

Fixed version (ground truth):
/** 
 * release all sources allocated
 */
public void dispose(){
  if (aggregateStatus != null) {
    aggregateStatus.dispose();
  }
  if (projectImage != null) {
    projectImage.dispose();
  }
  committerPart.dispose();
  if (ctx != null) {
    ctx.dispose();
  }
}
Program: 11771
Project: 11771
Buggy source:
public void handleMapChange(MapChangeEvent event){
  Set<?> affectedElements=event.diff.getChangedKeys();
  LabelProviderChangedEvent newEvent=new LabelProviderChangedEvent(TreeLabelProviderImpl.this,affectedElements.toArray());
  fireLabelProviderChanged(newEvent);
}

Fixed version (ground truth):
public void handleMapChange(MapChangeEvent event){
  Set<?> affectedElements=event.diff.getChangedKeys();
  if (!affectedElements.isEmpty()) {
    LabelProviderChangedEvent newEvent=new LabelProviderChangedEvent(TreeLabelProviderImpl.this,affectedElements.toArray());
    fireLabelProviderChanged(newEvent);
  }
}
Program: 11773
Project: 11773
Buggy source:
public Object execute(ExecutionEvent event) throws ExecutionException {
  IEvaluationContext ctx=(IEvaluationContext)event.getApplicationContext();
  Shell shell=(Shell)ctx.getVariable(ISources.ACTIVE_WORKBENCH_WINDOW_SHELL_NAME);
  FileDialog dialog=new FileDialog(shell,SWT.OPEN);
  String name=dialog.open();
  if (name != null) {
    File f=new File(name);
    try {
      IWorkbenchWindow w=(IWorkbenchWindow)ctx.getVariable(ISources.ACTIVE_WORKBENCH_WINDOW_NAME);
      String path=f.toURL().toString();
      path=path.replaceFirst("String_Node_Str","String_Node_Str");
      w.getActivePage().showView(ProjectAdminViewPart.ID,path,IWorkbenchPage.VIEW_ACTIVATE);
    }
 catch (    PartInitException e) {
      e.printStackTrace();
    }
catch (    MalformedURLException e) {
      e.printStackTrace();
    }
  }
  return null;
}

Fixed version (ground truth):
public Object execute(ExecutionEvent event) throws ExecutionException {
  IEvaluationContext ctx=(IEvaluationContext)event.getApplicationContext();
  Shell shell=(Shell)ctx.getVariable(ISources.ACTIVE_WORKBENCH_WINDOW_SHELL_NAME);
  FileDialog dialog=new FileDialog(shell,SWT.OPEN);
  String name=dialog.open();
  if (name != null) {
    File f=new File(name);
    try {
      IWorkbenchWindow w=(IWorkbenchWindow)ctx.getVariable(ISources.ACTIVE_WORKBENCH_WINDOW_NAME);
      String path=f.toURL().toString();
      path=path.replaceAll("String_Node_Str","String_Node_Str");
      w.getActivePage().showView(ProjectAdminViewPart.ID,path,IWorkbenchPage.VIEW_ACTIVATE);
    }
 catch (    PartInitException e) {
      e.printStackTrace();
    }
catch (    MalformedURLException e) {
      e.printStackTrace();
    }
  }
  return null;
}
Program: 11774
Project: 11774
Buggy source:
@Override public void createPartControl(Composite parent){
  String path=getViewSite().getSecondaryId().replaceFirst("String_Node_Str","String_Node_Str");
  resource=Activator.getDefault().loadResource(path);
  modelListener=new IModelResource.Listener(){
    public void dirtyStateChanged(){
      firePropertyChange(PROP_DIRTY);
    }
    public void commandStackChanged(){
    }
  }
;
  resource.addListener(modelListener);
  if (resource == null) {
    throw new RuntimeException("String_Node_Str");
  }
  toolkit=new FormToolkit(parent.getDisplay());
  sashForm=new SashForm(parent,SWT.HORIZONTAL);
  mgr=new ObservablesManager();
  mgr.runAndCollect(new Runnable(){
    public void run(){
      projectExplorer=new ProjectExplorerPart(getViewSite(),sashForm,toolkit,resource.getFoundation());
      projectDataForm=new ProjectFormAreaPart(getViewSite(),sashForm,toolkit,resource,projectExplorer.getProjectObservable());
    }
  }
);
  int left=(int)(100 * divider);
  sashForm.setWeights(new int[]{left,100 - left});
  makeActions();
}

Fixed version (ground truth):
@Override public void createPartControl(Composite parent){
  String path=getViewSite().getSecondaryId().replaceAll("String_Node_Str","String_Node_Str");
  resource=Activator.getDefault().loadResource(path);
  modelListener=new IModelResource.Listener(){
    public void dirtyStateChanged(){
      firePropertyChange(PROP_DIRTY);
    }
    public void commandStackChanged(){
    }
  }
;
  resource.addListener(modelListener);
  if (resource == null) {
    throw new RuntimeException("String_Node_Str");
  }
  toolkit=new FormToolkit(parent.getDisplay());
  sashForm=new SashForm(parent,SWT.HORIZONTAL);
  mgr=new ObservablesManager();
  mgr.runAndCollect(new Runnable(){
    public void run(){
      projectExplorer=new ProjectExplorerPart(getViewSite(),sashForm,toolkit,resource.getFoundation());
      projectDataForm=new ProjectFormAreaPart(getViewSite(),sashForm,toolkit,resource,projectExplorer.getProjectObservable());
    }
  }
);
  int left=(int)(100 * divider);
  sashForm.setWeights(new int[]{left,100 - left});
  makeActions();
}
Program: 11775
Project: 11775
Buggy source:
private void handleStateChange(IStatus currentStatus,DataBindingContext ctx){
  if (form.isDisposed()) {
    return;
  }
  if (currentStatus != null && currentStatus.getSeverity() != IStatus.OK) {
    int type=convertType(currentStatus.getSeverity());
    List<IMessage> list=new ArrayList<IMessage>();
    for (Iterator<?> it=ctx.getValidationStatusProviders().iterator(); it.hasNext(); ) {
      ValidationStatusProvider validationStatusProvider=(ValidationStatusProvider)it.next();
      final IStatus status=(IStatus)validationStatusProvider.getValidationStatus().getValue();
      if (!status.isOK()) {
        list.add(new IMessage(){
          public Control getControl(){
            return null;
          }
          public Object getData(){
            return null;
          }
          public Object getKey(){
            return null;
          }
          public String getPrefix(){
            return null;
          }
          public String getMessage(){
            return status.getMessage();
          }
          public int getMessageType(){
            return convertType(status.getSeverity());
          }
        }
);
      }
    }
    form.setMessage("String_Node_Str",type,list.toArray(new IMessage[0]));
  }
 else {
    form.setMessage(null);
  }
}

Fixed version (ground truth):
private void handleStateChange(IStatus currentStatus,DataBindingContext ctx){
  if (form.isDisposed() || form.getHead().isDisposed()) {
    return;
  }
  if (currentStatus != null && currentStatus.getSeverity() != IStatus.OK) {
    int type=convertType(currentStatus.getSeverity());
    List<IMessage> list=new ArrayList<IMessage>();
    for (Iterator<?> it=ctx.getValidationStatusProviders().iterator(); it.hasNext(); ) {
      ValidationStatusProvider validationStatusProvider=(ValidationStatusProvider)it.next();
      final IStatus status=(IStatus)validationStatusProvider.getValidationStatus().getValue();
      if (!status.isOK()) {
        list.add(new IMessage(){
          public Control getControl(){
            return null;
          }
          public Object getData(){
            return null;
          }
          public Object getKey(){
            return null;
          }
          public String getPrefix(){
            return null;
          }
          public String getMessage(){
            return status.getMessage();
          }
          public int getMessageType(){
            return convertType(status.getSeverity());
          }
        }
);
      }
    }
    form.setMessage("String_Node_Str",type,list.toArray(new IMessage[0]));
  }
 else {
    form.setMessage(null);
  }
}
Program: 11778
Project: 11778
Buggy source:
/** 
 * Does the work of fetching the image associated with the key, when the image resource is not available locally.
 * @param key the key of the image to fetch.
 * @exception MissingResourceException if the image resource doesn't exist anywhere.
 * @see #delegateResourceLocators
 */
protected Object delegatedGetImage(String key) throws MissingResourceException {
  ResourceLocator[] delegateResourceLocators=getDelegateResourceLocators();
  for (int i=0; i < delegateResourceLocators.length; ++i) {
    try {
      return delegateResourceLocators[i].getImage(key);
    }
 catch (    MissingResourceException exception) {
    }
  }
  throw new MissingResourceException(CommonPlugin.INSTANCE.getString("String_Node_Str",new Object[]{key}),getClass().getName(),key);
}

Fixed version (ground truth):
/** 
 * Does the work of fetching the image associated with the key, when the image resource is not available locally.
 * @param key the key of the image to fetch.
 * @exception MissingResourceException if the image resource doesn't exist anywhere.
 * @see #getDelegateResourceLocators()
 */
protected Object delegatedGetImage(String key) throws MissingResourceException {
  ResourceLocator[] delegateResourceLocators=getDelegateResourceLocators();
  for (int i=0; i < delegateResourceLocators.length; ++i) {
    try {
      return delegateResourceLocators[i].getImage(key);
    }
 catch (    MissingResourceException exception) {
    }
  }
  throw new MissingResourceException(CommonPlugin.INSTANCE.getString("String_Node_Str",new Object[]{key}),getClass().getName(),key);
}
Program: 11779
Project: 11779
Buggy source:
/** 
 * Does the work of fetching the string associated with the key, when the string resource is not available locally.
 * @param key the key of the string to fetch.
 * @exception MissingResourceException if the string resource doesn't exist anywhere.
 * @see #delegateResourceLocators
 */
protected String delegatedGetString(String key,boolean translate){
  ResourceLocator[] delegateResourceLocators=getDelegateResourceLocators();
  for (int i=0; i < delegateResourceLocators.length; ++i) {
    try {
      return delegateResourceLocators[i].getString(key,translate);
    }
 catch (    MissingResourceException exception) {
    }
  }
  throw new MissingResourceException(MessageFormat.format("String_Node_Str",new Object[]{key}),getClass().getName(),key);
}

Fixed version (ground truth):
/** 
 * Does the work of fetching the string associated with the key, when the string resource is not available locally.
 * @param key the key of the string to fetch.
 * @exception MissingResourceException if the string resource doesn't exist anywhere.
 * @see #getDelegateResourceLocators()
 */
protected String delegatedGetString(String key,boolean translate){
  ResourceLocator[] delegateResourceLocators=getDelegateResourceLocators();
  for (int i=0; i < delegateResourceLocators.length; ++i) {
    try {
      return delegateResourceLocators[i].getString(key,translate);
    }
 catch (    MissingResourceException exception) {
    }
  }
  throw new MissingResourceException(MessageFormat.format("String_Node_Str",new Object[]{key}),getClass().getName(),key);
}
Program: 11780
Project: 11780
Buggy source:
/** 
 * @param descriptor
 */
public TypesafeEnumPlugin(){
  sPlugin=this;
}

Fixed version (ground truth):
/** 
 */
public TypesafeEnumPlugin(){
  sPlugin=this;
}
Program: 11781
Project: 11781
Buggy source:
/** 
 * Logs the exception and shows an error dialog.
 * @param e the exception to handle
 */
private void handleException(Throwable t){
  if (t instanceof InvocationTargetException) {
    t=((InvocationTargetException)t).getTargetException();
  }
  TypesafeEnumPlugin.log(t);
  Shell shell=TypesafeEnumPlugin.getActiveWorkbenchShell();
  String title="String_Node_Str";
  DiagnosticDialog.open(shell,title,null,BasicDiagnostic.toDiagnostic(t));
}

Fixed version (ground truth):
/** 
 * Logs the exception and shows an error dialog.
 * @param t the exception to handle
 */
private void handleException(Throwable t){
  if (t instanceof InvocationTargetException) {
    t=((InvocationTargetException)t).getTargetException();
  }
  TypesafeEnumPlugin.log(t);
  Shell shell=TypesafeEnumPlugin.getActiveWorkbenchShell();
  String title="String_Node_Str";
  DiagnosticDialog.open(shell,title,null,BasicDiagnostic.toDiagnostic(t));
}
Program: 11782
Project: 11782
Buggy source:
/** 
 * Returns whether existing read-only files should be overwritten. This method returns <code>true</code> by default.
 * @return whether existing read-only files should be overwritten
 */
public void setForceOverwrite(boolean force){
  mForceOverwrite=force;
}

Fixed version (ground truth):
/** 
 * Sets whether existing read-only files should be overwritten. 
 */
public void setForceOverwrite(boolean force){
  mForceOverwrite=force;
}
Program: 11783
Project: 11783
Buggy source:
/** 
 * Sets the model object to pass to the JET template.
 * @param the model object to pass to the JET template
 */
public void setModel(Object object){
  mModel=object;
}

Fixed version (ground truth):
/** 
 * Sets the model object to pass to the JET template.
 * @param object the model object to pass to the JET template
 */
public void setModel(Object object){
  mModel=object;
}
Program: 11784
Project: 11784
Buggy source:
/** 
 * Sets whether this instance is the default instance of the parent <code>TypesafeEnum</code>.
 * @param isDefault whether this instance is the default instance of the parent <code>TypesafeEnum</code>
 * @throws IllegalStateException if this instance has not been added to a type
 */
public void setDefault(){
  assertTypeNotNull();
  getType().setDefaultInstance(this);
}

Fixed version (ground truth):
/** 
 * Sets whether this instance is the default instance of the parent <code>TypesafeEnum</code>.
 * @throws IllegalStateException if this instance has not been added to a type
 */
public void setDefault(){
  assertTypeNotNull();
  getType().setDefaultInstance(this);
}
Program: 11785
Project: 11785
Buggy source:
/** 
 * @param isClass
 * @param pageName
 */
public NewTypesafeEnumCreationWizardPage(){
  super(true,PAGE_NAME);
  setTitle(WizardMessages.getString("String_Node_Str"));
  setDescription(WizardMessages.getString("String_Node_Str"));
}

Fixed version (ground truth):
/** 
 */
public NewTypesafeEnumCreationWizardPage(){
  super(true,PAGE_NAME);
  setTitle(WizardMessages.getString("String_Node_Str"));
  setDescription(WizardMessages.getString("String_Node_Str"));
}
Program: 11786
Project: 11786
Buggy source:
/** 
 * @param composite
 * @param nColumns
 */
private void createAuthorVersionControls(Composite parent,int nColumns){
  Label author=new Label(parent,SWT.NONE);
  author.setText(WizardMessages.getString("String_Node_Str"));
  mTextAuthor=new Text(parent,SWT.SINGLE | SWT.BORDER);
  mTextAuthor.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  mTextAuthor.addModifyListener(new ModifyListener(){
    public void modifyText(    ModifyEvent e){
      getTypesafeEnumModel().setAuthor(mTextAuthor.getText());
    }
  }
);
  mTextAuthor.setText(System.getProperty("String_Node_Str"));
  new Label(parent,SWT.NONE);
  new Label(parent,SWT.NONE);
  Label version=new Label(parent,SWT.NONE);
  version.setText(WizardMessages.getString("String_Node_Str"));
  mTextVersion=new Text(parent,SWT.SINGLE | SWT.BORDER);
  mTextVersion.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  mTextVersion.addModifyListener(new ModifyListener(){
    public void modifyText(    ModifyEvent e){
      getTypesafeEnumModel().setVersion(mTextVersion.getText());
    }
  }
);
  mTextVersion.setText("String_Node_Str");
  new Label(parent,SWT.NONE);
  new Label(parent,SWT.NONE);
}

Fixed version (ground truth):
/** 
 * @param parent
 * @param nColumns
 */
private void createAuthorVersionControls(Composite parent,int nColumns){
  Label author=new Label(parent,SWT.NONE);
  author.setText(WizardMessages.getString("String_Node_Str"));
  mTextAuthor=new Text(parent,SWT.SINGLE | SWT.BORDER);
  mTextAuthor.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  mTextAuthor.addModifyListener(new ModifyListener(){
    public void modifyText(    ModifyEvent e){
      getTypesafeEnumModel().setAuthor(mTextAuthor.getText());
    }
  }
);
  mTextAuthor.setText(System.getProperty("String_Node_Str"));
  new Label(parent,SWT.NONE);
  new Label(parent,SWT.NONE);
  Label version=new Label(parent,SWT.NONE);
  version.setText(WizardMessages.getString("String_Node_Str"));
  mTextVersion=new Text(parent,SWT.SINGLE | SWT.BORDER);
  mTextVersion.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  mTextVersion.addModifyListener(new ModifyListener(){
    public void modifyText(    ModifyEvent e){
      getTypesafeEnumModel().setVersion(mTextVersion.getText());
    }
  }
);
  mTextVersion.setText("String_Node_Str");
  new Label(parent,SWT.NONE);
  new Label(parent,SWT.NONE);
}
Program: 11787
Project: 11787
Buggy source:
/** 
 * @param container
 */
private void createButtonsPanel(Composite parent){
  Composite panel=new Composite(parent,SWT.NONE);
  GridLayout layout=new GridLayout();
  layout.numColumns=3;
  panel.setLayout(layout);
  mButtonAdd=new Button(panel,SWT.PUSH);
  mButtonEdit=new Button(panel,SWT.PUSH);
  mButtonRemove=new Button(panel,SWT.PUSH);
  mButtonAdd.setText(WizardMessages.getString("String_Node_Str"));
  mButtonEdit.setText(WizardMessages.getString("String_Node_Str"));
  mButtonRemove.setText(WizardMessages.getString("String_Node_Str"));
}

Fixed version (ground truth):
/** 
 * @param parent
 */
private void createButtonsPanel(Composite parent){
  Composite panel=new Composite(parent,SWT.NONE);
  GridLayout layout=new GridLayout();
  layout.numColumns=3;
  panel.setLayout(layout);
  mButtonAdd=new Button(panel,SWT.PUSH);
  mButtonEdit=new Button(panel,SWT.PUSH);
  mButtonRemove=new Button(panel,SWT.PUSH);
  mButtonAdd.setText(WizardMessages.getString("String_Node_Str"));
  mButtonEdit.setText(WizardMessages.getString("String_Node_Str"));
  mButtonRemove.setText(WizardMessages.getString("String_Node_Str"));
}
Program: 11788
Project: 11788
Buggy source:
/** 
 * Creates an instance that will search the given packages for candidate features.
 * @param considerSubtypes whether to consider {@link ExtendedMetaData#getBaseType(EDataType)base types} or {@link EClass#getESuperTypes() super types}when finding a substitution group.
 * @param ePackages the packages to search for candidates.
 */
public ElementHandlerImpl(boolean considerSubtypes,Collection<? extends EPackage> ePackages){
  this.considerSubtypes=considerSubtypes;
  this.ePackages=ePackages;
}

Fixed version (ground truth):
/** 
 * Creates an instance that will search the given packages for candidate features.
 * @param considerSubtypes whether to consider {@link ExtendedMetaData#getBaseType(EDataType) base types} or {@link EClass#getESuperTypes() super types}when finding a substitution group.
 * @param ePackages the packages to search for candidates.
 */
public ElementHandlerImpl(boolean considerSubtypes,Collection<? extends EPackage> ePackages){
  this.considerSubtypes=considerSubtypes;
  this.ePackages=ePackages;
}
Program: 11789
Project: 11789
Buggy source:
/** 
 * Returns the   {@link ExtendedMetaData#getBaseType(EDataType)base type} or first {@link EClass#getESuperTypes() super type} of the classifier,depending on there it is a  {@link EDataType data type} or a {@link EClass class}.
 * @param extendedMetaData the extended meta data in which to look up type information.
 * @param eClassifier the classifier in question.
 * @return the {@link ExtendedMetaData#getBaseType(EDataType)base type}, the first   {@link EClass#getESuperTypes() super type} of the classifier, or <code>null</code>.
 */
protected EClassifier getSuperType(ExtendedMetaData extendedMetaData,EClassifier eClassifier){
  if (eClassifier instanceof EDataType) {
    return extendedMetaData.getBaseType((EDataType)eClassifier);
  }
 else {
    List<EClass> eSuperTypes=((EClass)eClassifier).getESuperTypes();
    if (eSuperTypes.isEmpty()) {
      return null;
    }
 else {
      return eSuperTypes.get(0);
    }
  }
}

Fixed version (ground truth):
/** 
 * Returns the   {@link ExtendedMetaData#getBaseType(EDataType) base type} or first {@link EClass#getESuperTypes() super type} of the classifier,depending on there it is a  {@link EDataType data type} or a {@link EClass class}.
 * @param extendedMetaData the extended meta data in which to look up type information.
 * @param eClassifier the classifier in question.
 * @return the {@link ExtendedMetaData#getBaseType(EDataType) base type}, the first   {@link EClass#getESuperTypes() super type} of the classifier, or <code>null</code>.
 */
protected EClassifier getSuperType(ExtendedMetaData extendedMetaData,EClassifier eClassifier){
  if (eClassifier instanceof EDataType) {
    return extendedMetaData.getBaseType((EDataType)eClassifier);
  }
 else {
    List<EClass> eSuperTypes=((EClass)eClassifier).getESuperTypes();
    if (eSuperTypes.isEmpty()) {
      return null;
    }
 else {
      return eSuperTypes.get(0);
    }
  }
}
Program: 11790
Project: 11790
Buggy source:
/** 
 * Returns an observable list that tracks the current value of the feature of the current value of the master observable value.
 * @param realm the realm in which to observe.
 * @param domain the editing domain used for applying changes.
 * @param value the master observable value.
 * @param eStructuralFeature the feature for which to track the value.
 * @return an observable value that tracks the current value of the named property for the current value of the master observable value
 * @see MasterDetailObservables#detailList(IObservableValue,IObservableFactory,Object)
 */
public static IObservableList observeDetailList(Realm realm,EditingDomain domain,IObservableValue master,EStructuralFeature eStructuralFeature){
  return MasterDetailObservables.detailList(master,listFactory(realm,domain,eStructuralFeature),eStructuralFeature);
}

Fixed version (ground truth):
/** 
 * Returns an observable list that tracks the current value of the feature of the current value of the master observable value.
 * @param realm the realm in which to observe.
 * @param domain the editing domain used for applying changes.
 * @param value the master observable value.
 * @param eStructuralFeature the feature for which to track the value.
 * @return an observable value that tracks the current value of the named property for the current value of the master observable value
 * @see MasterDetailObservables#detailList(IObservableValue,IObservableFactory,Object)
 */
public static IObservableList observeDetailList(Realm realm,EditingDomain domain,IObservableValue value,EStructuralFeature eStructuralFeature){
  return MasterDetailObservables.detailList(value,listFactory(realm,domain,eStructuralFeature),eStructuralFeature);
}
Program: 11791
Project: 11791
Buggy source:
/** 
 * Returns an observable value that tracks the current value of the feature of the current value of the master observable value.
 * @param realm the realm in which to observe.
 * @param domain the editing domain used for applying changes.
 * @param value the master observable value.
 * @param eStructuralFeature the feature for which to track the value.
 * @return an observable value that tracks the current value of the named property for the current value of the master observable value
 * @see MasterDetailObservables#detailValue(IObservableValue,IObservableFactory,Object)
 */
public static IObservableValue observeDetailValue(Realm realm,EditingDomain domain,IObservableValue master,EStructuralFeature eStructuralFeature){
  return MasterDetailObservables.detailValue(master,valueFactory(realm,domain,eStructuralFeature),eStructuralFeature);
}

Fixed version (ground truth):
/** 
 * Returns an observable value that tracks the current value of the feature of the current value of the master observable value.
 * @param realm the realm in which to observe.
 * @param domain the editing domain used for applying changes.
 * @param value the master observable value.
 * @param eStructuralFeature the feature for which to track the value.
 * @return an observable value that tracks the current value of the named property for the current value of the master observable value
 * @see MasterDetailObservables#detailValue(IObservableValue,IObservableFactory,Object)
 */
public static IObservableValue observeDetailValue(Realm realm,EditingDomain domain,IObservableValue value,EStructuralFeature eStructuralFeature){
  return MasterDetailObservables.detailValue(value,valueFactory(realm,domain,eStructuralFeature),eStructuralFeature);
}
Program: 11792
Project: 11792
Buggy source:
/** 
 * Returns the editors for a given URI. This method actually attempts to open an input stream for the URI and uses its contents, along with the filename (the URI's last segment), to obtain appropriate content types. <p> If a URI converter is specified, it is used to open the stream. Otherwise, the global default  {@link URIConverter#INSTANCE instance} is used.
 * @param uri a URI
 * @param a URI converter from which to obtain an input stream, or <code>null</code>
 * @param defaultsOnly if <code>true</code>, only the default editor for each content type will be included in the result 
 * @return the descriptors of the editors
 * @since 2.4
 */
public static IEditorDescriptor[] getEditors(URI uri,URIConverter uriConverter,boolean defaultsOnly){
  String fileName=URI.decode(uri.lastSegment());
  if (uriConverter == null) {
    uriConverter=URIConverter.INSTANCE;
  }
  InputStream stream=null;
  try {
    stream=uriConverter.createInputStream(uri);
    return getEditors(stream,fileName,defaultsOnly);
  }
 catch (  IOException e) {
    EMFEditUIPlugin.INSTANCE.log(e);
    return getEditors(fileName,defaultsOnly);
  }
 finally {
    close(stream);
  }
}

Fixed version (ground truth):
/** 
 * Returns the editors for a given URI. This method actually attempts to open an input stream for the URI and uses its contents, along with the filename (the URI's last segment), to obtain appropriate content types. <p> If a URI converter is specified, it is used to open the stream. Otherwise, the global default  {@link URIConverter#INSTANCE instance} is used.
 * @param uri a URI
 * @param uriConverter a URI converter from which to obtain an input stream, or <code>null</code>
 * @param defaultsOnly if <code>true</code>, only the default editor for each content type will be included in the result 
 * @return the descriptors of the editors
 * @since 2.4
 */
public static IEditorDescriptor[] getEditors(URI uri,URIConverter uriConverter,boolean defaultsOnly){
  String fileName=URI.decode(uri.lastSegment());
  if (uriConverter == null) {
    uriConverter=URIConverter.INSTANCE;
  }
  InputStream stream=null;
  try {
    stream=uriConverter.createInputStream(uri);
    return getEditors(stream,fileName,defaultsOnly);
  }
 catch (  IOException e) {
    EMFEditUIPlugin.INSTANCE.log(e);
    return getEditors(fileName,defaultsOnly);
  }
 finally {
    close(stream);
  }
}
Program: 11793
Project: 11793
Buggy source:
/** 
 * Returns the default editor for a given URI. This method actually attempts to open an input stream for the URI and uses its contents, along with the filename (the URI's last segment), to obtain appropriate content types. <p> If a URI converter is specified, it is used to open the stream. Otherwise, the global default  {@link URIConverter#INSTANCE instance} is used.
 * @param uri a URI
 * @param a URI converter from which to obtain an input stream, or <code>null</code>
 * @return the descriptor of the default editor, or <code>null</code> if not found
 * @since 2.4
 */
public static IEditorDescriptor getDefaultEditor(URI uri,URIConverter uriConverter){
  String fileName=URI.decode(uri.lastSegment());
  if (uriConverter == null) {
    uriConverter=URIConverter.INSTANCE;
  }
  InputStream stream=null;
  try {
    stream=uriConverter.createInputStream(uri);
    return getDefaultEditor(stream,fileName);
  }
 catch (  IOException e) {
    EMFEditUIPlugin.INSTANCE.log(e);
    return getDefaultEditor(fileName);
  }
 finally {
    close(stream);
  }
}

Fixed version (ground truth):
/** 
 * Returns the default editor for a given URI. This method actually attempts to open an input stream for the URI and uses its contents, along with the filename (the URI's last segment), to obtain appropriate content types. <p> If a URI converter is specified, it is used to open the stream. Otherwise, the global default  {@link URIConverter#INSTANCE instance} is used.
 * @param uri a URI
 * @param uriConverter URI converter from which to obtain an input stream, or <code>null</code>
 * @return the descriptor of the default editor, or <code>null</code> if not found
 * @since 2.4
 */
public static IEditorDescriptor getDefaultEditor(URI uri,URIConverter uriConverter){
  String fileName=URI.decode(uri.lastSegment());
  if (uriConverter == null) {
    uriConverter=URIConverter.INSTANCE;
  }
  InputStream stream=null;
  try {
    stream=uriConverter.createInputStream(uri);
    return getDefaultEditor(stream,fileName);
  }
 catch (  IOException e) {
    EMFEditUIPlugin.INSTANCE.log(e);
    return getDefaultEditor(fileName);
  }
 finally {
    close(stream);
  }
}
Program: 11794
Project: 11794
Buggy source:
/** 
 * Returns an observable list that tracks the current value of the feature of the current value of the master observable value.
 * @param realm the realm in which to observe.
 * @param value the master observable value.
 * @param eStructuralFeature the feature for which to track the value.
 * @return an observable value that tracks the current value of the named property for the current value of the master observable value
 * @see MasterDetailObservables#detailList(IObservableValue,IObservableFactory,Object)
 */
public static IObservableList observeDetailList(Realm realm,IObservableValue master,EStructuralFeature eStructuralFeature){
  return MasterDetailObservables.detailList(master,listFactory(realm,eStructuralFeature),eStructuralFeature);
}

Fixed version (ground truth):
/** 
 * Returns an observable list that tracks the current value of the feature of the current value of the master observable value.
 * @param realm the realm in which to observe.
 * @param value the master observable value.
 * @param eStructuralFeature the feature for which to track the value.
 * @return an observable value that tracks the current value of the named property for the current value of the master observable value
 * @see MasterDetailObservables#detailList(IObservableValue,IObservableFactory,Object)
 */
public static IObservableList observeDetailList(Realm realm,IObservableValue value,EStructuralFeature eStructuralFeature){
  return MasterDetailObservables.detailList(value,listFactory(realm,eStructuralFeature),eStructuralFeature);
}
Program: 11795
Project: 11795
Buggy source:
/** 
 * This test case was based on the excellent article written by Adrian Powell  Model with the Eclipse Modeling Framework, Part 3 
 * @see http://www-106.ibm.com/developerworks/library/os-ecemf3/.
 */
public void merge1() throws Exception {
  verifyMerge(mergeFiles());
}

Fixed version (ground truth):
/** 
 * This test case was based on the excellent article written by Adrian Powell  Model with the Eclipse Modeling Framework, Part 3 
 * @see <a href="http://www.ibm.com/developerworks/library/os-ecemf3/">JMerge</a>
 */
public void merge1() throws Exception {
  verifyMerge(mergeFiles());
}
Program: 11796
Project: 11796
Buggy source:
/** 
 * Method to be used in tests created based on data directories.
 * @throws Exception
 * @see addItself(TestSuite)
 * @see JMergerTestSuite
 */
public void mergeAST() throws Exception {
  merge();
}

Fixed version (ground truth):
/** 
 * Method to be used in tests created based on data directories.
 * @throws Exception
 * @see #addItself(TestSuite)
 * @see JMergerTestSuite
 */
public void mergeAST() throws Exception {
  merge();
}
Program: 11797
Project: 11797
Buggy source:
/** 
 * Adds itself only if java version is 1.4 based on directory (  {@link #determineJavaVersion()}and if possible by   {@link JMergerTest#addItself(TestSuite)}.
 * @see org.eclipse.emf.test.tools.merger.JMergerTest#addItself(junit.framework.TestSuite)
 */
@Override public void addItself(TestSuite ts){
  String javaVersion=computeJavaVersion();
  if (JavaCore.VERSION_1_4.equals(javaVersion)) {
    super.addItself(ts);
  }
}

Fixed version (ground truth):
/** 
 * Adds itself only if java version is 1.4 based on directory (  {@link #computeExpectedOutputFile()}and if possible by   {@link JMergerTest#addItself(TestSuite)}.
 * @see org.eclipse.emf.test.tools.merger.JMergerTest#addItself(junit.framework.TestSuite)
 */
@Override public void addItself(TestSuite ts){
  String javaVersion=computeJavaVersion();
  if (JavaCore.VERSION_1_4.equals(javaVersion)) {
    super.addItself(ts);
  }
}
Program: 11798
Project: 11798
Buggy source:
/** 
 * Method to be used in tests created based on data directories.
 * @throws Exception
 * @see {@link #addItself(TestSuite)}
 * @see JMergerTestSuite
 */
public void mergeJDOM() throws Exception {
  merge();
}

Fixed version (ground truth):
/** 
 * Method to be used in tests created based on data directories.
 * @throws Exception
 * @see #addItself(TestSuite)
 * @see JMergerTestSuite
 */
public void mergeJDOM() throws Exception {
  merge();
}
Program: 11799
Project: 11799
Buggy source:
/** 
 * Perform and verify merge. To be used in merge tests by subclasses.  <b> Before performing merge, java compiler source version is set based on data directory.
 * @throws Exception 
 * @see {@link #adjustSourceCompatibility()}
 */
protected void merge() throws Exception {
  adjustSourceCompatibility();
  verifyMerge(expectedOutput,mergeFiles());
}

Fixed version (ground truth):
/** 
 * Perform and verify merge. To be used in merge tests by subclasses.  <b> Before performing merge, java compiler source version is set based on data directory.
 * @throws Exception 
 * @see #adjustSourceCompatibility()
 */
protected void merge() throws Exception {
  adjustSourceCompatibility();
  verifyMerge(expectedOutput,mergeFiles());
}
Program: 11800
Project: 11800
Buggy source:
/** 
 * Creates and returns test suite for a single input directory.
 * @param subDirectoryName
 * @param dataDirsDirectory directory containing directory with subDirectoryName
 * @return
 */
protected TestSuite createSingleInputTestSuite(File dataDirectory){
  TestSuite ts=new TestSuite(dataDirectory.getName());
  addTestCases(ts,dataDirectory);
  return ts;
}

Fixed version (ground truth):
/** 
 * Creates and returns test suite for a single input directory.
 * @param dataDirectory directory containing directory with subDirectoryName
 * @return
 */
protected TestSuite createSingleInputTestSuite(File dataDirectory){
  TestSuite ts=new TestSuite(dataDirectory.getName());
  addTestCases(ts,dataDirectory);
  return ts;
}
Program: 11801
Project: 11801
Buggy source:
/** 
 * Returns the   {@link GenBase} object's {@link GenAnnotation} Details mapassociated with this Model Exporter or  {@link ECollections.EMPTY_EMAP}
 */
protected EMap<String,String> getExporterGenAnnotationDetails(GenBase genBase){
  EMap<String,String> eMap=getGenBaseToGenAnnotationDetailsMap().get(genBase);
  if (eMap == null) {
    GenAnnotation genAnnotation=genBase.getGenAnnotation(getConverterGenAnnotationSource());
    if (genAnnotation != null) {
      eMap=genAnnotation.getDetails();
      getGenBaseToGenAnnotationDetailsMap().put(genBase,eMap);
    }
 else {
      eMap=ECollections.emptyEMap();
    }
  }
  return eMap;
}

Fixed version (ground truth):
/** 
 * Returns the   {@link GenBase} object's {@link GenAnnotation} Details mapassociated with this Model Exporter or  {@link ECollections#EMPTY_EMAP}
 */
protected EMap<String,String> getExporterGenAnnotationDetails(GenBase genBase){
  EMap<String,String> eMap=getGenBaseToGenAnnotationDetailsMap().get(genBase);
  if (eMap == null) {
    GenAnnotation genAnnotation=genBase.getGenAnnotation(getConverterGenAnnotationSource());
    if (genAnnotation != null) {
      eMap=genAnnotation.getDetails();
      getGenBaseToGenAnnotationDetailsMap().put(genBase,eMap);
    }
 else {
      eMap=ECollections.emptyEMap();
    }
  }
  return eMap;
}
Program: 11802
Project: 11802
Buggy source:
/** 
 * Separates the type argument from the type.  The first position of the returned array is always the raw type and the second is either the type argument without the outmost '&lt;' and '&gt;' or <code>null</null>.
 * @param typeName
 * @return a String array with length == 2
 */
public static String[] separateTypeArgument(String typeName){
  String typeArgument=null;
  int ltIndex=typeName.indexOf('<');
  if (ltIndex > 0) {
    int gtIndex=typeName.lastIndexOf('>');
    if (gtIndex > ltIndex + 1) {
      typeArgument=typeName.substring(ltIndex + 1,gtIndex).trim();
      typeName=typeName.substring(0,ltIndex).trim();
    }
  }
  return new String[]{typeName,typeArgument};
}

Fixed version (ground truth):
/** 
 * Separates the type argument from the type.  The first position of the returned array is always the raw type and the second is either the type argument without the outermost '&lt;' and '&gt;' or <code>null</null>.
 * @param typeName
 * @return a String array with length == 2
 */
public static String[] separateTypeArgument(String typeName){
  String typeArgument=null;
  int ltIndex=typeName.indexOf('<');
  if (ltIndex > 0) {
    int gtIndex=typeName.lastIndexOf('>');
    if (gtIndex > ltIndex + 1) {
      typeArgument=typeName.substring(ltIndex + 1,gtIndex).trim();
      typeName=typeName.substring(0,ltIndex).trim();
    }
  }
  return new String[]{typeName,typeArgument};
}
Program: 11803
Project: 11803
Buggy source:
/** 
 * Executes a stand-alone test.
 * @param arguments an array of Strings from the command line.
 * @see #run
 */
public static void main(String arguments[]){
  ResourceSet resourceSet=new ResourceSetImpl();
  resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("String_Node_Str",new JavaPackageResourceFactoryImpl());
  JavaPackageResourceImpl javaPackageResource=(JavaPackageResourceImpl)resourceSet.getResource(JAVA_PACKAGE_RESOURCE_URI,true);
  javaPackageResource.setClassLoader(StandAloneTest.class.getClassLoader());
  JClass thisClass=(JClass)resourceSet.getEObject(JAVA_PACKAGE_RESOURCE_URI.appendFragment("String_Node_Str"),true);
  System.out.println("String_Node_Str" + thisClass.getQualifiedName());
  for (  JMethod jMethod : thisClass.getAllMethods()) {
    System.out.println("String_Node_Str" + jMethod.getQualifiedName());
  }
  System.exit(1);
}

Fixed version (ground truth):
/** 
 * Executes a stand-alone test.
 * @param arguments an array of Strings from the command line.
 */
public static void main(String arguments[]){
  ResourceSet resourceSet=new ResourceSetImpl();
  resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("String_Node_Str",new JavaPackageResourceFactoryImpl());
  JavaPackageResourceImpl javaPackageResource=(JavaPackageResourceImpl)resourceSet.getResource(JAVA_PACKAGE_RESOURCE_URI,true);
  javaPackageResource.setClassLoader(StandAloneTest.class.getClassLoader());
  JClass thisClass=(JClass)resourceSet.getEObject(JAVA_PACKAGE_RESOURCE_URI.appendFragment("String_Node_Str"),true);
  System.out.println("String_Node_Str" + thisClass.getQualifiedName());
  for (  JMethod jMethod : thisClass.getAllMethods()) {
    System.out.println("String_Node_Str" + jMethod.getQualifiedName());
  }
  System.exit(1);
}
Program: 11804
Project: 11804
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 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 value 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: 11805
Project: 11805
Buggy source:
/** 
 * This options allows the user to load and deserialize arbitrary XML (i.e. XML for which schema is not specified). The default is <code>false</code>, unless set to <code>true</code> explicitly.  To process schemaLocation/noNamespaceSchemaLocation attributes, user have to set   {@link #setProcessSchemaLocations(boolean)} to <code>true</code>.
 * @see XMLResource#getEObjectToExtensionMap()
 * @param anyXML
 */
void setProcessAnyXML(boolean processAnyXML);

Fixed version (ground truth):
/** 
 * This options allows the user to load and deserialize arbitrary XML (i.e. XML for which schema is not specified). The default is <code>false</code>, unless set to <code>true</code> explicitly.  To process schemaLocation/noNamespaceSchemaLocation attributes, user have to set   {@link #setProcessSchemaLocations(boolean)} to <code>true</code>.
 * @see XMLResource#getEObjectToExtensionMap()
 * @param processAnyXML whether to process arbitrary XML.
 */
void setProcessAnyXML(boolean processAnyXML);
Program: 11806
Project: 11806
Buggy source:
/** 
 * Called before saving begins.
 * @param resource the resource being saved.
 * @param inputStream the stream being written.
 * @param options the save options.
 */
void postSave(XMLResource resource,OutputStream outputStream,Map<?,?> options);

Fixed version (ground truth):
/** 
 * Called before saving begins.
 * @param resource the resource being saved.
 * @param outputStream the stream being written.
 * @param options the save options.
 */
void postSave(XMLResource resource,OutputStream outputStream,Map<?,?> options);
Program: 11807
Project: 11807
Buggy source:
/** 
 * Called before saving begins.
 * @param resource the resource being saved.
 * @param inputStream the stream being written.
 * @param options the save options.
 */
void preSave(XMLResource resource,OutputStream outputStream,Map<?,?> options);

Fixed version (ground truth):
/** 
 * Called before saving begins.
 * @param resource the resource being saved.
 * @param outputStream the stream being written.
 * @param options the save options.
 */
void preSave(XMLResource resource,OutputStream outputStream,Map<?,?> options);
Program: 11809
Project: 11809
Buggy source:
/** 
 * If the given object implements   {@link IWrapperItemProvider}, it is disposed by calling   {@link IWrapperItemProvider#dispose dispose}. It is also removed from   {@link #wrappers}, as it will longer need to be disposed along with this item provider.
 */
protected void disposeWrapper(Object object){
  if (object instanceof IWrapperItemProvider) {
    ((IWrapperItemProvider)object).dispose();
    if (wrappers != null) {
      wrappers.remove(object);
    }
  }
}

Fixed version (ground truth):
/** 
 * If the given object implements   {@link IWrapperItemProvider}, it is disposed by calling   {@link IDisposable#dispose dispose}. It is also removed from   {@link #wrappers}, as it will longer need to be disposed along with this item provider.
 */
protected void disposeWrapper(Object object){
  if (object instanceof IWrapperItemProvider) {
    ((IWrapperItemProvider)object).dispose();
    if (wrappers != null) {
      wrappers.remove(object);
    }
  }
}
Program: 11810
Project: 11810
Buggy source:
/** 
 * Returns the property image for the specified type. Implementations of   {@link #getPropertyImage getPropertyImage}typically call this method.
 */
protected Object getPropertyImage(Class<?> typeClass){
  if (typeClass == Boolean.TYPE || typeClass == Boolean.class) {
    return ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE;
  }
 else   if (typeClass == Byte.TYPE || typeClass == Byte.class || typeClass == Integer.TYPE || typeClass == Integer.class || typeClass == Long.TYPE || typeClass == Long.class || typeClass == Short.TYPE || typeClass == Short.class) {
    return ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE;
  }
 else   if (typeClass == Character.TYPE || typeClass == Character.class || typeClass == String.class) {
    return ItemPropertyDescriptor.TEXT_VALUE_IMAGE;
  }
 else   if (typeClass == Double.TYPE || typeClass == Double.class || typeClass == Float.TYPE || typeClass == Float.class) {
    return ItemPropertyDescriptor.REAL_VALUE_IMAGE;
  }
  return ItemPropertyDescriptor.GENERIC_VALUE_IMAGE;
}

Fixed version (ground truth):
/** 
 * Returns the property image for the specified type. Implementations of   {@link #getPropertyImage() getPropertyImage}typically call this method.
 */
protected Object getPropertyImage(Class<?> typeClass){
  if (typeClass == Boolean.TYPE || typeClass == Boolean.class) {
    return ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE;
  }
 else   if (typeClass == Byte.TYPE || typeClass == Byte.class || typeClass == Integer.TYPE || typeClass == Integer.class || typeClass == Long.TYPE || typeClass == Long.class || typeClass == Short.TYPE || typeClass == Short.class) {
    return ItemPropertyDescriptor.INTEGRAL_VALUE_IMAGE;
  }
 else   if (typeClass == Character.TYPE || typeClass == Character.class || typeClass == String.class) {
    return ItemPropertyDescriptor.TEXT_VALUE_IMAGE;
  }
 else   if (typeClass == Double.TYPE || typeClass == Double.class || typeClass == Float.TYPE || typeClass == Float.class) {
    return ItemPropertyDescriptor.REAL_VALUE_IMAGE;
  }
  return ItemPropertyDescriptor.GENERIC_VALUE_IMAGE;
}
Program: 11811
Project: 11811
Buggy source:
/** 
 * This method is invoked after the decrypted input stream is used allowing the Cipher implementation to do any maintenance work required, such as flushing internal cache.
 * @param The inputStream returned by {@link #decrypt(InputStream)}.
 */
void finish(InputStream inputStream) throws Exception ;

Fixed version (ground truth):
/** 
 * This method is invoked after the decrypted input stream is used allowing the Cipher implementation to do any maintenance work required, such as flushing internal cache.
 * @param inputStream the stream returned by {@link #decrypt(InputStream)}.
 */
void finish(InputStream inputStream) throws Exception ;