Author: awiner
Date: Thu Jan  4 16:20:36 2007
New Revision: 492831

URL: http://svn.apache.org/viewvc?view=rev&rev=492831
Log:
ADFFACES-346:  JSF 1.2: "validator" attribute use results in ELException 
instead of proper FacesMessage

In wrappers that go from ValueBinding to ValueExpression or vice versa, or 
MethodBinding to MethodExpression or vice versa, you need to throw the proper 
one of EvaluationException or ELException, so unwrap and convert exceptions as 
needed.

Modified:
    
incubator/adffaces/branches/faces-1_2-070102/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/bean/ValueBindingValueExpression.java
    
incubator/adffaces/branches/faces-1_2-070102/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/bean/ValueExpressionValueBinding.java
    
incubator/adffaces/branches/faces-1_2-070102/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/MethodBindingMethodExpression.java
    
incubator/adffaces/branches/faces-1_2-070102/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/MethodExpressionMethodBinding.java
    
incubator/adffaces/branches/faces-1_2-070102/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/util/MethodExpressionMethodBinding.java

Modified: 
incubator/adffaces/branches/faces-1_2-070102/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/bean/ValueBindingValueExpression.java
URL: 
http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-070102/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/bean/ValueBindingValueExpression.java?view=diff&rev=492831&r1=492830&r2=492831
==============================================================================
--- 
incubator/adffaces/branches/faces-1_2-070102/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/bean/ValueBindingValueExpression.java
 (original)
+++ 
incubator/adffaces/branches/faces-1_2-070102/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/bean/ValueBindingValueExpression.java
 Thu Jan  4 16:20:36 2007
@@ -3,9 +3,11 @@
 import java.io.Serializable;
 
 import javax.el.ELContext;
+import javax.el.ELException;
 import javax.el.ValueExpression;
 
 import javax.faces.context.FacesContext;
+import javax.faces.el.EvaluationException;
 import javax.faces.el.ValueBinding;
 
 
@@ -27,22 +29,54 @@
   
   public Object getValue(ELContext elContext)
   {
-    return _binding.getValue(FacesContext.getCurrentInstance());
+    try
+    {
+      return _binding.getValue(FacesContext.getCurrentInstance());
+    }
+    // Convert EvaluationExceptions into ELExceptions
+    catch (EvaluationException ee)
+    {
+      throw new ELException(ee.getMessage(), ee.getCause());
+    }
   }
 
   public void setValue(ELContext elContext, Object object)
   {
-    _binding.setValue(FacesContext.getCurrentInstance(), object);
+    try
+    {
+      _binding.setValue(FacesContext.getCurrentInstance(), object);
+    }
+    // Convert EvaluationExceptions into ELExceptions
+    catch (EvaluationException ee)
+    {
+      throw new ELException(ee.getMessage(), ee.getCause());
+    }
   }
 
   public boolean isReadOnly(ELContext elContext)
   {
-    return _binding.isReadOnly(FacesContext.getCurrentInstance());
+    try
+    {
+      return _binding.isReadOnly(FacesContext.getCurrentInstance());
+    }
+    // Convert EvaluationExceptions into ELExceptions
+    catch (EvaluationException ee)
+    {
+      throw new ELException(ee.getMessage(), ee.getCause());
+    }
   }
 
   public Class<?> getType(ELContext elContext)
   {
-    return _binding.getType(FacesContext.getCurrentInstance());
+    try
+    {
+      return _binding.getType(FacesContext.getCurrentInstance());
+    }
+    // Convert EvaluationExceptions into ELExceptions
+    catch (EvaluationException ee)
+    {
+      throw new ELException(ee.getMessage(), ee.getCause());
+    }
   }
 
   public Class<?> getExpectedType()

Modified: 
incubator/adffaces/branches/faces-1_2-070102/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/bean/ValueExpressionValueBinding.java
URL: 
http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-070102/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/bean/ValueExpressionValueBinding.java?view=diff&rev=492831&r1=492830&r2=492831
==============================================================================
--- 
incubator/adffaces/branches/faces-1_2-070102/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/bean/ValueExpressionValueBinding.java
 (original)
+++ 
incubator/adffaces/branches/faces-1_2-070102/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/bean/ValueExpressionValueBinding.java
 Thu Jan  4 16:20:36 2007
@@ -1,8 +1,10 @@
 package org.apache.myfaces.trinidad.bean;
 
+import javax.el.ELException;
 import javax.el.ValueExpression;
 
 import javax.faces.context.FacesContext;
+import javax.faces.el.EvaluationException;
 import javax.faces.el.ValueBinding;
 
 @Deprecated
