myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Darren Jensen (JIRA)" <...@myfaces.apache.org>
Subject [jira] Commented: (MYFACES-739) Null Pointer Exception
Date Fri, 21 Oct 2005 22:01:21 GMT
    [ http://issues.apache.org/jira/browse/MYFACES-739?page=comments#action_12332736 ] 

Darren Jensen commented on MYFACES-739:
---------------------------------------

I have problems with the above code.  After debugging it, I found the issue to be more involved.

The issues seems to be more related to UIData then UIViewRoot.  I will post more comments
after debugging.

> 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