You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Donatello Santoro (JIRA)" <ji...@apache.org> on 2008/05/30 15:24:00 UTC

[jira] Created: (CAMEL-564) Exchange.isFailed() doesn't work in camel 1.3

Exchange.isFailed() doesn't work in camel 1.3
---------------------------------------------

                 Key: CAMEL-564
                 URL: https://issues.apache.org/activemq/browse/CAMEL-564
             Project: Apache Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 1.3.0
            Reporter: Donatello Santoro
         Attachments: TestException.java

Writing

this.from (address )
.tryBlock ()                
.process (new ProcessorFail() )                
.to (xxxx )            
.handle (Exception.class )                
.process (new ProcessorAssertFail() )

If the ProcessorFail raises an exception, comes recalled correctly the ProcessorAssertFail, but if in his method process I write
"Exchange failed? " + exchange.isFailed ()
the result is FALSE. It's a bug? Using camel 1.2 with the same code the result is true

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CAMEL-564) Exchange.isFailed() doesn't work in camel 1.3

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-564?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-564.
-------------------------------

    Resolution: Won't Fix

Its not a bug.

Added unit test to verify correct behavior in Camel: TryProcessorHandleTest.

Danatello, thanks for the report. See the TryProcessorHandleTest how you can still get the original thrown exception and do your own "failed" computation.

> Exchange.isFailed() doesn't work in camel 1.3
> ---------------------------------------------
>
>                 Key: CAMEL-564
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-564
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 1.3.0
>            Reporter: Donatello Santoro
>            Assignee: Claus Ibsen
>         Attachments: TestException.java
>
>
> Writing
> this.from (address )
> .tryBlock ()                
> .process (new ProcessorFail() )                
> .to (xxxx )            
> .handle (Exception.class )                
> .process (new ProcessorAssertFail() )
> If the ProcessorFail raises an exception, comes recalled correctly the ProcessorAssertFail, but if in his method process I write
> "Exchange failed? " + exchange.isFailed ()
> the result is FALSE. It's a bug? Using camel 1.2 with the same code the result is true

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-564) Exchange.isFailed() doesn't work in camel 1.3

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-564?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43207#action_43207 ] 

Claus Ibsen commented on CAMEL-564:
-----------------------------------

Hi Donatello

After digging into it a bit I see that Camel on purpose removes the traces of exception for an exchange when you use the tryBlock().
See TryProcessor.java - method handleException

It's like giving a 2nd chance ;)

I do see a very valid reason for this as you with they tryBlock(). .. handle() takes care of this any divert the route in the handle() block. The exchange has not failed yet, as it could be a valid use-case.

Lets say you use an business API to update an inventory, and in the try block the business API thrown a NoSuchInventoryException that you handle and do a a createInventory action instead.

Pseudo-code:
tryBlock()
  // update inventory
handle(NoSuchInventoryException)
  // create the inventory
end

So I do not think its a bug, but a feature.

However there is still a trace left of the original thrown exception:

On the exchange.in.header there is this propery still
caught.exception=java.lang.IllegalStateException: Force to fail

> Exchange.isFailed() doesn't work in camel 1.3
> ---------------------------------------------
>
>                 Key: CAMEL-564
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-564
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 1.3.0
>            Reporter: Donatello Santoro
>            Assignee: Claus Ibsen
>         Attachments: TestException.java
>
>
> Writing
> this.from (address )
> .tryBlock ()                
> .process (new ProcessorFail() )                
> .to (xxxx )            
> .handle (Exception.class )                
> .process (new ProcessorAssertFail() )
> If the ProcessorFail raises an exception, comes recalled correctly the ProcessorAssertFail, but if in his method process I write
> "Exchange failed? " + exchange.isFailed ()
> the result is FALSE. It's a bug? Using camel 1.2 with the same code the result is true

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (CAMEL-564) Exchange.isFailed() doesn't work in camel 1.3

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-564?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen reassigned CAMEL-564:
---------------------------------

    Assignee: Claus Ibsen

> Exchange.isFailed() doesn't work in camel 1.3
> ---------------------------------------------
>
>                 Key: CAMEL-564
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-564
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 1.3.0
>            Reporter: Donatello Santoro
>            Assignee: Claus Ibsen
>         Attachments: TestException.java
>
>
> Writing
> this.from (address )
> .tryBlock ()                
> .process (new ProcessorFail() )                
> .to (xxxx )            
> .handle (Exception.class )                
> .process (new ProcessorAssertFail() )
> If the ProcessorFail raises an exception, comes recalled correctly the ProcessorAssertFail, but if in his method process I write
> "Exchange failed? " + exchange.isFailed ()
> the result is FALSE. It's a bug? Using camel 1.2 with the same code the result is true

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CAMEL-564) Exchange.isFailed() doesn't work in camel 1.3

Posted by "Hadrian Zbarcea (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-564?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hadrian Zbarcea updated CAMEL-564:
----------------------------------

    Fix Version/s: 1.4.0

> Exchange.isFailed() doesn't work in camel 1.3
> ---------------------------------------------
>
>                 Key: CAMEL-564
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-564
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 1.3.0
>            Reporter: Donatello Santoro
>            Assignee: Claus Ibsen
>             Fix For: 1.4.0
>
>         Attachments: TestException.java
>
>
> Writing
> this.from (address )
> .tryBlock ()                
> .process (new ProcessorFail() )                
> .to (xxxx )            
> .handle (Exception.class )                
> .process (new ProcessorAssertFail() )
> If the ProcessorFail raises an exception, comes recalled correctly the ProcessorAssertFail, but if in his method process I write
> "Exchange failed? " + exchange.isFailed ()
> the result is FALSE. It's a bug? Using camel 1.2 with the same code the result is true

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.