Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 149513 Details for
Bug 292239
Method in pointcut not advised by after throwing()
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Amalgam of files to test aspectj advice.
AdviceFailure.txt (text/plain), 2.15 KB, created by
Steve Powell
on 2009-10-14 07:16:00 EDT
(
hide
)
Description:
Amalgam of files to test aspectj advice.
Filename:
MIME Type:
Creator:
Steve Powell
Created:
2009-10-14 07:16:00 EDT
Size:
2.15 KB
patch
obsolete
>=======================================================MXBeanExceptionCatcher.aj==================================================== >package mypackage; > >import org.slf4j.LoggerFactory; > >import javax.management.MXBean; > >/** > * An aspect that catches all {@link Exception}s thrown through @{@link MXBean} annotated interfaces. > */ >public aspect MXBeanExceptionCatcher { > > /** > * All implementations of @{@link MXBean} annotated interface methods: > */ > pointcut exposedViaJmx(Object o) : this(o) && execution(* (@MXBean *).*(..)); > > /** > * Catch {@link Exception}s and remove references to a cause they might have embedded. > * {@link Throwable}s are trapped, so we can advise methods that do not declare a throws, but {@link Exception}s are filtered out. > */ > after(Object o) throwing(Exception e) : exposedViaJmx(o) { > LoggerFactory.getLogger(o.getClass()).error("Exception issued by JMX invocation", e); > } >} >=======================================================JmxExceptionCatcherTestInterface.java========================================= >package mypackage; > >import javax.management.MXBean; > >/** > * This is an annotated @{@link MXBean} interface for testing the {@link MXBeanExceptionCatcher} aspect. > */ >@MXBean >public interface JmxExceptionCatcherTestInterface { > > public void caughtMethod() throws Exception; > > public void anotherCaughtMethod(); > >} >=======================================================MXBeanImplementationTest.java================================================ >package mypackage; > >/** > * Implement the MXBean interface for the Catcher test. > */ >public class MXBeanImplementationTest implements JmxExceptionCatcherTestInterface { > > // unCaughtMethod is not advised -- it is not in the pointcut > public void unCaughtMethod() throws Exception { throw new RuntimeException("unCaughtMethod"); } > > // caughtMethod is advised -- correctly > public void caughtMethod() throws Exception { throw new RuntimeException("caughtMethod"); } > > // anotherCaughtMethod is NOT advised -- <<< ERROR <<< this should be advised > public void anotherCaughtMethod() { throw new RuntimeException("anotherCaughtMethod"); } > >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 292239
: 149513