Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] AspectJ and JAAS problem

I have a problem with AspectJ I don't quite understand...

I have my AOP-code in two different packages.
One abstract aspect one place, and a concrete aspect together with the code
I want to weave it into.

In the abstract aspect I have defined an around advice that handles
authorization with a doAsPrivileged-block.  In the concrete aspect I have
the pointcut.

The problem I have is that code in the cflow of the doAsPrivileged-block
start to misbehave.  There are several
getClass().getResource("/path/to/picture.jpg") that suddenly returns null
instead of the picture.  If I move the around advice to the concrete aspect,
everything works.

I don't quite know if this is some kind of classloader error, or if I need
to change the JAAS permissions (include some kind of filePermission
perhaps?)  The error-message I get is a nullpointer exception when the
picture is used in a constructor, and not an AccessControllerException as I
might have expected.

If I move the folder with the pictures inside the folder-structure where my
abstract aspect lies, the error goes away.  But it pops up somewhere else
instead, in code that is identical (getClass().getResource("...") except it
hasn't been weaved with the around-advice, so it's not inside a
doAsPrivileged-block.  This suggests to me that it has something to do with
the classloader. (?)
But if I don't move the pictures, but instead include a
java.security.AllPermission in the JAAS policy-file, everything works
perfectly.  This suggests I need to find the right permission, but if that's
the case - why doesn't I get an AccessControllerException in the first
place?

I hope I have explained enough here.  Any suggestions to what I'm doing
wrong is greatly appreciated.

Apologies if my english is below par..

Regards,

Hågen
haagen@xxxxxxxxxxxx



Back to the top