@@ -21,22 +23,54 @@
   
   public Object getValue(FacesContext facesContext)
   {
-    return _ve.getValue(facesContext.getELContext());
+    try
+    {
+      return _ve.getValue(facesContext.getELContext());
+    }
+    // Convert EL exceptions into EvaluationExceptions
+    catch (ELException ee)
+    {
+      throw new EvaluationException(ee.getMessage(), ee.getCause());
+    }    
   }
 
   public void setValue(FacesContext facesContext, Object object)
   {
-    _ve.setValue(facesContext.getELContext(), object);
+    try
+    {
+      _ve.setValue(facesContext.getELContext(), object);
+    }
+    // Convert EL exceptions into EvaluationExceptions
+    catch (ELException ee)
+    {
+      throw new EvaluationException(ee.getMessage(), ee.getCause());
+    }    
   }
 
   public boolean isReadOnly(FacesContext facesContext)
   {
-    return _ve.isReadOnly(facesContext.getELContext());
+    try
+    {
+      return _ve.isReadOnly(facesContext.getELContext());
+    }
+    // Convert EL exceptions into EvaluationExceptions
+    catch (ELException ee)
+    {
+      throw new EvaluationException(ee.getMessage(), ee.getCause());
+    }    
   }
 
   public Class getType(FacesContext facesContext)
   {
-    return _ve.getType(facesContext.getELContext());
+    try
+    {
+      return _ve.getType(facesContext.getELContext());
+    }
+    // Convert EL exceptions into EvaluationExceptions
+    catch (ELException ee)
+    {
+      throw new EvaluationException(ee.getMessage(), ee.getCause());
+    }
   }
   
   private final ValueExpression _ve;

Modified: 
incubator/adffaces/branches/faces-1_2-070102/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/MethodBindingMethodExpression.java
URL: 
http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-070102/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/MethodBindingMethodExpression.java?view=diff&rev=492831&r1=492830&r2=492831
==============================================================================
--- 
incubator/adffaces/branches/faces-1_2-070102/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/MethodBindingMethodExpression.java
 (original)
+++ 
incubator/adffaces/branches/faces-1_2-070102/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/MethodBindingMethodExpression.java
 Thu Jan  4 16:20:36 2007
@@ -3,10 +3,12 @@
 import java.io.Serializable;
 
 import javax.el.ELContext;
+import javax.el.ELException;
 import javax.el.MethodExpression;
 import javax.el.MethodInfo;
 
 import javax.faces.context.FacesContext;
+import javax.faces.el.EvaluationException;
 import javax.faces.el.MethodBinding;
 
 
@@ -34,7 +36,15 @@
 
   public Object invoke(ELContext elContext, Object[] params)
   {
-    return _binding.invoke(FacesContext.getCurrentInstance(), params);
+    try
+    {
+      return _binding.invoke(FacesContext.getCurrentInstance(), params);
+    }
+    // Convert EvaluationExceptions into ELExceptions
+    catch (EvaluationException ee)
+    {
+      throw new ELException(ee.getMessage(), ee.getCause());
+    }
   }
 
   public String getExpressionString()

Modified: 
incubator/adffaces/branches/faces-1_2-070102/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/MethodExpressionMethodBinding.java
URL: 
http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-070102/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/MethodExpressionMethodBinding.java?view=diff&rev=492831&r1=492830&r2=492831
==============================================================================
--- 
incubator/adffaces/branches/faces-1_2-070102/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/MethodExpressionMethodBinding.java
 (original)
+++ 
incubator/adffaces/branches/faces-1_2-070102/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/MethodExpressionMethodBinding.java
 Thu Jan  4 16:20:36 2007
@@ -1,9 +1,11 @@
 package org.apache.myfaces.trinidad.component;
 
+import javax.el.ELException;
 import javax.el.MethodExpression;
 import javax.el.MethodInfo;
 
 import javax.faces.context.FacesContext;
+import javax.faces.el.EvaluationException;
 import javax.faces.el.MethodBinding;
 
 @Deprecated
@@ -21,7 +23,15 @@
   
   public Object invoke(FacesContext facesContext, Object[] params)
   {
-    return _me.invoke(facesContext.getELContext(), params);
+    try
+    {
+      return _me.invoke(facesContext.getELContext(), params);
+    }
+    // Convert EL exceptions into EvaluationExceptions
+    catch (ELException ee)
+    {
+      throw new EvaluationException(ee.getMessage(), ee.getCause());
+    }
   }
 
   public Class getType(FacesContext facesContext)

Modified: 
incubator/adffaces/branches/faces-1_2-070102/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/util/MethodExpressionMethodBinding.java
URL: 
http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-070102/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/util/MethodExpressionMethodBinding.java?view=diff&rev=492831&r1=492830&r2=492831
==============================================================================
--- 
incubator/adffaces/branches/faces-1_2-070102/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/util/MethodExpressionMethodBinding.java
 (original)
+++ 
incubator/adffaces/branches/faces-1_2-070102/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/util/MethodExpressionMethodBinding.java
 Thu Jan  4 16:20:36 2007
@@ -50,11 +50,12 @@
     {
       return _expression.invoke(context.getELContext(), params);
     }
-    catch (EvaluationException ee)
+    // Convert EL exceptions into EvaluationExceptions
+    catch (ELException ee)
     {
-      throw new ELException(ee.getMessage(), ee.getCause());
+      throw new EvaluationException(ee.getMessage(), ee.getCause());
     }
   }
 
   private MethodExpression _expression;
-}
\ No newline at end of file
+}


Reply via email to