Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] @AfterThrowing problem

Try using an annotation style aspect rather than code style - mixing
styles isn't really recommended.

@Aspect
public class SomeAspcet {

I did recreate your error (at least the string literal one) and when I
switched to all annotations by making this change, it went away. (of
course, I still had an error about logData being unbound in the
pointcut).

Also, it is worth noting that at least one of the errors "String
literal is not properly closed by a double-quote" is only appearing in
the editor, and not in the problems view. This means it is a
reconciling problem in AJDT and not a 'real bug' with your code (the
problems view is always correct).  I've raised
https://bugs.eclipse.org/bugs/show_bug.cgi?id=384422 to track the
reconciling issue.

Andy

On 5 July 2012 12:38, Sina <my.linked.account@xxxxxxxxxxxxxx> wrote:
> I'd already tried it with pointcut.
> When I inster the pointcut I get this error:
> -String literal is not properly closed by a double-quote
> -The annotation AfterThrowing is disallowed for this location.
>
> and here is the completed code.
>
> public aspect SomeAspcet {
> @AfterThrowing(pointcut="execution(* *(..))",throwing = "e")
>     public void bizLoggerWithException(BizLoggable logData, JoinPoint
>     thisJoinPoint,Throwable e) {
> ;// do some stuff
>     }
> }
>
>  am I missing something or it's a bug, if it is, is there any workaround?
>
> Sina
>
> On Jul 5, 2012, at 10:36 PM, Andy Clement wrote:
>
> Hi
>
> Is the problem just that you haven't specified a pointcut in that
> @AfterThrowing?
>
> It is a pretty hideous error message so I raised
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=384401 to cover
> addressing it.
>
> I made your code compile just by changing the @AfterThrowing to
> include a pointcut:
>
> @AfterThrowing(pointcut="execution(* *(..))",throwing = "e")
>
> cheers
> Andy
>
> On 4 July 2012 22:50, Sina <my.linked.account@xxxxxxxxxxxxxx> wrote:
>
> Hi there,
>
>
> I'm trying to use the @AfterThrowing in order to define my pointcut like
>
> this:
>
> @AfterThrowing(throwing = "e")
>
>    public void bizLoggerWithException(BizLoggable logData, JoinPoint
>
>    thisJoinPoint,Throwable e) {
>
>    .....// do some stuff
>
>    }
>
>
>
>
> But I get the following error from Eclipse (oepe 12.1.1.0.0):
>
>
> java.lang.NullPointerException
>
> at
>
> org.aspectj.weaver.patterns.BasicTokenSource.makeTokenSource(BasicTokenSource.java:84)
>
> at org.aspectj.weaver.patterns.PatternParser.<init>(PatternParser.java:1884)
>
> at
>
> org.aspectj.ajdt.internal.compiler.ast.ValidateAtAspectJAnnotationsVisitor.resolveAndSetPointcut(ValidateAtAspectJAnnotationsVisitor.java:388)
>
> at
>
> org.aspectj.ajdt.internal.compiler.ast.ValidateAtAspectJAnnotationsVisitor.validateAdvice(Validate
>
> ... AutoBuildJob.run(AutoBuildJob.java:241)
>
> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
>
>
> Compile error: NullPointerException thrown: null
>
>
>
> Previously I got another error like this: insert the quotation mark after
>
> 'e'   or something like that, tough that my syntax was correct.
>
> Does anyone know how to conquer this bug?
>
>
> I can define this pointcut and the regarding advice without @AfterThrowing
>
> annotation, but I', trying to stick with the annotations ....
>
>
> Cheers,
>
> Sina
>
>
>
> _______________________________________________
>
> aspectj-users mailing list
>
> aspectj-users@xxxxxxxxxxx
>
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>


Back to the top