Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 3.2, 3.3-milestone-2
-
Labels:None
-
Difficulty:Unknown
-
Similar issues:
XWIKI-8872MessageTool can read from the wrong context in scheduler jobs or threads XWIKI-6460 External URLs generated from scheduler jobs can be wrong XWIKI-8926 WatchList 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.
I see two things that could be fixed :
WDYT ?