Skip to content

Commit

Permalink
Fix regression issue - Do not create area node when areaDefinitin.get…
Browse files Browse the repository at this point in the history
…CreateAreaNode == false
  • Loading branch information
eschleb committed Feb 2, 2024
1 parent d8c1859 commit f67453c
Showing 1 changed file with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,6 @@ private Optional<TemplateDefinition> getTemplateDefinition(final String template
}
}

private Optional<Node> getParent(final Node node) {
try {
return Optional.of(node.getParent());
} catch (ItemNotFoundException e) {
return Optional.empty();
} catch (RepositoryException e) {
throw Exceptions.sneak().handle(e);
}
}

private Optional<AreaDefinition> getAreaDefinition(final String name, final Map<String, AreaDefinition> areas) {
if (areas.containsKey(name)) {
return Optional.of(areas.get(name));
Expand All @@ -148,6 +138,9 @@ private Optional<AreaDefinition> getAreaDefinition(final String name, final Map<

private Node getOrCreateAreaNode(final String name, final Node node, final AreaDefinition areaDefinition) throws RenderException {
try {
if(Boolean.FALSE.equals(areaDefinition.getCreateAreaNode())) {
return node;
}
return node.getNode(name);
} catch (PathNotFoundException e) {
return createAreaNode(name, node, areaDefinition).orElseThrow(() ->
Expand Down

0 comments on commit f67453c

Please sign in to comment.