You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "Peter Hicks (Poggs)" <pe...@poggs.co.uk> on 2017/05/21 14:14:17 UTC

NPE in org.apache.camel.test.junit4.CamelTestSupport.logCoverageSummary

Hello

I’m unsure whether this is down to my inexperience with Camel or an actual bug, but I wanted to bring it up here regardless.

I have a Camel component which processes an Exchange and sends multiple messages in response.  It’s part of a larger piece of code which translates ‘commands’ from one system in to ‘operations’ to carry out on another system.

One of the unit tests extends CamelTestSupport and has a RouteBuilder which returns the following:

return new RouteBuilder() {
    public void configure() {
        from("direct:start").process(testBean);
        from("direct:start.processed").to("mock:result.processed");
    }
};

When running this unit test, the correct data is output but I have the following NPE:

java.lang.NullPointerException
	at org.apache.camel.test.junit4.CamelTestSupport.logCoverageSummary(CamelTestSupport.java:463)
	at org.apache.camel.test.junit4.CamelTestSupport.tearDown(CamelTestSupport.java:402)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
...

If I simply add ".to("mock:result”)” to the end of the first route, the NPE disappears.

Is this a problem in my implementation?


Peter


Re: NPE in org.apache.camel.test.junit4.CamelTestSupport.logCoverageSummary

Posted by "Peter Hicks (Poggs)" <pe...@poggs.co.uk>.
Hi Claus

> On 21 May 2017, at 17:06, Claus Ibsen <cl...@gmail.com> wrote:
> 
> No it ought to work with that little route as well.
> 
> What version of Camel do you use?

I see your later reply (sorry for my tardiness) - for clarity, I’m on 2.19.0.

Thanks very much for the quick fix!


Peter


Re: NPE in org.apache.camel.test.junit4.CamelTestSupport.logCoverageSummary

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

I reproduced the issue and logged a ticket and have a fix in the works
https://issues.apache.org/jira/browse/CAMEL-11305

On Sun, May 21, 2017 at 6:06 PM, Claus Ibsen <cl...@gmail.com> wrote:
> Hi
>
> No it ought to work with that little route as well.
>
> What version of Camel do you use?
>
> On Sun, May 21, 2017 at 4:14 PM, Peter Hicks (Poggs)
> <pe...@poggs.co.uk> wrote:
>> Hello
>>
>> I’m unsure whether this is down to my inexperience with Camel or an actual bug, but I wanted to bring it up here regardless.
>>
>> I have a Camel component which processes an Exchange and sends multiple messages in response.  It’s part of a larger piece of code which translates ‘commands’ from one system in to ‘operations’ to carry out on another system.
>>
>> One of the unit tests extends CamelTestSupport and has a RouteBuilder which returns the following:
>>
>> return new RouteBuilder() {
>>     public void configure() {
>>         from("direct:start").process(testBean);
>>         from("direct:start.processed").to("mock:result.processed");
>>     }
>> };
>>
>> When running this unit test, the correct data is output but I have the following NPE:
>>
>> java.lang.NullPointerException
>>         at org.apache.camel.test.junit4.CamelTestSupport.logCoverageSummary(CamelTestSupport.java:463)
>>         at org.apache.camel.test.junit4.CamelTestSupport.tearDown(CamelTestSupport.java:402)
>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>         at java.lang.reflect.Method.invoke(Method.java:498)
>> ...
>>
>> If I simply add ".to("mock:result”)” to the end of the first route, the NPE disappears.
>>
>> Is this a problem in my implementation?
>>
>>
>> Peter
>>
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Re: NPE in org.apache.camel.test.junit4.CamelTestSupport.logCoverageSummary

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

No it ought to work with that little route as well.

What version of Camel do you use?

On Sun, May 21, 2017 at 4:14 PM, Peter Hicks (Poggs)
<pe...@poggs.co.uk> wrote:
> Hello
>
> I’m unsure whether this is down to my inexperience with Camel or an actual bug, but I wanted to bring it up here regardless.
>
> I have a Camel component which processes an Exchange and sends multiple messages in response.  It’s part of a larger piece of code which translates ‘commands’ from one system in to ‘operations’ to carry out on another system.
>
> One of the unit tests extends CamelTestSupport and has a RouteBuilder which returns the following:
>
> return new RouteBuilder() {
>     public void configure() {
>         from("direct:start").process(testBean);
>         from("direct:start.processed").to("mock:result.processed");
>     }
> };
>
> When running this unit test, the correct data is output but I have the following NPE:
>
> java.lang.NullPointerException
>         at org.apache.camel.test.junit4.CamelTestSupport.logCoverageSummary(CamelTestSupport.java:463)
>         at org.apache.camel.test.junit4.CamelTestSupport.tearDown(CamelTestSupport.java:402)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:498)
> ...
>
> If I simply add ".to("mock:result”)” to the end of the first route, the NPE disappears.
>
> Is this a problem in my implementation?
>
>
> Peter
>



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2