Announcement Announcement Module
Collapse
No announcement yet.
ThrowsAdvice can only soften to runtime exception? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • ThrowsAdvice can only soften to runtime exception?

    I'm getting:

    java.lang.reflect.UndeclaredThrowableException
    at $Proxy0.fileOperation(Unknown Source)

    Just to remove a remote possibility that I'm not misinterpreting an error in my code; my understanding is that in a ThrowsAdvice's afterThrowing method, one can only change the exception to a RunTimeException class or subclass. Correct?

  • #2
    Ofc, otherwise you have a checked exception which had to be declared catched at compilation time.

    Comment


    • #3
      Yes, you can't use Spring AOP to change method signatures.

      Comment


      • #4
        Originally posted by Rod Johnson
        Yes, you can't use Spring AOP to change method signatures.
        Thanks, as I found out the hard way a while back, you can't do "dynamic casts" in Java.

        Comment

        Working...
        X