Program: 97528
Project: 97528
Buggy source:
private Collection<ChangeItem> createMissingChangeItems(TransactionRecord sourceTx,TransactionRecord destTx,String sessionId,final Set<Integer> modifiedArtIds,final Multimap<Integer,Integer> modifiedAttrIds,final Multimap<Integer,Integer> modifiedRels,final Set<Integer> missingArtIds,final Set<Integer> allArtIds) throws OseeCoreException {
  final Set<ChangeItem> toReturn=new LinkedHashSet<ChangeItem>();
  final Set<RelationData> relations=new LinkedHashSet<RelationData>();
  DataLoader loader=dataLoaderFactory.fromBranchAndArtifactIds(sessionId,sourceTx.getBranch(),missingArtIds);
  loader.setLoadLevel(LoadLevel.FULL);
  loader.includeDeleted();
  loader.fromTransaction(sourceTx.getId());
  loader.load(null,new ArtifactBuilder(){
    @Override public ArtifactDataHandler createArtifactDataHandler(){
      return new ArtifactDataHandler(){
        @Override public void onData(        ArtifactData data) throws OseeCoreException {
          if (!modifiedArtIds.contains(data.getLocalId())) {
            toReturn.add(createArtifactChangeItem(data));
          }
        }
      }
;
    }
    @Override public RelationDataHandler createRelationDataHandler(){
      return new RelationDataHandler(){
        @Override public void onData(        RelationData data){
          if (!modifiedRels.get(data.getArtIdA()).contains(data.getLocalId()) && !modifiedRels.get(data.getArtIdB()).contains(data.getLocalId())) {
            relations.add(data);
          }
        }
      }
;
    }
    @Override public AttributeDataHandler createAttributeDataHandler(){
      return new AttributeDataHandler(){
        @Override public void onData(        AttributeData data) throws OseeCoreException {
          if (!modifiedAttrIds.get(data.getArtifactId()).contains(data.getLocalId())) {
            toReturn.add(createAttributeChangeItem(data));
          }
        }
      }
;
    }
    @Override public List<ArtifactReadable> getArtifacts(){
      return null;
    }
  }
);
  if (!relations.isEmpty()) {
    Multimap<Integer,RelationData> relationChangesToAdd=LinkedListMultimap.create();
    for (    RelationData data : relations) {
      if (allArtIds.contains(data.getArtIdA())) {
        if (allArtIds.contains(data.getArtIdB())) {
          toReturn.add(createRelationChangeItem(data));
        }
 else {
          relationChangesToAdd.put(data.getArtIdB(),data);
        }
      }
 else       if (allArtIds.contains(data.getArtIdB())) {
        relationChangesToAdd.put(data.getArtIdA(),data);
      }
    }
    toReturn.addAll(createExistingRelations(destTx,sessionId,relationChangesToAdd));
  }
  return toReturn;
}

Fixed version (ground truth):
private Collection<ChangeItem> createMissingChangeItems(TransactionRecord sourceTx,TransactionRecord destTx,String sessionId,final Set<Integer> modifiedArtIds,final Multimap<Integer,Integer> modifiedAttrIds,final Multimap<Integer,Integer> modifiedRels,final Set<Integer> missingArtIds,final Set<Integer> allArtIds) throws OseeCoreException {
  final Set<ChangeItem> toReturn=new LinkedHashSet<ChangeItem>();
  final Set<RelationData> relations=new LinkedHashSet<RelationData>();
  DataLoader loader=dataLoaderFactory.fromBranchAndArtifactIds(sessionId,sourceTx.getBranch(),missingArtIds);
  loader.setLoadLevel(LoadLevel.FULL);
  loader.includeDeleted();
  loader.fromTransaction(sourceTx.getId());
  loader.load(null,new ArtifactBuilder(){
    @Override public ArtifactDataHandler createArtifactDataHandler(){
      return new ArtifactDataHandler(){
        @Override public void onData(        ArtifactData data) throws OseeCoreException {
          if (!modifiedArtIds.contains(data.getLocalId())) {
            toReturn.add(createArtifactChangeItem(data));
          }
        }
      }
;
    }
    @Override public RelationDataHandler createRelationDataHandler(){
      return new RelationDataHandler(){
        @Override public void onData(        RelationData data){
          int localId=data.getLocalId();
          if (!modifiedRels.get(data.getArtIdA()).contains(localId) && !modifiedRels.get(data.getArtIdB()).contains(localId)) {
            relations.add(data);
          }
        }
      }
;
    }
    @Override public AttributeDataHandler createAttributeDataHandler(){
      return new AttributeDataHandler(){
        @Override public void onData(        AttributeData data) throws OseeCoreException {
          if (!modifiedAttrIds.get(data.getArtifactId()).contains(data.getLocalId())) {
            toReturn.add(createAttributeChangeItem(data));
          }
        }
      }
;
    }
    @Override public List<ArtifactReadable> getArtifacts(){
      return null;
    }
  }
);
  if (!relations.isEmpty()) {
    Multimap<Integer,RelationData> relationChangesToAdd=LinkedListMultimap.create();
    for (    RelationData data : relations) {
      if (allArtIds.contains(data.getArtIdA())) {
        if (allArtIds.contains(data.getArtIdB())) {
          toReturn.add(createRelationChangeItem(data));
        }
 else {
          relationChangesToAdd.put(data.getArtIdB(),data);
        }
      }
 else       if (allArtIds.contains(data.getArtIdB())) {
        relationChangesToAdd.put(data.getArtIdA(),data);
      }
    }
    toReturn.addAll(createExistingRelations(destTx,sessionId,relationChangesToAdd));
  }
  return toReturn;
}