Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Point Cut gambling

Gregor Kiczales schrieb:

A simplification would be to write:

public pointcut remoteAuthOperations(AddressBookManagerRemote iro, AddressBookDO ado):
   target(iro)
   && args(ado, *)
   && (call (public void AddressBookManagerRemote.addParty   (AddressBookDO, PartyDO)) ||
       call (public void AddressBookManagerRemote.removeParty(AddressBookDO, PartyDO)));

I am sorry, but that didn't help (The other two suggestions didn't work, either). The associated advice is:

before ( AddressBookManagerRemote abmr, AddressBookDO ado ) : remoteAuthOperations ( abmr, ado ) {
   System.out.println ( "AddressBookAuthorizationAspect runs" );
   try {
       if ( ! abmr.changeOperationAllowed ( ado ) ) {
           throw new SecurityException ();
       }
   } catch ( RemoteException re ) {
       throw new UnexpectedRemoteException ( re );
   }
}

I have written a (JUnit) test case for this. The following code is part of the test case and should result in a SecurityException:

try {
   abmr.addParty ( abdo, pdo );
   super.fail ( "security exception expected" );
} catch ( Exception e ) {
   super.checkForSecurityException ( e );
}

But it doesn't, and there is also no output to system.out. Eclipse (with the AspectJ plugin) also says the advice doesn't advice anything.

The whole source code is available at http://home.in.tum.de/~prilmeie/da/getTheCode.php (This is an on the fly CVS checkout, expect this to take some time), it's about 8MB.


Back to the top