DELTASPIKE-297  created.

Thanks !
________________________________
De : Jason Porter <[email protected]>
À : "[email protected]" <[email protected]> 
Cc : "[email protected]" 
<[email protected]> 
Envoyé le : Lundi 10 décembre 2012 16h57
Objet : Re: Multiple exceptionHandler classes

Yes, create a JIRA please and add any links there. 

Sent from my iPhone

On Dec 10, 2012, at 8:31, Adrian Gonzalez <[email protected]> wrote:

> Ok I found it, there's an error in ExceptionHandlerComparator [1], it doesn't 
> handle qualifiers correctly.
> Should I open a JIRA ?
> 
> 
> Lines 57-60 :
> 
>             if (returnValue == 0 && !lhs.getQualifiers().isEmpty())
>             {
>                 return -1;
>             }
> 
> Instead it should : 
>  * remove Any qualifier from rhs and lhs
>  * compare remaining qualifier size between rhs and lhs.
> 
> I've made a quick and ugly correction (not really performant) in my branch 
> [2].
> See [3].
> 
> [1] 
> https://github.com/gonzalad/incubator-deltaspike/blob/8a8878faf2c12e69ba742dff1fb803b6f7d713b2/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exception/control/ExceptionHandlerComparator.java
> [2] 
> https://github.com/gonzalad/incubator-deltaspike/tree/exception-multiple-handler
> [3] 
> https://github.com/gonzalad/incubator-deltaspike/commit/473eafe621c4401837b7e62411eb9833786544dc#deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exception/control/ExceptionHandlerComparator.java
> 
> ________________________________
> De : Adrian Gonzalez <[email protected]>
> À : "[email protected]" 
> <[email protected]> 
> Envoyé le : Lundi 10 décembre 2012 12h48
> Objet : Re: Multiple exceptionHandler classes
> 
> Hi,
> 
> I just added a testcase [1] .
> 
> Testcase fails once every twice.
> 
> I'll look a bit more at DS code.
> If someone has an idea in the meantime ;)
> 
> Regards,
> 
> [1] 
> https://github.com/gonzalad/incubator-deltaspike/blob/exception-multiple-handler/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/exception/control/event/MultipleExceptionHandlerTest.java
> 
> 
> ________________________________
> De : Jason Porter <[email protected]>
> À : Adrian Gonzalez <[email protected]> 
> Cc : "[email protected]" 
> <[email protected]> 
> Envoyé le : Jeudi 6 décembre 2012 18h56
> Objet : Re: Multiple exceptionHandler classes
> 
> If it's being called always from that code it should always hit the one
> with the qualifier first, if not, then we have a bug. Take a look at the
> tests and see if something is missing either in the suite or something
> different with the way you're doing things. I know this worked perfectly in
> Seam 3, and the code is nearly a direct port.
> 
> 
> On Thu, Dec 6, 2012 at 10:35 AM, Adrian Gonzalez <[email protected]>wrote:
> 
>> Thanks jason,
>> 
>>> Do you have some code with how you're calling into the exception
>> handling?
>> 
>> 
>> Yep, the code is in [1]
>> 
>> 
>> I'll try to test it more thoroughly on my side on Monday (week end time
>> for me now ;) )
>> 
>> [1]
>> https://github.com/gonzalad/incubator-deltaspike/blob/ds-rest/deltaspike/modules/rest/impl/src/main/java/org/apache/deltaspike/rest/impl/exceptions/ExceptionMapper.java
>> 
>> ________________________________
>> De : Jason Porter <[email protected]>
>> À : "[email protected]" <
>> [email protected]>; Adrian Gonzalez <
>> [email protected]>
>> Envoyé le : Jeudi 6 décembre 2012 18h25
>> Objet : Re: Multiple exceptionHandler classes
>> 
>> 
>> On Thu, Dec 6, 2012 at 10:11 AM, Adrian Gonzalez <[email protected]>
>> wrote:
>> 
>> Hello,
>>> 
>>> Is it permitted to have multiple ExceptionHandlers classes in the same
>> application ?
>>> 
>>> If yes, I have the impression that qualifiers aren't taken into account
>> when it comes to which exceptionHandler method to call first.
>>> I have the impression that EHA#handleException is called even if the
>> ExceptionToCatchEvent was fired with @RestRequest qualifier.
>> 
>> Yes, this works fine, and is tested quite thoroughly in the test suite.
>> 
>> 
>> Which ExceptionHandler class is called first depends on every application
>> restart.
>> 
>>> @org.apache.deltaspike.core.api.exception.control.annotation.ExceptionHandler
>>> public class EHA {
>>> public void handleException(
>>> 
>>> @Handles ExceptionEvent<RuntimeException> event) {
>>> ...
>>> event.handled();
>>> }
>>> }
>> 
>>> @org.apache.deltaspike.core.api.exception.control.annotation.ExceptionHandler
>>> public class EHB {
>>> public void handleException(
>>> 
>>> @Handles @RestRequest ExceptionEvent<RuntimeException> event) {
>>> ...
>>> 
>>> event.handled();
>>> }
>>> }
>>> 
>>> Thanks
>> Do you have some code with how you're calling into the exception handling?
>> 
>> 
>> --
>> Jason Porter
>> http://lightguard-jp.blogspot.com
>> http://twitter.com/lightguardjp
>> 
>> Software Engineer
>> Open Source Advocate
>> 
>> PGP key id: 926CCFF5
>> PGP key available at: keyserver.net, pgp.mit.edu
> 
> 
> 
> -- 
> Jason Porter
> http://lightguard-jp.blogspot.com
> http://twitter.com/lightguardjp
> 
> Software Engineer
> Open Source Advocate
> 
> PGP key id: 926CCFF5
> PGP key available at: keyserver.net, pgp.mit.edu

Reply via email to