[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aspectj-users] VerifyError: bug or newbie error?
|
Hi,
I'm an aspect newbie. I am using the latest (today's:
1.3.0.20050824175147 ) aspectj plugin for eclipse 3.1.
Have I tripped on a bug, or can someone straighten me out?
Thanks.
John
The following aspect causes this exception when the annotated method is
called:
Exception in thread "main" java.lang.VerifyError: (class:
all/mymoney/model/unittest/AccountSimple, method: testAddAccount
signature: ()V) catch_type not a subclass of Throwable
The annotated method is a test method invoked from within the JUnit
framework.
Below is the source code of the aspect. It is half baked- the part that
works is commented. The difference: In the uncommented version, I am
trying to obtain access to the transaction type field in the
javax.ejb.TransactionAttribute annotation.
/**
*
*/
package org.jfraney.aspects;
import javax.ejb.TransactionAttribute;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
@Aspect
public class TransactionManager {
@Pointcut("(execution(@javax.ejb.TransactionAttribute * *.*(..)) &&
this(attr))")
void transactedMethod(javax.ejb.TransactionAttribute attr) {}
@Before("transactedMethod(attr) ")
public void beforeTransaction(TransactionAttribute attr) {
System.out.println("before transaction");
}
@AfterReturning("transactedMethod(attr)")
public void afterTransaction(TransactionAttribute attr) {
System.out.println("after transaction");
}
@AfterThrowing(pointcut="transactedMethod(attr)",
throwing="RuntimeException")
public void failedTransaction(TransactionAttribute attr) {
System.out.println("failed transaction");
}
/*
@Pointcut("(execution(@javax.ejb.TransactionAttribute * *.*(..)))")
void transactedMethod() {}
@Before("transactedMethod() ")
public void beforeTransaction() {
System.out.println("before transaction");
}
@AfterReturning("transactedMethod()")
public void afterTransaction() {
System.out.println("after transaction");
}
@AfterThrowing(pointcut="transactedMethod()",
throwing="RuntimeException")
public void failedTransaction() {
System.out.println("failed transaction");
}
*/
}