myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Marinschek (JIRA)" <...@myfaces.apache.org>
Subject [jira] Commented: (MYFACES-739) Null Pointer Exception
Date Mon, 31 Oct 2005 13:25:56 GMT
    [ http://issues.apache.org/jira/browse/MYFACES-739?page=comments#action_12356411 ] 

Martin Marinschek commented on MYFACES-739:
-------------------------------------------

mail by Darren Jensen:

I do not call getDataModel directly.   I am detaching the HtmlDataTable in a Component ProcessAction
method.

When the ProcessAction method call completes, an HTMLDataTableHack method higher up in the
call stack will call the getDataModel as it is returning to process the next event in the
broadcast events loop.

Let me know if you need more details.
Regards


> Null Pointer Exception
> ----------------------
>
>          Key: MYFACES-739
>          URL: http://issues.apache.org/jira/browse/MYFACES-739
>      Project: MyFaces
>         Type: Bug
>   Components: Implementation
>     Versions: Nightly
>  Environment: JBoss
>     Reporter: Darren Jensen

>
> I receive a null pointer exception in the UIViewRoot._broadcastForPhase private method.
> This occurs after I manually remove components from the component tree.
> I appears the error is generate because a list iterator is being used for removing events
from the _events list.
> After I first modifed the code place a try catch around the for statement, the events
processing was aborted correctly.
> I have made the following changes as a workaround:
>    private void _broadcastForPhase(PhaseId phaseId)
>     {
>         if (_events == null) return;
>         boolean abort = false;
>         int phaseIdOrdinal = phaseId.getOrdinal();
>         
> // DWJ CHANGE BEGIN
>         //iterate until until no more events to broadcast
>         //we should not use an iterator because because of the
>         //ConcurrentModificationException, so use while{} as a workaround
>         //To handle possible infinite event queueing
>         //capture the original size of the _events list and 
>         //abort after 10000 iterations
>         int currIteration = 0;
>         int abortIteration = _events.size() + 10000;
>         int itemIdx = 0;
>         while (itemIdx < _events.size()){
>         	FacesEvent event = (FacesEvent) _events.get(itemIdx);
>             int ordinal = event.getPhaseId().getOrdinal();
>             if (ordinal == ANY_PHASE_ORDINAL ||
>             	ordinal == phaseIdOrdinal)
>             {
>                 UIComponent source = event.getComponent();
>                 try {
>                     source.broadcast(event);
>                 } catch (AbortProcessingException e) {
>                     // abort event processing
>                     // Page 3-30 of JSF 1.1 spec: "Throw an AbortProcessingException,
to tell the JSF implementation
>                     //  that no further broadcast of this event, or any further events,
should take place."
>                     abort = true;
>                     break;
>                 }
>             }
>             _events.remove(itemIdx);  //always stay at zero position
>             //check for infinite event queueing
>             if (currIteration > abortIteration){
>             	abort = true;
>             	break;
>             }
>             currIteration++;
>         }
> //DWJ CHANGE END
>         if (abort) {
>             // TODO: abort processing of any event of any phase or just of any event
of the current phase???
>             clearEvents();
>         }
>     }

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


Mime
View raw message