]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Fixed to remove duplicates 36/136/1
authorAntti Villberg <antti.villberg@semantum.fi>
Wed, 9 Nov 2016 09:58:38 +0000 (11:58 +0200)
committerAntti Villberg <antti.villberg@semantum.fi>
Wed, 9 Nov 2016 09:58:38 +0000 (11:58 +0200)
refs #6797

Change-Id: Ifb3bd95855c47b3cf424a1ec7ee5364b3aef4597

bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/adapter/impl/EntityInstances.java

index 428b96a5db558a8faa9a28b29b867c60d84e93f2..32a7d2a9f5b327edfe63a19ebd7b1045f28bfaef 100644 (file)
@@ -174,8 +174,10 @@ public class EntityInstances implements Instances {
     public Collection<Resource> find(ReadGraph graph, Resource index, String filter) throws DatabaseException {\r
        CollectionSupport coll = graph.getService(CollectionSupport.class);\r
        \r
-       List<Resource> rec = findRec(graph, index, filter, new THashSet<Resource>());\r
+       THashSet<Resource> visited = new THashSet<>();\r
+       List<Resource> rec = findRec(graph, index, filter, visited);\r
        for(Resource global : Layer0Utils.listGlobalOntologies(graph)) {\r
+               if(!visited.add(global)) continue;\r
                List<Resource> rs = graph.syncRequest(new QueryIndex(global, type, filter), TransientCacheListener.<List<Resource>>instance());\r
                if(rec.isEmpty() && !rs.isEmpty()) {\r
                        // TODO: rec could be an immutable empty list\r