Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] after throwing problem

I have a workaround for now if you need it, change the order of the
parameters in logException, from:

public void logException(JoinPoint thisJoinPoint, Tracing tracing,
Throwable t) {

to

public void logException(JoinPoint thisJoinPoint, Throwable t, Tracing
tracing) {

Andy.

On 29/11/2007, Ashley Williams <ashley.williams@xxxxxx> wrote:
>
> Hi,
>
> Having converted my aspects to use the @AspectJ style, I'm now getting a
> strange error message when a compile my tracing aspect,.
> First here is the section of code:
>
>
>         @Pointcut("execution(@Tracing * *(..)) && @annotation(tracing)")
>         void annotatedMethods(Tracing tracing) {
>         }
>
>         @AfterThrowing(pointcut = "annotatedMethods(tracing)", throwing =
> "t")
>         public void logException(JoinPoint thisJoinPoint, Tracing tracing,
>                         Throwable t) {
>                 Level level = Level.toLevel(tracing.level());
>                 if (logger.isEnabledFor(level)) {
>                         logger.log(level,
> formatter.formatSignatureThrowing(thisJoinPoint),
>                                         t);
>                 }
>         }
>
> So I am matching on all methods annotated with @Tracing and logging the
> subclass of Throwable that may have been thrown.
> However when I run my test case i get the following error:
>
> java.lang.VerifyError: (class: com/db/abfo/tracing/PojoOne, method:
> calculate signature: ()V) catch_type not a subclass of Throwable
>
> This used to work when I used the aspectj after throwing language extention
> form:
>
>
>         pointcut annotatedMethods(Tracing tracing) : execution(@Tracing *
> *(..)) && @annotation(tracing);
>
>         after(Tracing tracing) throwing(Throwable t) :
> annotatedMethods(tracing) {
>                 Level level = tracing.level().getLevel();
>                 if (logger.isEnabledFor(level)) {
>                         logger.log(level,
> formatter.formatSignatureThrowing(thisJoinPoint),
>                                         t);
>                 }
>         }
>
> Any ideas?
> - Ashley
>  ---
>
>  This e-mail may contain confidential and/or privileged information. If you
> are not the intended recipient (or have received this e-mail in error)
> please notify the sender immediately and delete this e-mail. Any
> unauthorized copying, disclosure or distribution of the material in this
> e-mail is strictly forbidden.
>
>  Please refer to
> http://www.db.com/en/content/eu_disclosures.htm for
> additional EU corporate and regulatory disclosures.
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>


Back to the top