Camel
  1. Camel
  2. CAMEL-5051

NullPointerException when assigning a simple Object as final bean

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: 2.9.0
    • Fix Version/s: 2.8.5, 2.9.1, 2.10.0
    • Component/s: camel-core
    • Labels:
      None
    • Environment:

      JSE6, Windows7

    • Estimated Complexity:
      Novice

      Description

      Considering this route :

      from("direct://myendpoint").routeId("myendpoint.route").bean(new Object());

      I get a NPE. I know, this is a very rare case that noone will reach again...
      Anyway the fix is very simple, and is attached with it's test case.

      1. stacktrace.txt
        6 kB
        Fabrice Daugan
      2. MyRouteBuilder.java
        0.3 kB
        Fabrice Daugan
      3. CAMEL-5051.patch
        0.6 kB
        Fabrice Daugan

        Activity

        Hide
        Fabrice Daugan added a comment -

        Relevant trace :

         
        Caused by: java.lang.NullPointerException
        	at org.apache.camel.component.bean.BeanInfo.collectParameterAnnotations(BeanInfo.java:386)
        	at org.apache.camel.component.bean.BeanInfo.collectParameterAnnotations(BeanInfo.java:397)
        	at org.apache.camel.component.bean.BeanInfo.collectParameterAnnotations(BeanInfo.java:380)
        	at org.apache.camel.component.bean.BeanInfo.createMethodInfo(BeanInfo.java:323)
        
        Show
        Fabrice Daugan added a comment - Relevant trace : Caused by: java.lang.NullPointerException at org.apache.camel.component.bean.BeanInfo.collectParameterAnnotations(BeanInfo.java:386) at org.apache.camel.component.bean.BeanInfo.collectParameterAnnotations(BeanInfo.java:397) at org.apache.camel.component.bean.BeanInfo.collectParameterAnnotations(BeanInfo.java:380) at org.apache.camel.component.bean.BeanInfo.createMethodInfo(BeanInfo.java:323)
        Hide
        Babak Vahdat added a comment - - edited

        Thanks for reporting, I did however change the patch your provided a bit as the intention is not to skip the java.lang.Object.toString() method. See the static block initializing the EXCLUDED_METHODS field.

        Also added a tiny unit-test to verify the behaviour.

        Show
        Babak Vahdat added a comment - - edited Thanks for reporting, I did however change the patch your provided a bit as the intention is not to skip the java.lang.Object.toString() method. See the static block initializing the EXCLUDED_METHODS field. Also added a tiny unit-test to verify the behaviour.

          People

          • Assignee:
            Babak Vahdat
            Reporter:
            Fabrice Daugan
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development