You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2012/10/08 00:45:13 UTC
svn commit: r1395409 -
/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/el/ValueExpressionMethodExpression.java
Author: lu4242
Date: Sun Oct 7 22:45:12 2012
New Revision: 1395409
URL: http://svn.apache.org/viewvc?rev=1395409&view=rev
Log:
MYFACES-3613 NPE in composite component when ActionListener is missing in the source
Modified:
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/el/ValueExpressionMethodExpression.java
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/el/ValueExpressionMethodExpression.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/el/ValueExpressionMethodExpression.java?rev=1395409&r1=1395408&r2=1395409&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/el/ValueExpressionMethodExpression.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/el/ValueExpressionMethodExpression.java Sun Oct 7 22:45:12 2012
@@ -59,19 +59,44 @@ public class ValueExpressionMethodExpres
@Override
public MethodInfo getMethodInfo(ELContext context)
{
- return getMethodExpression(context).getMethodInfo(context);
+ MethodExpression me = getMethodExpression(context);
+ if (me != null)
+ {
+ return me.getMethodInfo(context);
+ }
+ return null;
}
@Override
public Object invoke(ELContext context, Object[] params)
{
- return getMethodExpression(context).invoke(context, params);
+ MethodExpression me = getMethodExpression(context);
+ if (me != null)
+ {
+ return me.invoke(context, params);
+ }
+ return null;
}
@Override
public boolean equals(Object obj)
{
- return getMethodExpression().equals(obj);
+ MethodExpression me = getMethodExpression();
+ if (me != null)
+ {
+ return me.equals(obj);
+ }
+ if (!(obj instanceof ValueExpressionMethodExpression))
+ {
+ return false;
+ }
+ ValueExpressionMethodExpression other = (ValueExpressionMethodExpression) obj;
+ if ((this.valueExpression == null && other.valueExpression != null) ||
+ (this.valueExpression != null && !this.valueExpression.equals(other.valueExpression)))
+ {
+ return false;
+ }
+ return true;
}
@Override
@@ -84,13 +109,23 @@ public class ValueExpressionMethodExpres
@Override
public int hashCode()
{
- return getMethodExpression().hashCode();
+ MethodExpression me = getMethodExpression();
+ if (me != null)
+ {
+ return me.hashCode();
+ }
+ return valueExpression.hashCode();
}
@Override
public boolean isLiteralText()
{
- return getMethodExpression().isLiteralText();
+ MethodExpression me = getMethodExpression();
+ if (me != null)
+ {
+ return me.isLiteralText();
+ }
+ return valueExpression.isLiteralText();
}
private MethodExpression getMethodExpression()