Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-13948

White spaces in XML documents are not ignored causing ResourceNotFoundException

    XMLWordPrintable

Details

    Description

      Adding white space in atlassian-plugin.xml cause Confluence to throw exceptions saying that it cannot find the velocity templates.

      For example, the xml was changed from

      <result name="input" type="velocity">/templates/extra/myplugin/add-item.vm</result>
      

      to

      <result name="input" type="velocity">
      /templates/extra/myplugin/add-item.vm
      </result>
      

      after formatting. It would appear that you should remove trailing and leading blanks/tabs from the value before using it to retrieve the velocity pages.

      Here's the first part of the exception (note the extra white space):

      org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource '/agilent/labs/
      /templates/extra/myplugin/add-item.vm
      '
      at com.atlassian.confluence.util.velocity.ConfigurableResourceManager.loadResource(ConfigurableResourceManager.java:400)
      at com.atlassian.confluence.util.velocity.ConfigurableResourceManager.getResource(ConfigurableResourceManager.java:304)
      at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1102)
      at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1077)
      at org.apache.velocity.app.VelocityEngine.getTemplate(VelocityEngine.java:528)
      

      This is because we do not ignore white spaces when parsing XML documents.

      Attachments

        Activity

          People

            Unassigned Unassigned
            dbrown@atlassian.com Don Brown (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: