harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r454183 - in /incubator/harmony/enhanced/classlib/trunk/modules/beans/src: main/java/java/beans/PropertyDescriptor.java test/java/org/apache/harmony/beans/tests/java/beans/PropertyDescriptorTest.java
Date Sun, 08 Oct 2006 17:48:51 GMT
Author: ndbeyer
Date: Sun Oct  8 10:48:50 2006
New Revision: 454183

URL: http://svn.apache.org/viewvc?view=rev&rev=454183
Log:
Apply patch for HARMONY-1763: [classlib][beans] method java.beans.PropertyDescriptor.equals(Object)
throws ClassCastException

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyDescriptor.java
    incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyDescriptorTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyDescriptor.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyDescriptor.java?view=diff&rev=454183&r1=454182&r2=454183
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyDescriptor.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/PropertyDescriptor.java
Sun Oct  8 10:48:50 2006
@@ -180,7 +180,7 @@
 
     @Override
     public boolean equals(Object object) {
-        boolean result = (object != null);
+        boolean result = (object != null && object instanceof PropertyDescriptor);
         if (result) {
             PropertyDescriptor pd = (PropertyDescriptor) object;
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyDescriptorTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyDescriptorTest.java?view=diff&rev=454183&r1=454182&r2=454183
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyDescriptorTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/PropertyDescriptorTest.java
Sun Oct  8 10:48:50 2006
@@ -53,6 +53,19 @@
         assertFalse(pd.equals(null));
     }
 
+    // Regression test for H-1763
+    public void testEqualsRegression1763() throws IntrospectionException {
+        String propertyName = "PropertyOne";
+        Class beanClass = MockJavaBean.class;
+        PropertyDescriptor pd = new PropertyDescriptor(propertyName, beanClass);
+
+        try {
+            pd.equals(propertyName);
+        } catch (ClassCastException e) {
+            fail("Equals throws ClassCastException");
+        }
+    }
+
     public void testEquals_ReadMethod() throws IntrospectionException,
             SecurityException, NoSuchMethodException {
         String propertyName = "PropertyOne";



Mime
View raw message