Details
-
Bug
-
Resolution: Fixed
-
Minor
-
1.2 M2
-
None
Description
When multiple thread are calling the xwiki URL factory service creation it's possible that one thread will throw a NPE:
java.lang.NullPointerException at com.xpn.xwiki.web.XWikiURLFactoryServiceImpl.createURLFactory(XWikiURLFactoryServiceImpl.java:81) at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:108) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
The reason is because the code does the following check:
public XWikiURLFactoryService getURLFactoryService() { if (urlFactoryService == null) { synchronized (URLFACTORY_SERVICE_LOCK) { if (urlFactoryService == null) {
but later the init is done is 2 steps: the creation of the object and its initilization:
urlFactoryService =
(XWikiURLFactoryService) Class.forName(urlFactoryServiceClass).newInstance();
urlFactoryService.init(this);
code}
Thus it's possible that urlFactoryService isn't null but still isn't initialized.
Attachments
Issue Links
- is related to
-
XWIKI-1677 A lot of exceptions while upgrading from XWiki 1.1M3 to 1.1RC1
- Closed