You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Scott Oaks <sc...@oracle.com> on 2011/06/10 19:05:14 UTC

Re: [jira] [Updated] (PORTLETBRIDGE-214) BridgeImpl incorrectly cleans up after exceptions; retains contexts

Thanks Michael.

I need to file a tracking bug in bugdb for this -- is the appropriate 
category 1636 -> PORTLET -> BRIDGE

-Scott

On 06/10/11 13:03, Michael Freedman (JIRA) wrote:
>      [ https://issues.apache.org/jira/browse/PORTLETBRIDGE-214?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
>
> Michael Freedman updated PORTLETBRIDGE-214:
> -------------------------------------------
>
>
> Thanks.  I will look at this and fix/patch in the current Trunk by early next week.
>
>   
>> BridgeImpl incorrectly cleans up after exceptions; retains contexts
>> -------------------------------------------------------------------
>>
>>                 Key: PORTLETBRIDGE-214
>>                 URL: https://issues.apache.org/jira/browse/PORTLETBRIDGE-214
>>             Project: MyFaces Portlet Bridge
>>          Issue Type: Bug
>>          Components: Impl
>>    Affects Versions: 2.0.0
>>            Reporter: Scott Oaks
>>            Assignee: Michael Freedman
>>         Attachments: stack.txt
>>
>>
>> The exception handling of BridgeImpl.doFacesRequest() is incorrect, which leads to contexts not being released after an exception.
>> When an exception is thrown to the doFacesRequest() method, it ends up in this code:
>> try {
>>     ...
>> } catch (Exception e) {
>>    ...
>>    context.getExternalContext().log("Exception thrown in doFacesRequest:resource", e);   // line 1168
>>   ...
>> } finally {
>>   ...
>>   context.release();
>>   ...
>> }
>> The first problem is that whatever error is getting thrown to us is lost because line 1168 is generated a NullPointerException from context.getExternalContext().log(). So that NPE gets thrown from the exception block and the original, actual root-cause, exception is lost.
>> The reason that this code fails is that context.getExternalContext() returns null -- the processing has been redirected, and this context has already been released in redirectRender(). Which leads to the much more serious issue -- the new context established by redirectRender() is never released in the exception handling: the context.release() call in the finally block of doFacesRequest() is the original, already released context. 
>>     
>
> --
> This message is automatically generated by JIRA.
> For more information on JIRA, see: http://www.atlassian.com/software/jira
>