You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by de...@apache.org on 2018/05/08 12:49:09 UTC

[myfaces] 09/14: MYFACES-1386 + added getMessage to 12_branch

This is an automated email from the ASF dual-hosted git repository.

deki pushed a commit to branch 1_1_4
in repository https://gitbox.apache.org/repos/asf/myfaces.git

commit e3998975654f6dc0176e19209920f8146bd1faa6
Author: Matthias Wessendorf <ma...@apache.org>
AuthorDate: Thu Aug 17 05:08:43 2006 +0000

    MYFACES-1386 + added getMessage to 12_branch
---
 .../apache/myfaces/el/PropertyResolverImpl.java    | 36 +++++++++++++++-------
 1 file changed, 25 insertions(+), 11 deletions(-)

diff --git a/impl/src/main/java/org/apache/myfaces/el/PropertyResolverImpl.java b/impl/src/main/java/org/apache/myfaces/el/PropertyResolverImpl.java
index 527790f..e813136 100755
--- a/impl/src/main/java/org/apache/myfaces/el/PropertyResolverImpl.java
+++ b/impl/src/main/java/org/apache/myfaces/el/PropertyResolverImpl.java
@@ -389,7 +389,7 @@ public class PropertyResolverImpl extends PropertyResolver
         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 @@ public class PropertyResolverImpl extends PropertyResolver
         if (m == null)
         {
             throw new PropertyNotFoundException(
-                "Bean: " + base.getClass().getName() + ", property: " + name + " (not accessible!)");
+                getMessage(base, name) + " (not accessible!)");
         }
 
         try
@@ -407,11 +407,27 @@ public class PropertyResolverImpl extends PropertyResolver
         }
         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 @@ public class PropertyResolverImpl extends PropertyResolver
         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 @@ public class PropertyResolverImpl extends PropertyResolver
         if (m == null)
         {
             throw new PropertyNotFoundException(
-                "Bean: " + base.getClass().getName() + ", property: " + name + " (not accessible!)");
+                getMessage(base, name) + " (not accessible!)");
         }
 
         try
@@ -439,8 +455,7 @@ public class PropertyResolverImpl extends PropertyResolver
         }
         catch (Throwable t)
         {
-            throw new EvaluationException("Bean: "
-                + base.getClass().getName() + ", property: " + name, t);
+            throw new EvaluationException(getMessage(base, name), t);
         }
     }
 
@@ -457,8 +472,7 @@ public class PropertyResolverImpl extends PropertyResolver
         }
         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 @@ public class PropertyResolverImpl extends PropertyResolver
             + ", property: " + propertyName);
     }
 
-}
+}
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
deki@apache.org.