Exception in URL Factory initialization
---------------------------------------

                 Key: XWIKI-1894
                 URL: http://jira.xwiki.org/jira/browse/XWIKI-1894
             Project: XWiki Platform
          Issue Type: Bug
          Components: Actions and URLs
    Affects Versions: 1.2 M2
            Reporter: Vincent Massol
            Priority: Minor
             Fix For: 1.2 RC1


When multiple thread are calling the xwiki URL factory service creation it's 
possible that one thread will throw a NPE:

{noformat}
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)
{noformat}

The reason is because the code does the following check:

{code}
    public XWikiURLFactoryService getURLFactoryService()
    {
        if (urlFactoryService == null) {
            synchronized (URLFACTORY_SERVICE_LOCK) {
                if (urlFactoryService == null) {
{code}

but later the init is done is 2 steps: the creation of the object and its 
initilization:

{code}
                            urlFactoryService =
                                (XWikiURLFactoryService) 
Class.forName(urlFactoryServiceClass).newInstance();
                            urlFactoryService.init(this);
code}

Thus it's possible that urlFactoryService isn't null but still isn't 
initialized.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.xwiki.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
notifications mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/notifications

Reply via email to