Program: 11912
Project: 11912
Buggy source:
public NotificationChain eBasicSetContainer(InternalEObject newContainer,int newContainerFeatureID,NotificationChain msgs){
  InternalEObject oldContainer=eInternalContainer();
  Resource.Internal oldResource=this.eDirectResource();
  Resource.Internal newResource=null;
  if (oldResource != null) {
    if (!eContainmentFeature(this,newContainer,newContainerFeatureID).isResolveProxies()) {
      msgs=((InternalEList)oldResource.getContents()).basicRemove(this,msgs);
      eSetDirectResource(null);
      if (newContainer != null) {
        newResource=newContainer.eInternalResource();
      }
    }
    oldResource=null;
  }
 else   if (oldContainer != null) {
    oldResource=oldContainer.eInternalResource();
    if (newContainer != null) {
      newResource=newContainer.eInternalResource();
    }
  }
  if (oldResource != newResource && oldResource != null) {
    oldResource.detached(this);
  }
  int oldContainerFeatureID=eContainerFeatureID();
  eBasicSetContainer(newContainer,newContainerFeatureID);
  if (oldResource != newResource && newResource != null) {
    newResource.attached(this);
  }
  if (eNotificationRequired()) {
    if (msgs == null)     msgs=new NotificationChainImpl(4);
    if (oldContainer != null && oldContainerFeatureID >= 0 && oldContainerFeatureID != newContainerFeatureID) {
      msgs.add(new ENotificationImpl(this,Notification.SET,oldContainerFeatureID,oldContainer,null));
    }
    if (newContainerFeatureID >= 0) {
      msgs.add(new ENotificationImpl(this,Notification.SET,newContainerFeatureID,oldContainerFeatureID == newContainerFeatureID ? oldContainer : null,newContainer));
    }
  }
  return msgs;
}

Fixed version (ground truth):
public NotificationChain eBasicSetContainer(InternalEObject newContainer,int newContainerFeatureID,NotificationChain msgs){
  InternalEObject oldContainer=eInternalContainer();
  Resource.Internal oldResource=this.eDirectResource();
  Resource.Internal newResource=null;
  if (oldResource != null) {
    if (!eContainmentFeature(this,newContainer,newContainerFeatureID).isResolveProxies()) {
      msgs=((InternalEList)oldResource.getContents()).basicRemove(this,msgs);
      eSetDirectResource(null);
      if (newContainer != null) {
        newResource=newContainer.eInternalResource();
      }
    }
    oldResource=null;
  }
 else {
    if (oldContainer != null) {
      oldResource=oldContainer.eInternalResource();
    }
    if (newContainer != null) {
      newResource=newContainer.eInternalResource();
    }
  }
  if (oldResource != newResource && oldResource != null) {
    oldResource.detached(this);
  }
  int oldContainerFeatureID=eContainerFeatureID();
  eBasicSetContainer(newContainer,newContainerFeatureID);
  if (oldResource != newResource && newResource != null) {
    newResource.attached(this);
  }
  if (eNotificationRequired()) {
    if (msgs == null)     msgs=new NotificationChainImpl(4);
    if (oldContainer != null && oldContainerFeatureID >= 0 && oldContainerFeatureID != newContainerFeatureID) {
      msgs.add(new ENotificationImpl(this,Notification.SET,oldContainerFeatureID,oldContainer,null));
    }
    if (newContainerFeatureID >= 0) {
      msgs.add(new ENotificationImpl(this,Notification.SET,newContainerFeatureID,oldContainerFeatureID == newContainerFeatureID ? oldContainer : null,newContainer));
    }
  }
  return msgs;
}