You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "Siegfried.Wirth" <si...@capgemini-sdm.com> on 2009/06/22 18:50:14 UTC

Re: Bug in ScheduledPollingConsumer? (Unit-Test added)

Wrote a small unit test demonstrating the issue:

http://www.nabble.com/file/p24151188/ScheduledPollingConsumerIssueTest.java
ScheduledPollingConsumerIssueTest.java 

Hi,

when testing some ftp functionality I found the following issue which may
indicate a bug in ScheduledPollingConsumer:

1) I start a route using FtpConsumer (and thus a ScheduledPollingConsumer)
2) This route encounters an error, because the ftp server is not available
and thus an excpetion is logged.
3) Now I try to stop the route (to do some reconfigurations and later i want
to start it again) and everything fails...

I think there is the following problem in ScheduledPollingConsumer:
- When the run-Methods tries to poll and poll throws an exception, the
consumer 'remembers' this exception as firstExceptionThrown (there is a
variable named so in the polling consumer).
- When later on the route is stopped and therefore the
ScheduledPollingConsumer is stop the method doStop() is invoked. There is
the following code:

doStop() {
    [//call the real implementors to stop]
   ...
   if (firstExceptionThrown != null) {
      throw firstExceptionThrown;
   }
   ...
}

So this will throw an exception even if stopping the route works fine.
Therefore an exception is thrown in the context of stopping the route that
occured in quite normal situation - but because it is thrown there, it is
really thrown and leads to failures.

I think every method needs its own variable firstExceptionThrown, to avoid
such cross-throwing-exception.

Regards,
Siegfried Wirth
-- 
View this message in context: http://www.nabble.com/Bug-in-ScheduledPollingConsumer--tp24151070p24151188.html
Sent from the Camel - Users mailing list archive at Nabble.com.