You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Jakob Korherr (JIRA)" <de...@myfaces.apache.org> on 2010/03/16 16:20:27 UTC

[jira] Created: (MYFACES-2607) Ugly NPE in CompositeFunctionMapper.resolveFunction() if second FunctionMapper is null

Ugly NPE in CompositeFunctionMapper.resolveFunction() if second FunctionMapper is null
--------------------------------------------------------------------------------------

                 Key: MYFACES-2607
                 URL: https://issues.apache.org/jira/browse/MYFACES-2607
             Project: MyFaces Core
          Issue Type: Task
          Components: JSR-314
    Affects Versions: 2.0.0-beta-3
            Reporter: Jakob Korherr
            Assignee: Jakob Korherr
            Priority: Minor


The class CompositeFunctionMapper gets two FunctionMappers in the constructor which it uses to resolve EL functions in its method resolveFunction(). Currently the first FunctionMapper is always NamespaceHandler and the second one is the one from the ELContext, which is null at all times. I think this is also a problem, but at first I want to get rid of this ugly NPE.

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


[jira] Commented: (MYFACES-2607) Ugly NPE in CompositeFunctionMapper.resolveFunction() if second FunctionMapper is null

Posted by "Martin Marinschek (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12845957#action_12845957 ] 

Martin Marinschek commented on MYFACES-2607:
--------------------------------------------

Hi Jakob,

in general, it is not really a good idea to try to get rid of null pointer exceptions, if (as you say in the second part of the comment) a null value is not expected at this location. The general rule is: the earlier an exception happens, the better for finding out why it occurs!

best regards,

Martin

> Ugly NPE in CompositeFunctionMapper.resolveFunction() if second FunctionMapper is null
> --------------------------------------------------------------------------------------
>
>                 Key: MYFACES-2607
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2607
>             Project: MyFaces Core
>          Issue Type: Task
>          Components: JSR-314
>    Affects Versions: 2.0.0-beta-3
>            Reporter: Jakob Korherr
>            Assignee: Jakob Korherr
>            Priority: Minor
>             Fix For: 2.0.0-beta-3
>
>
> The class CompositeFunctionMapper gets two FunctionMappers in the constructor which it uses to resolve EL functions in its method resolveFunction(). Currently the first FunctionMapper is always NamespaceHandler and the second one is the one from the ELContext, which is null at all times. I think this is also a problem, but at first I want to get rid of this ugly NPE.

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


[jira] Resolved: (MYFACES-2607) Ugly NPE in CompositeFunctionMapper.resolveFunction() if second FunctionMapper is null

