[ 
https://issues.apache.org/jira/browse/MYFACES-2730?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12881633#action_12881633
 ] 

Jakob Korherr commented on MYFACES-2730:
----------------------------------------

Hi Leo,

Yes, aggresively throwing UnsupportedOperationException could prevent 
applications from beeing deployed, but those applications include invalid 
behavior, thus - on my opinion - it is the right thing to throw the Exception 
rather than to let invalid code be deployed.

Also, with the new code in place, we are not using any factories at startup 
anymore, so why would we provide this dummy functionality for them if they are 
not used?

Some comments about the latest patch (MYFACES-2730-3.patch):

Why are you using the following code

try
 {
    throw new UnsupportedOperationException(EXCEPTION_TEXT + _getTime());
}
catch (UnsupportedOperationException e)
{
    Logger.getLogger(StartupServletExternalContextImpl.class.getName()).log(
            Level.WARNING, EXCEPTION_TEXT + _getTime(), e);
}

instead of just

log.log(Level.WARNING, "some msg", new UnsupportedOperationException("exception 
message"));

Throwing and immediatly catching an Exception does not make much sence to me....
However I really like the usage of the ExternalContext base impl from my 
solution - I think that's the best way to go for the ExternalContext!
Another thing about the patch: I think StartupFacesContextImpl contains many 
(somehow) duplicate code to FacesContextImpl. Thus this may be a problem with 
maintaining...

All in all I really have to say (again), that I don't like this dummy 
functionality. First it lets invalid code be deployed and second it may be hard 
to maintain (see the issues we had with the dummy Servlet request and response 
classes in the past...). Maybe we should write a mail to the dev list or start 
a vote or whatever to get the whole community's opinion about this.

Regards,
Jakob

> FacesContext not available on application startup
> -------------------------------------------------
>
>                 Key: MYFACES-2730
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2730
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-127, JSR-252, JSR-314
>    Affects Versions: 1.1.8, 1.2.9, 2.0.0
>            Reporter: Nick Belaevski
>            Assignee: Leonardo Uribe
>             Fix For: 2.0.2-SNAPSHOT
>
>         Attachments: MYFACES-2730-1.patch, MYFACES-2730-2.patch, 
> MYFACES-2730-3.patch, MYFACES-2730-revert.patch
>
>
> If custom ResourceHandler calls FacesContext.getCurrentInstance() in 
> constructor to read init parameters, null value is returned. This affects 
> latest MyFaces 2.0.0-SNAPSHOT. Mojarra 2.0 provides InitFacesContext in this 
> case.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to