Skip to content

Commit 6ea643c

Browse files
committed
coderabbitai III
1 parent b41367c commit 6ea643c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lessonbuilder/tool/src/java/org/sakaiproject/lessonbuildertool/service/LessonBuilderEntityProducer.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1948,12 +1948,15 @@ public String mergeInternal(String siteId, Element root, String archivePath, Str
19481948
for (Long pageId : calculatedParentMap.keySet()) {
19491949
Long currentPageId = pageId;
19501950
Long topParent = null;
1951-
1951+
Set<Long> visited = new HashSet<>();
19521952
while (calculatedParentMap.containsKey(currentPageId)) {
1953+
if (!visited.add(currentPageId)) {
1954+
log.warn("Cycle detected in page hierarchy at page {}", currentPageId);
1955+
break;
1956+
}
19531957
topParent = calculatedParentMap.get(currentPageId);
19541958
currentPageId = topParent;
19551959
}
1956-
19571960
if (topParent != null) {
19581961
calculatedTopParentMap.put(pageId, topParent);
19591962
}

0 commit comments

Comments
 (0)