Program: 125421
Project: 125421
Buggy source:
public List<Resource> getAffectedResources(Property property){
  List<Resource> resources=new ArrayList<Resource>();
  List<Resource> allRes=resourceSet.getResources();
synchronized (allRes) {
    Iterator<EObject> i=property.getItem().eCrossReferences().iterator();
    while (i.hasNext()) {
      EObject object=i.next();
      Resource currentResource=object.eResource();
      if (currentResource == null) {
        continue;
      }
      if (!resources.contains(currentResource)) {
        if (object instanceof org.eclipse.gmf.runtime.notation.impl.DiagramImpl) {
          continue;
        }
        if (!currentResource.getURI().lastSegment().equals(getProjectFilename())) {
          resources.add(currentResource);
        }
        if (!getResourceSet().getResources().contains(currentResource)) {
          getResourceSet().getResources().add(currentResource);
        }
      }
      if (object instanceof ReferenceFileItem) {
        ReferenceFileItem fi=(ReferenceFileItem)object;
        try {
          ByteArray ba=fi.getContent();
          if (ba != null) {
            Resource fiResource=ba.eResource();
            if (fiResource != null) {
              resources.add(fiResource);
            }
          }
        }
 catch (        Exception e) {
          final Resource referenceFileResource=getReferenceFileResource(property.getItem().eResource(),fi,true);
          if (referenceFileResource != null) {
            resources.add(referenceFileResource);
          }
        }
      }
    }
    i=property.getItem().eAllContents();
    while (i.hasNext()) {
      EObject object=i.next();
      Iterator<EObject> j=object.eCrossReferences().iterator();
      while (j.hasNext()) {
        EObject childEObject=j.next();
        Resource currentResource=childEObject.eResource();
        if (currentResource == null) {
          continue;
        }
        if (!resources.contains(currentResource)) {
          if (object instanceof org.eclipse.gmf.runtime.notation.impl.DiagramImpl) {
            continue;
          }
          if (!currentResource.getURI().lastSegment().equals(getProjectFilename())) {
            resources.add(currentResource);
          }
        }
        if (!getResourceSet().getResources().contains(currentResource)) {
          getResourceSet().getResources().add(currentResource);
        }
      }
    }
    boolean isTestContainer=false;
    if (GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
      ITestContainerProviderService testContainerService=(ITestContainerProviderService)GlobalServiceRegister.getDefault().getService(ITestContainerProviderService.class);
      if (testContainerService != null) {
        isTestContainer=testContainerService.isTestContainerItem(property.getItem());
      }
    }
    if (property.getItem() instanceof ProcessItem || property.getItem() instanceof JobletProcessItem || isTestContainer) {
      if (property.eResource() != null) {
        Resource screenshotResource=getScreenshotResource(property.getItem());
        if (screenshotResource != null) {
          resources.add(screenshotResource);
        }
      }
    }
  }
  return resources;
}

Fixed version (ground truth):
public List<Resource> getAffectedResources(ResourceSet resourceSet,Property property){
  List<Resource> resources=new ArrayList<Resource>();
  List<Resource> allRes=resourceSet.getResources();
synchronized (allRes) {
    Iterator<EObject> i=property.getItem().eCrossReferences().iterator();
    while (i.hasNext()) {
      EObject object=i.next();
      Resource currentResource=object.eResource();
      if (currentResource == null) {
        continue;
      }
      if (!resources.contains(currentResource)) {
        if (object instanceof org.eclipse.gmf.runtime.notation.impl.DiagramImpl) {
          continue;
        }
        if (!currentResource.getURI().lastSegment().equals(getProjectFilename())) {
          resources.add(currentResource);
        }
        if (!resourceSet.getResources().contains(currentResource)) {
          resourceSet.getResources().add(currentResource);
        }
      }
      if (object instanceof ReferenceFileItem) {
        ReferenceFileItem fi=(ReferenceFileItem)object;
        try {
          ByteArray ba=fi.getContent();
          if (ba != null) {
            Resource fiResource=ba.eResource();
            if (fiResource != null) {
              resources.add(fiResource);
            }
          }
        }
 catch (        Exception e) {
          final Resource referenceFileResource=getReferenceFileResource(property.getItem().eResource(),fi,true);
          if (referenceFileResource != null) {
            resources.add(referenceFileResource);
          }
        }
      }
    }
    i=property.getItem().eAllContents();
    while (i.hasNext()) {
      EObject object=i.next();
      Iterator<EObject> j=object.eCrossReferences().iterator();
      while (j.hasNext()) {
        EObject childEObject=j.next();
        Resource currentResource=childEObject.eResource();
        if (currentResource == null) {
          continue;
        }
        if (!resources.contains(currentResource)) {
          if (object instanceof org.eclipse.gmf.runtime.notation.impl.DiagramImpl) {
            continue;
          }
          if (!currentResource.getURI().lastSegment().equals(getProjectFilename())) {
            resources.add(currentResource);
          }
        }
        if (!resourceSet.getResources().contains(currentResource)) {
          resourceSet.getResources().add(currentResource);
        }
      }
    }
    boolean isTestContainer=false;
    if (GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
      ITestContainerProviderService testContainerService=(ITestContainerProviderService)GlobalServiceRegister.getDefault().getService(ITestContainerProviderService.class);
      if (testContainerService != null) {
        isTestContainer=testContainerService.isTestContainerItem(property.getItem());
      }
    }
    if (property.getItem() instanceof ProcessItem || property.getItem() instanceof JobletProcessItem || isTestContainer) {
      if (property.eResource() != null) {
        Resource screenshotResource=getScreenshotResource(resourceSet,property.getItem(),false,false);
        if (screenshotResource != null) {
          resources.add(screenshotResource);
        }
      }
    }
  }
  return resources;
}