camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bvah...@apache.org
Subject svn commit: r1294909 - in /camel/trunk/camel-core/src: main/java/org/apache/camel/component/bean/BeanInfo.java test/java/org/apache/camel/component/bean/BeanInfoTest.java
Date Wed, 29 Feb 2012 00:08:02 GMT
Author: bvahdat
Date: Wed Feb 29 00:08:02 2012
New Revision: 1294909

URL: http://svn.apache.org/viewvc?rev=1294909&view=rev
Log:
CAMEL-5051: Avoid NPE while collecting the parameter annotations of a given bean whose class
is java.lang.Object. This also fixes the existing behaviour which used to skip the java.lang.Object.toString()
method.

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanInfoTest.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java?rev=1294909&r1=1294908&r2=1294909&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/bean/BeanInfo.java Wed
Feb 29 00:08:02 2012
@@ -392,10 +392,9 @@ public class BeanInfo {
         for (Class<?> i : c.getInterfaces()) {
             collectParameterAnnotations(i, m, a);
         }
-        if (!c.isInterface() && c.getSuperclass() != Object.class) {
+        if (!c.isInterface() && c.getSuperclass() != null) {
             collectParameterAnnotations(c.getSuperclass(), m, a);
         }
-
     }
 
     /**

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanInfoTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanInfoTest.java?rev=1294909&r1=1294908&r2=1294909&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanInfoTest.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/component/bean/BeanInfoTest.java
Wed Feb 29 00:08:02 2012
@@ -37,6 +37,14 @@ public class BeanInfoTest extends TestCa
 
     protected CamelContext camelContext = new DefaultCamelContext();
 
+    public void testObjectOperations() throws Exception {
+        BeanInfo info = createBeanInfo(Object.class);
+
+        List<MethodInfo> operations = info.getMethods();
+        assertEquals(1, operations.size());
+        assertEquals("toString", operations.get(0).getMethod().getName());
+    }
+
     public void testGetOperations() throws Exception {
         BeanInfo info = createBeanInfo(Foo.class);
 



Mime
View raw message