Posted by "Jakob Korherr (JIRA)" <de...@myfaces.apache.org>.
     [ https://issues.apache.org/jira/browse/MYFACES-2607?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jakob Korherr resolved MYFACES-2607.
------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0.0-beta-3

> Ugly NPE in CompositeFunctionMapper.resolveFunction() if second FunctionMapper is null
> --------------------------------------------------------------------------------------
>
>                 Key: MYFACES-2607
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2607
>             Project: MyFaces Core
>          Issue Type: Task
>          Components: JSR-314
>    Affects Versions: 2.0.0-beta-3
>            Reporter: Jakob Korherr
>            Assignee: Jakob Korherr
>            Priority: Minor
>             Fix For: 2.0.0-beta-3
>
>
> The class CompositeFunctionMapper gets two FunctionMappers in the constructor which it uses to resolve EL functions in its method resolveFunction(). Currently the first FunctionMapper is always NamespaceHandler and the second one is the one from the ELContext, which is null at all times. I think this is also a problem, but at first I want to get rid of this ugly NPE.

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


[jira] Commented: (MYFACES-2607) Ugly NPE in CompositeFunctionMapper.resolveFunction() if second FunctionMapper is null

Posted by "Jakob Korherr (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12845967#action_12845967 ] 

Jakob Korherr commented on MYFACES-2607:
----------------------------------------

Hi Martin,

It has to be determined (and actually I'm working on it right now) if the null value is ok here ore not. If it is ok, we have to get rid of the NPE (as I did), otherwise we have to check for a null-value in the constructor and throw a IllegalStateException there. As I said, I'm currently working on that.

Regards,
Jakob

> Ugly NPE in CompositeFunctionMapper.resolveFunction() if second FunctionMapper is null
> --------------------------------------------------------------------------------------
>
>                 Key: MYFACES-2607
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2607
>             Project: MyFaces Core
>          Issue Type: Task
>          Components: JSR-314
>    Affects Versions: 2.0.0-beta-3
>            Reporter: Jakob Korherr
>            Assignee: Jakob Korherr
>            Priority: Minor
>             Fix For: 2.0.0-beta-3
>
>
> The class CompositeFunctionMapper gets two FunctionMappers in the constructor which it uses to resolve EL functions in its method resolveFunction(). Currently the first FunctionMapper is always NamespaceHandler and the second one is the one from the ELContext, which is null at all times. I think this is also a problem, but at first I want to get rid of this ugly NPE.

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


[jira] Commented: (MYFACES-2607) Ugly NPE in CompositeFunctionMapper.resolveFunction() if second FunctionMapper is null

Posted by "Martin Marinschek (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12846353#action_12846353 ] 

Martin Marinschek commented on MYFACES-2607:
--------------------------------------------

Hi jakob,

sure, sure - my comment was purely theoretical, if the second part of your statement would have been true.

In any case, I think I like the NoopFunctionMapper a bit more than passing null - it sounds like a good thing to do to tell people: there is nothing, but this is good as it is.

best regards,

Martin

> Ugly NPE in CompositeFunctionMapper.resolveFunction() if second FunctionMapper is null
> --------------------------------------------------------------------------------------
>
>                 Key: MYFACES-2607
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2607
>             Project: MyFaces Core
>          Issue Type: Task
>          Components: JSR-314
>    Affects Versions: 2.0.0-beta-3
>            Reporter: Jakob Korherr
>            Assignee: Jakob Korherr
>            Priority: Minor
>             Fix For: 2.0.0-beta-3
>
>
> The class CompositeFunctionMapper gets two FunctionMappers in the constructor which it uses to resolve EL functions in its method resolveFunction(). Currently the first FunctionMapper is always NamespaceHandler and the second one is the one from the ELContext, which is null at all times. I think this is also a problem, but at first I want to get rid of this ugly NPE.

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


[jira] Commented: (MYFACES-2607) Ugly NPE in CompositeFunctionMapper.resolveFunction() if second FunctionMapper is null

Posted by "Jakob Korherr (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12846045#action_12846045 ] 

Jakob Korherr commented on MYFACES-2607:
----------------------------------------

After some digging I found out that it is totally OK for the second FunctionMapper to be null at this place, because on Facelets the FunctionMappers are created from the xmlns definitions and thus via the NamespaceHandlers. And the first NamespaceHandler just has no other FunctionMapper available yet, thus it sets null in CompositeFunctionMapper.

This means my committed null-check is totally ok, because the second FunctionMapper really can be null. In this scenario we just have to ignore it!

Furthermore a black-box test of Mojarra revealed that they install a NoopFunctionMapper to circumvent the NPE. Adding the null-check as I did is just another way to deal with this problem.

> Ugly NPE in CompositeFunctionMapper.resolveFunction() if second FunctionMapper is null
> --------------------------------------------------------------------------------------
>
>                 Key: MYFACES-2607
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2607
>             Project: MyFaces Core
>          Issue Type: Task
>          Components: JSR-314
>    Affects Versions: 2.0.0-beta-3
>            Reporter: Jakob Korherr
>            Assignee: Jakob Korherr
>            Priority: Minor
>             Fix For: 2.0.0-beta-3
>
>
> The class CompositeFunctionMapper gets two FunctionMappers in the constructor which it uses to resolve EL functions in its method resolveFunction(). Currently the first FunctionMapper is always NamespaceHandler and the second one is the one from the ELContext, which is null at all times. I think this is also a problem, but at first I want to get rid of this ugly NPE.

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