VelocityUtils.getRenderedTemplate() returns empty String after update to Confluence 7.19.17

Hello,

after updating Confluence from 7.19.16 to 7.19.17 VelocityUtils.getRenderedTemplate() returns empty String .
This means my macros are just an empty string.
The example below shows a quick fix:

@Scanned
public class MyLink extends ... {
    ...

    public String execute(Map<String, String> map, String s, 
               ConversionContext conversionContext)
               throws MacroExecutionException {
         ...
         ...
         ...

        /* This won't work any more:               
        return VelocityUtils.getRenderedTemplate(TMPL_LINK,context);
        */
        
        // Temporary workarround:
        String result = TMPL_LINK_HTML.
                replaceAll("Lfullid", context.getOrDefault("fullid","").toString()).
                replaceAll("Lid", context.getOrDefault("id","").toString());
        return result;
    }
}
  • TMPL_LINK was the path to the template:
    • templates/LabelLink.html
  • TMPL_LINK_HTML is the content of LabelLink.html (${id} and ${fullid} was replaced by Lid and Lfullid)

What has changed? How can I make getRenderedTemplate() work again?

BR,
Rainer

This won’t help you, just checked with one of my macros and Confluence 7.19.17 and for me it just works as before.

Ok,
perhaps it will help me, if you post a code snipplet, where getRenderedTemplate() is called and the path where the template file is stored within the “.jar" or ".orb” file.

Well I choose the extension “.html” instead of “.vm”. There also might be a difference between a leading slash at String passed at parameter one to getRenderedTemplate(). This definetly was optional before.

Ok, it seams that two things have changed:

  1. No Leading “/” is allowed any more
  2. File extension must be “.vm”

After changing this, it works again.