Commit 587694ff authored by Jasper Floor's avatar Jasper Floor Committed by Jeroen Hoffman

REPO-1960 [back port to 11.2] prevent document variants from being counted as duplicates

(cherry picked from commit 558e52a7)
parent 92561891
/*
* Copyright 2012-2013 Hippo B.V. (http://www.onehippo.com)
* Copyright 2012-2018 Hippo B.V. (http://www.onehippo.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -75,10 +75,22 @@ public final class HippoTranslatedNode {
if (!nodes.hasNext()) {
throw new ItemNotFoundException("Folder was not translated to " + language);
}
if (nodes.getSize() > 1) {
Node node = nodes.nextNode();
if (nodes.getSize() > 3) {
log.warn("More than one translated variant found for node " + id + " in language " + language);
} else if (nodes.getSize() > 1) {
String handleId = null;
Node parent = node.getParent();
do {
Node next = nodes.nextNode();
if (!next.getParent().getIdentifier().equals(parent.getIdentifier())) {
log.warn("More than one translated variant found for node " + id + " in language " + language);
break;
}
} while (nodes.hasNext());
}
return nodes.nextNode();
return node;
}
public boolean hasTranslation(String language) throws RepositoryException {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment