On Thu, Dec 18, 2008 at 5:38 PM, Juergen Lorenz
Simon <simon(a)webtecc.com> wrote:
Hi,
On 18.12.2008, at 15:08, Thomas Mortagne wrote:
On Thu, Dec 18, 2008 at 3:03 PM, Juergen Lorenz
Simon <simon(a)webtecc.com
> wrote:
> Hi,
>
> On 18.12.2008, at 14:37, Thomas Mortagne wrote:
>
>> On Thu, Dec 18, 2008 at 1:54 PM, Juergen Lorenz Simon <simon(a)webtecc.com
>>> wrote:
>>> Hi Thomas,
>>>
>>> no, I do not create a context myself. I'm running this in Eclipse
>>
>> But where do you get the XWikiContext you give to
>> createExternalURL() ?
>
>
> When the indexing plugin is instantiated I grab the context:
>
> public IndexUpdater(XWiki wiki, XWikiContext context) {
> this.xwiki = wiki;
> this.context = context;
> }
>
> Which is obtained from XWiki at plugin initialization time:
>
> public void init(XWikiContext context) {
> ...
> // initialize the actual plugin
> indexUpdater = new IndexUpdater(context.getWiki(), context);
> indexUpdater.start();
>
> // Hook into the document change notifications
> DocChangeRule docChangeRule = new DocChangeRule(indexUpdater);
>
> context
> .getWiki().getNotificationManager().addGeneralRule(docChangeRule);
> }
>
> Do you think I should use the context that comes in the notify()
> method instead?
No need, even if it's cleaner but it should be exactly the same java
object I think, so I don't understand why your context's request
object is wrong.
Could you send you full stack trace ?
Of course. But it's exactly as it was:
java.lang.NullPointerException
at com.xpn.xwiki.XWiki.getServletPath(XWiki.java:4317)
at
com
.xpn
.xwiki
.web.XWikiServletURLFactory.addServletPath(XWikiServletURLFactory.java:
208)
at
com
.xpn
.xwiki
.web.XWikiServletURLFactory.createURL(XWikiServletURLFactory.java:178)
at com.xpn.xwiki.doc.XWikiDocument.getURL(XWikiDocument.java:884)
at com.xpn.xwiki.doc.XWikiDocument.getURL(XWikiDocument.java:898)
at com.xpn.xwiki.doc.XWikiDocument.getURL(XWikiDocument.java:903)
at
com
.kontrast
.vodafone
.portal
.xwiki.plugins.indexer.IndexUpdater.runMainLoop(IndexUpdater.java:192)
at
com
.kontrast
.vodafone
.portal.xwiki.plugins.indexer.IndexUpdater.run(IndexUpdater.java:118)