myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mat...@apache.org
Subject svn commit: r432145 - /myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/el/PropertyResolverImpl.java
Date Thu, 17 Aug 2006 05:29:41 GMT
Author: matzew
Date: Wed Aug 16 22:29:41 2006
New Revision: 432145

URL: http://svn.apache.org/viewvc?rev=432145&view=rev
Log:
MYFACES-1386 + added getMessage to 12_branch

Modified:
    myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/el/PropertyResolverImpl.java

Modified: myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/el/PropertyResolverImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/el/PropertyResolverImpl.java?rev=432145&r1=432144&r2=432145&view=diff
==============================================================================
--- myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/el/PropertyResolverImpl.java
(original)
+++ myfaces/core/branches/jsf12/impl/src/main/java/org/apache/myfaces/el/PropertyResolverImpl.java
Wed Aug 16 22:29:41 2006
@@ -389,7 +389,7 @@
         if (m == null)
         {
             throw new PropertyNotFoundException(
-                "Bean: " + base.getClass().getName() + ", property: " + name);
+                getMessage(base, name)+ " (no write method for property!)"); 
         }
 
         // Check if the concrete class of this method is accessible and if not
@@ -398,7 +398,7 @@
         if (m == null)
         {
             throw new PropertyNotFoundException(
-                "Bean: " + base.getClass().getName() + ", property: " + name + " (not accessible!)");
+                getMessage(base, name) + " (not accessible!)");
         }
 
         try
@@ -407,11 +407,27 @@
         }
         catch (Throwable t)
         {
-            throw new EvaluationException("Bean: "
-                + base.getClass().getName() + ", property: " + name, t);
+            log.debug("Exception while invoking setter method.",t);
+            throw new EvaluationException(getMessage(base, name, newValue, m), t);
         }
     }
 
+    private static String getMessage(Object base, String name, Object newValue, Method m)
+    {
+        return "Bean: "
+            + base.getClass().getName() + ", property: " + name +", newValue: "+(newValue==null?"
null ":newValue)+
+                ",newValue class: "+(newValue==null?" null ":newValue.getClass().getName())+"
method parameter class: "
+                +((m.getParameterTypes()!=null&&m.getParameterTypes().length>0)
+                    ?m.getParameterTypes()[0].getName():"null");
+
+    }
+
+    private static String getMessage(Object base, String name)
+    {
+        return "Bean: "
+            + base.getClass().getName() + ", property: " + name;
+    }
+
     public static Object getProperty(Object base, String name)
     {
         PropertyDescriptor propertyDescriptor =
@@ -421,7 +437,7 @@
         if (m == null)
         {
             throw new PropertyNotFoundException(
-                "Bean: " + base.getClass().getName() + ", property: " + name);
+                getMessage(base, name));
         }
 
         // Check if the concrete class of this method is accessible and if not
@@ -430,7 +446,7 @@
         if (m == null)
         {
             throw new PropertyNotFoundException(
-                "Bean: " + base.getClass().getName() + ", property: " + name + " (not accessible!)");
+                getMessage(base, name) + " (not accessible!)");
         }
 
         try
@@ -439,8 +455,7 @@
         }
         catch (Throwable t)
         {
-            throw new EvaluationException("Bean: "
-                + base.getClass().getName() + ", property: " + name, t);
+            throw new EvaluationException(getMessage(base, name), t);
         }
     }
 
@@ -457,8 +472,7 @@
         }
         catch (IntrospectionException e)
         {
-            throw new PropertyNotFoundException("Bean: "
-                + base.getClass().getName() + ", property: " + name, e);
+            throw new PropertyNotFoundException(getMessage(base, name), e);
         }
 
         return propertyDescriptor;
@@ -485,4 +499,4 @@
             + ", property: " + propertyName);
     }
 
-}
+}
\ No newline at end of file



Mime
View raw message