XWiki Platform
  1. XWiki Platform
  2. XWIKI-7189

URLs created by mailsender plugin called from a scheduler script can have a wrong context path

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.2, 3.3-milestone-2
    • Fix Version/s: 3.3-rc-1, 3.2.1
    • Component/s: Mail, Scheduler
    • Labels:
      None
    • Difficulty:
      Unknown
    • Similar issues:
      XWIKI-8872MessageTool can read from the wrong context in scheduler jobs or threads
      XWIKI-6460External URLs generated from scheduler jobs can be wrong
      XWIKI-8926WatchList should use the same Velocity Context as the one used by other Scheduler jobs
      XWIKI-7676The Annotations REST resources do not set the context to the wiki and page where the REST call was made
      XWIKI-4610Wrong context usage in the Query plugin
      XWIKI-437Improve URL factories and create a xwiki-url module for manipulating XWiki URLs
      XWIKI-4866Wrong skins/resources URLs generated on path based subwiki
      XWIKI-4731Wrong resource path in Nsort table script
      XWIKI-4032doc.display( fieldName ) and doc.display( fieldName, mode ) can have different results in the same context
      XWIKI-3942Can't have the xwiki api Context as "context" binding in most of the JSR-223 engines

      Description

      This happens when having XWiki as the ROOT webapp.

      The scenario is the following :

      • Scheduler job calls mailsender.sendMailFromTemplate
      • mail sender creates a new ExternalServletURLFactory, initialized with the calling context, which has a XWikiServletRequestStub as request
      • URL factory initialization calls XWiki#getWebAppPath to get the context path
      • #getWebAppPath calls contextPath = context.getRequest().getContextPath(); which generates a NPE
      • ... NPE is caught and a wrong context path is computed from the context URL, base on context.getURL().getPath();

      For example, <host>/bin/bin/Sandbox/Test, when the servlet path is the standard one.

        Activity

          People

          • Assignee:
            Jerome Velociter
            Reporter:
            Jerome Velociter
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Date of First Response: