Program: 11865
Project: 11865
Buggy source:
/** 
 * This returns the editing domain for the given aribtrary object, or null, if it can't be determined. It is recommended that you always work directly with an EditingDomain instance whenever possible. This is implemented to checks if the object itself implements   {@link org.eclipse.emf.edit.domain.IEditingDomainProvider}and returns that result. Otherwise it checks if it is valid to call   {@link #getEditingDomainFor(org.eclipse.emf.ecore.EObject) getEditingDomainFor(EObject)} and returns that result or null. <p> It is recommended that you always keep an editing domain instance available through some other means; this should only be used to implement things such as a global popup action for some object; in such a cases such as that the editing domain returned here may well be one that belongs to some editor you know nothing about, which is what you want.
 */
static public EditingDomain getEditingDomainFor(Object object){
  if (object instanceof IEditingDomainProvider) {
    EditingDomain editingDomain=((IEditingDomainProvider)object).getEditingDomain();
    return editingDomain;
  }
 else   if (object instanceof EObject) {
    EditingDomain editingDomain=AdapterFactoryEditingDomain.getEditingDomainFor((EObject)object);
    return editingDomain;
  }
 else   if (object instanceof FeatureMap.Entry) {
    return getEditingDomainFor(((FeatureMap.Entry)object).getValue());
  }
 else   if (object instanceof IWrapperItemProvider) {
    return getEditingDomainFor(((IWrapperItemProvider)object).getValue());
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * This returns the editing domain for the given arbitrary object, or null, if it can't be determined. It is recommended that you always work directly with an EditingDomain instance whenever possible. This is implemented to checks if the object itself implements   {@link org.eclipse.emf.edit.domain.IEditingDomainProvider}and returns that result. Otherwise it checks if it is valid to call   {@link #getEditingDomainFor(org.eclipse.emf.ecore.EObject) getEditingDomainFor(EObject)} and returns that result or null. <p> It is recommended that you always keep an editing domain instance available through some other means; this should only be used to implement things such as a global popup action for some object; in such a cases such as that the editing domain returned here may well be one that belongs to some editor you know nothing about, which is what you want.
 */
static public EditingDomain getEditingDomainFor(Object object){
  if (object instanceof IEditingDomainProvider) {
    EditingDomain editingDomain=((IEditingDomainProvider)object).getEditingDomain();
    return editingDomain;
  }
 else   if (object instanceof EObject) {
    EditingDomain editingDomain=AdapterFactoryEditingDomain.getEditingDomainFor((EObject)object);
    return editingDomain;
  }
 else   if (object instanceof FeatureMap.Entry) {
    return getEditingDomainFor(((FeatureMap.Entry)object).getValue());
  }
 else   if (object instanceof IWrapperItemProvider) {
    return getEditingDomainFor(((IWrapperItemProvider)object).getValue());
  }
 else {
    return null;
  }
}