commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject svn commit: r471138 - in /jakarta/commons/proper/beanutils/trunk/src: java/org/apache/commons/beanutils/PropertyUtilsBean.java test/org/apache/commons/beanutils/DynaPropertyUtilsTestCase.java test/org/apache/commons/beanutils/PropertyUtilsTestCase.java
Date Sat, 04 Nov 2006 08:06:04 GMT
Author: bayard
Date: Sat Nov  4 00:06:03 2006
New Revision: 471138

URL: http://svn.apache.org/viewvc?view=rev&rev=471138
Log:
Applying improved messages for unknown properties in setSimpleProperty and getSimpleProperty
to resolve issue #BEANUTILS-30

Modified:
    jakarta/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/PropertyUtilsBean.java
    jakarta/commons/proper/beanutils/trunk/src/test/org/apache/commons/beanutils/DynaPropertyUtilsTestCase.java
    jakarta/commons/proper/beanutils/trunk/src/test/org/apache/commons/beanutils/PropertyUtilsTestCase.java

Modified: jakarta/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/PropertyUtilsBean.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/PropertyUtilsBean.java?view=diff&rev=471138&r1=471137&r2=471138
==============================================================================
--- jakarta/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/PropertyUtilsBean.java
(original)
+++ jakarta/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/PropertyUtilsBean.java
Sat Nov  4 00:06:03 2006
@@ -1249,7 +1249,8 @@
                     ((DynaBean) bean).getDynaClass().getDynaProperty(name);
             if (descriptor == null) {
                 throw new NoSuchMethodException("Unknown property '" +
-                        name + "'");
+                        name + "' on dynaclass '" + 
+                        ((DynaBean) bean).getDynaClass() + "'" );
             }
             return (((DynaBean) bean).get(name));
         }
@@ -1259,12 +1260,12 @@
                 getPropertyDescriptor(bean, name);
         if (descriptor == null) {
             throw new NoSuchMethodException("Unknown property '" +
-                    name + "'");
+                    name + "' on class '" + bean.getClass() + "'" );
         }
         Method readMethod = getReadMethod(descriptor);
         if (readMethod == null) {
             throw new NoSuchMethodException("Property '" + name +
-                    "' has no getter method");
+                    "' has no getter method in class '" + bean.getClass() + "'");
         }
 
         // Call the property getter and return the value
@@ -1946,7 +1947,8 @@
                     ((DynaBean) bean).getDynaClass().getDynaProperty(name);
             if (descriptor == null) {
                 throw new NoSuchMethodException("Unknown property '" +
-                        name + "'");
+                        name + "' on dynaclass '" + 
+                        ((DynaBean) bean).getDynaClass() + "'" );
             }
             ((DynaBean) bean).set(name, value);
             return;
@@ -1957,12 +1959,12 @@
                 getPropertyDescriptor(bean, name);
         if (descriptor == null) {
             throw new NoSuchMethodException("Unknown property '" +
-                    name + "'");
+                    name + "' on class '" + bean.getClass() + "'" );
         }
         Method writeMethod = getWriteMethod(descriptor);
         if (writeMethod == null) {
             throw new NoSuchMethodException("Property '" + name +
-                    "' has no setter method");
+                    "' has no setter method in class '" + bean.getClass() + "'");
         }
 
         // Call the property setter method

Modified: jakarta/commons/proper/beanutils/trunk/src/test/org/apache/commons/beanutils/DynaPropertyUtilsTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/beanutils/trunk/src/test/org/apache/commons/beanutils/DynaPropertyUtilsTestCase.java?view=diff&rev=471138&r1=471137&r2=471138
==============================================================================
--- jakarta/commons/proper/beanutils/trunk/src/test/org/apache/commons/beanutils/DynaPropertyUtilsTestCase.java
(original)
+++ jakarta/commons/proper/beanutils/trunk/src/test/org/apache/commons/beanutils/DynaPropertyUtilsTestCase.java
Sat Nov  4 00:06:03 2006
@@ -1442,6 +1442,8 @@
             fail("InvocationTargetException");
         } catch (NoSuchMethodException e) {
             // Correct result for this test
+            assertEquals("Unknown property 'unknown' on dynaclass '" +
+                         ((DynaBean) bean).getDynaClass() + "'", e.getMessage() );
         }
 
     }
@@ -2592,6 +2594,8 @@
             fail("InvocationTargetException");
         } catch (NoSuchMethodException e) {
             // Correct result for this test
+            assertEquals("Unknown property 'unknown' on dynaclass '" +
+                         ((DynaBean) bean).getDynaClass() + "'", e.getMessage() );
         }
 
     }

Modified: jakarta/commons/proper/beanutils/trunk/src/test/org/apache/commons/beanutils/PropertyUtilsTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/beanutils/trunk/src/test/org/apache/commons/beanutils/PropertyUtilsTestCase.java?view=diff&rev=471138&r1=471137&r2=471138
==============================================================================
--- jakarta/commons/proper/beanutils/trunk/src/test/org/apache/commons/beanutils/PropertyUtilsTestCase.java
(original)
+++ jakarta/commons/proper/beanutils/trunk/src/test/org/apache/commons/beanutils/PropertyUtilsTestCase.java
Sat Nov  4 00:06:03 2006
@@ -2012,6 +2012,8 @@
             fail("InvocationTargetException");
         } catch (NoSuchMethodException e) {
             // Correct result for this test
+            assertEquals("Unknown property 'unknown' on class '" + 
+                         bean.getClass() + "'", e.getMessage() );
         }
 
     }
@@ -2033,6 +2035,8 @@
             fail("InvocationTargetException");
         } catch (NoSuchMethodException e) {
             // Correct result for this test
+            assertEquals("Property 'writeOnlyProperty' has no getter method in class '" +

+                         bean.getClass() + "'", e.getMessage() );
         }
 
     }
@@ -3239,6 +3243,8 @@
             fail("InvocationTargetException");
         } catch (NoSuchMethodException e) {
             // Correct result for this test
+            assertEquals("Property 'readOnlyProperty' has no setter method in class '" +

+                         bean.getClass() + "'", e.getMessage() );
         }
 
     }
@@ -3318,6 +3324,8 @@
             fail("InvocationTargetException");
         } catch (NoSuchMethodException e) {
             // Correct result for this test
+            assertEquals("Unknown property 'unknown' on class '" + 
+                         bean.getClass() + "'", e.getMessage() );
         }
 
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message