Sync git svn branch with SVN repository r33389.
[simantics/platform.git] / bundles / org.simantics.db.layer0 / src / org / simantics / db / layer0 / adapter / impl / EntityInstances.java
index 428b96a5db558a8faa9a28b29b867c60d84e93f2..7717f04483de9be3e55953be82c6f4f8189328be 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