Skip to content
Snippets Groups Projects
Commit 1e61de7c authored by Thomas Mortagne's avatar Thomas Mortagne
Browse files

XWIKI-15137: TemplateManager should not generate an empty RawBlock if the...

XWIKI-15137: TemplateManager should not generate an empty RawBlock if the result of the template execution is empty
parent cbdd31a8
No related branches found
No related tags found
No related merge requests found
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
import javax.inject.Singleton; import javax.inject.Singleton;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.xwiki.component.annotation.Component; import org.xwiki.component.annotation.Component;
import org.xwiki.component.manager.ComponentLookupException; import org.xwiki.component.manager.ComponentLookupException;
...@@ -582,8 +583,12 @@ private XDOM getXDOM(Template template, TemplateContent content) throws Exceptio ...@@ -582,8 +583,12 @@ private XDOM getXDOM(Template template, TemplateContent content) throws Exceptio
xdom = this.parser.parse(content.getContent(), content.getSourceSyntax()); xdom = this.parser.parse(content.getContent(), content.getSourceSyntax());
} else { } else {
String result = evaluateContent(template, content); String result = evaluateContent(template, content);
xdom = new XDOM(Arrays.asList(new RawBlock(result, if (StringUtils.isEmpty(result)) {
content.getRawSyntax() != null ? content.getRawSyntax() : renderingContext.getTargetSyntax()))); xdom = new XDOM(Collections.emptyList());
} else {
xdom = new XDOM(Arrays.asList(new RawBlock(result,
content.getRawSyntax() != null ? content.getRawSyntax() : renderingContext.getTargetSyntax())));
}
} }
return xdom; return xdom;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment