You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by mm...@apache.org on 2007/07/27 14:57:52 UTC

svn commit: r560219 - in /myfaces/core/branches/1_2_1/api/src/main: java-templates/javax/faces/component/UIInputTemplate.java java/javax/faces/component/_ComponentUtils.java

Author: mmarinschek
Date: Fri Jul 27 05:57:50 2007
New Revision: 560219

URL: http://svn.apache.org/viewvc?view=rev&rev=560219
Log:
https://issues.apache.org/jira/browse/MYFACES-1687: updateModel throws an exception, and doesn't show a message to the user anymore.

Modified:
    myfaces/core/branches/1_2_1/api/src/main/java-templates/javax/faces/component/UIInputTemplate.java
    myfaces/core/branches/1_2_1/api/src/main/java/javax/faces/component/_ComponentUtils.java

Modified: myfaces/core/branches/1_2_1/api/src/main/java-templates/javax/faces/component/UIInputTemplate.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/1_2_1/api/src/main/java-templates/javax/faces/component/UIInputTemplate.java?view=diff&rev=560219&r1=560218&r2=560219
==============================================================================
--- myfaces/core/branches/1_2_1/api/src/main/java-templates/javax/faces/component/UIInputTemplate.java (original)
+++ myfaces/core/branches/1_2_1/api/src/main/java-templates/javax/faces/component/UIInputTemplate.java Fri Jul 27 05:57:50 2007
@@ -15,20 +15,22 @@
 */
 package javax.faces.component;
 
-import javax.el.ELException;
 import javax.el.ValueExpression;
-import javax.faces.validator.Validator;
-import javax.faces.el.MethodBinding;
-import javax.faces.el.EvaluationException;
-import javax.faces.el.ValueBinding;
+import javax.faces.FacesException;
+import javax.faces.application.FacesMessage;
 import javax.faces.context.FacesContext;
-import javax.faces.event.FacesEvent;
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+import javax.faces.el.EvaluationException;
+import javax.faces.el.MethodBinding;
 import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
 import javax.faces.event.ValueChangeEvent;
+import javax.faces.event.ValueChangeListener;
 import javax.faces.render.Renderer;
-import javax.faces.convert.Converter;
-import javax.faces.convert.ConverterException;
-import javax.faces.application.FacesMessage;
+import javax.faces.validator.Validator;
+import java.util.ArrayList;
+import java.util.List;
 
 
 /**
@@ -198,24 +200,11 @@
             setValue(null);
             setLocalValueSet(false);
         }
-        catch (ELException elException)
-        {
-            String exceptionMessage = elException.getMessage();
-            if (exceptionMessage == null)
-            {
-                _MessageUtils.addErrorMessage(context, this, UPDATE_MESSAGE_ID, new Object[]{_MessageUtils.getLabel(context,this)});
-            }
-            else
-            {
-                _MessageUtils.addErrorMessage(context, this, elException);
-            }
-            setValid(false);
-        }
-        catch (Exception e)
+        catch (Exception ex)
         {
-            context.getExternalContext().log(e.getMessage(), e);
-            _MessageUtils.addErrorMessage(context, this, UPDATE_MESSAGE_ID, new Object[]{_MessageUtils.getLabel(context,this)});
-            setValid(false);
+            throw new FacesException("Exception while setting value for expression : "+
+                    expression.getExpressionString()+" of component with path : "
+                    +_ComponentUtils.getPathToComponent(this),ex);
         }
     }
 

Modified: myfaces/core/branches/1_2_1/api/src/main/java/javax/faces/component/_ComponentUtils.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/1_2_1/api/src/main/java/javax/faces/component/_ComponentUtils.java?view=diff&rev=560219&r1=560218&r2=560219
==============================================================================
--- myfaces/core/branches/1_2_1/api/src/main/java/javax/faces/component/_ComponentUtils.java (original)
+++ myfaces/core/branches/1_2_1/api/src/main/java/javax/faces/component/_ComponentUtils.java Fri Jul 27 05:57:50 2007
@@ -234,4 +234,48 @@
         }
         return defaultValue;
     }
+
+    static String getPathToComponent(UIComponent component) {
+        StringBuffer buf = new StringBuffer();
+
+        if(component == null)
+        {
+            buf.append("{Component-Path : ");
+            buf.append("[null]}");
+            return buf.toString();
+        }
+
+        getPathToComponent(component,buf);
+
+        buf.insert(0,"{Component-Path : ");
+        buf.append("}");
+
+        return buf.toString();
+    }
+
+    private static void getPathToComponent(UIComponent component, StringBuffer buf)
+    {
+        if(component == null)
+            return;
+
+        StringBuffer intBuf = new StringBuffer();
+
+        intBuf.append("[Class: ");
+        intBuf.append(component.getClass().getName());
+        if(component instanceof UIViewRoot)
+        {
+            intBuf.append(",ViewId: ");
+            intBuf.append(((UIViewRoot) component).getViewId());
+        }
+        else
+        {
+            intBuf.append(",Id: ");
+            intBuf.append(component.getId());
+        }
+        intBuf.append("]");
+
+        buf.insert(0,intBuf.toString());
+
+        getPathToComponent(component.getParent(), buf);
+    }
 }