-
- if(!direct.isEmpty()) {
- Iterator<Resource> iter = direct.iterator();
- Resource common = iter.next();
- while (iter.hasNext()) {
- Resource other = iter.next();
- common = commonAncestor(graph, common, other);
- if (common == null) break;
- }
- if(common != null)
- owners.add(common);
- }
-
- if(!Collections.disjoint(owners, resources)) {
- System.err.println("Overlapping owners:");
- for(Resource r : resources)
- System.err.println("-resource " + NameUtils.getSafeName(graph, r, true));
- for(Resource r : owners)
- System.err.println("-owner " + NameUtils.getSafeName(graph, r, true));
- return null;
+ else if(owners.size() > 1) {
+ // TODO: getObjects returns duplicate entries (https://www.simantics.org/redmine/issues/4885) and therefore direct is Set<Resource>.
+ // Fix getObjects to not return duplicate entries
+ owners = new HashSet<Resource>(owners);