Alexandre Maret wrote:

> Hi,
>
> I have been getting an error related to the RSSPortlets. I think it may
> be due to the way the FeedDeamon instanciates the portlets. I
> managed to track the error back to a setContent() call in
> RSSPortlet - line 197 (I'm working on last week's CVS version).
>
> [...] --  ERROR  -- RSSPortlet:  Couldn't set items for XML document ->
> http://10.am/Personal/PDA-rss
> Exception:  java.lang.NullPointerException
> Stack Trace follows:
> java.lang.NullPointerException
> at org.apache.tomcat.core.RequestImpl.getSession(RequestImpl.java:407)
> at
> org.apache.tomcat.core.RequestImpl.isRequestedSessionIdValid(RequestImpl.jav
> a:436)
> at
> org.apache.tomcat.core.HttpServletRequestFacade.isRequestedSessionIdValid(Ht
> tpServletRequestFacade.java:317)
> at
> org.apache.jetspeed.capability.CapabilityMapFactory.getCapabilityMap(Capabil
> ityMapFactory.java:106)
> at
> org.apache.jetspeed.portal.portlets.AbstractPortlet.setContent(AbstractPortl
> et.java:242)
> at
> org.apache.jetspeed.portal.portlets.AbstractPortlet.setContent(AbstractPortl
> et.java:223)
> at org.apache.jetspeed.portal.portlets.RSSPortlet.init(RSSPortlet.java:208)
> at
> org.apache.jetspeed.portal.factory.PortletFactory.getPortlet(PortletFactory.
> java:459)
> at
> org.apache.jetspeed.portal.factory.PortletFactory.getPortlet(PortletFactory.
> java:160)
> at
> org.apache.jetspeed.portal.factory.PortletFactory.getPortlet(PortletFactory.
> java:141)
> at
> org.apache.jetspeed.daemon.impl.util.feeddaemon.Instantiator.run(Instantiato
> r.java:222)
> at
> org.apache.jetspeed.util.threadpool.RunnableThread.run(RunnableThread.java:1
> 24)
>
> (BTW, 10.am has some mysql problem today... you won't go very far if you try
> to reproduce the case with the same feeds)
>
> setContent() retrieves the current CapabilityMap by calling
> CapabilityMapFactory's "CapabilityMap getCapabilityMap( RunData rundata )"
> function. This is where the exception is thrown.
>
> Below is the guilty code:
>
>         // SGP: Tomcat gives a nullpointer exception sometimes
>         // unless we ask first if the session is valid.
>
>        if ( rundata.getRequest().isRequestedSessionIdValid() && !
> rundata.getSession().isNew() ) {
>             cm =
> CapabilityMap)rundata.getSession().getValue( CAPABILITY_MAP );
>        }
>
> If I get rid of the rundata.getRequest().isRequestedSessionIdValid() check,
> the nullpointerexception is not thrown... what about checking if
> getRequest()
> returns null ?
>

This is done at the beggining of the method.

There is a check for rundata == null || rundata.getRequest() == null

This problem is (I think) due to the fact the RunData is not always "true" or
else corrupted. Thus, some of the Tomcat Requests are references to faked/old
requests. I don't have your problem, though. I had to put the "isValid" check to
avoid the same kind of NullPointerException in getRequest()-getSession(). The
current code works with my version of Tomcat (3.2b4). To be safe, the whole
thing should be in a try {} block, and use the same workaround used in the
beggining, possibly. To be really safe, the method should be called with the
requests rundata, and not with the getPortletConfig.runData.

>
> The "multithreading problems in the portlet drawing?" thread seems to be
> dead
> and I'm a bit confused by what came out. Since this problem is more or less
> related, could someone tell me which post is "authoritative" and
> where we are going WRT RunData, PortletConfig, ... ?
>

I don't know either. I think I should write a concrete proposal and discuss it
and take a decision in the list. I will probably send one next week, after I
experiment a little bit more. If somebody has input (be it code or design ideas)
on this, of course, s/he is welcome to put it here.

>
> Hope this helps,
>
> Cheers
>
>   Alex
>
> --
> --------------------------------------------------------------
> Please read the FAQ! <http://java.apache.org/faq/>
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> Archives and Other:  <http://java.apache.org/main/mail.html>
> Problems?:           [EMAIL PROTECTED]



--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to