Announcement Announcement Module
No announcement yet.
@AfterThrowing and String Literal... Error Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • @AfterThrowing and String Literal... Error

    I have no idea why I am having this error. I am getting "String literal is not properly closed by a double-quote" on the AfterThrowing annotation(see the attached image).

    public void logAfterThrowing(JoinPoint joinPoint, NullPointerException e){
        log.error("NullPointerException in " + joinPoint.getSignature().getName() + "()");

  • #2
    You can't declare a JoinPoint object as input of a method decorated with @AfterThrowing. Only declare the exception as input.
    If you need reflection information (for tracing purposes or whatever) you should use an @Around advice, which gives you the ProceedingJoinPoint object.


    • #3
      Thanks for your reply.. I did according to the Spring Recipes 2e where the joinpoint is passed as parameter to the method annotated by afterthrowing. I guess I will stick @Around however this string literal error doesn't seem normal to me.
      Last edited by acidrous; Sep 5th, 2011, 01:21 PM.


      • #4
        After a more careful reading of the AOP chapter in the official Spring reference documentation, I agree with you. There is the possibility to pass a JoinPoint parameter as first attribute of an advice method.

        My guess is that they forgot to update the Eclipse plugin to recognize this feature which was introduced later. If you try to compile your project outside the ide, does it work? I'd give it a try...


        • #5
          Yes, it works if you compile outside the ide. Probably the plugin doesn't recognize the feature yet. Thanks again