need to focus on java performance?
Per Bothner
per@bothner.com
Mon May 22 16:38:00 GMT 2006
David Daney wrote:
> I imagine that most of the stack traces are needed for security checks,
> and not exceptions.
Excuse me for asking probably a dumb question, since my knowledge of
Java security is pretty thin:
Why do we need to walk the stack for security checks, in the normal
case of code not using deprecated methods?
It seems to me we need a per-thread local (which of course aren't
free either) for the current AccessControlContext.
class SecurityManager {
public void checkXxx ()
{
checkXxx(AccessController.getContext());
}
public void checkXxx (Object context)
{
if (! (context instanceof AccessControlContext))
// throw new SecurityException("Missing context");
checkXxx((AccessControlContext) context);
}
private void checkXxx (AccessControlContext context)
{
context.checkPermission(new-or-static-xxxPermission);
}
public void checkPermission (Object context)
{
if (! (context instanceof AccessControlContext))
// throw new SecurityException("Missing context");
((AccessControlContext) context).checkPermission();
}
public void checkPermission (Object context)
{
AccessController.getContext().checkPermission();
}
}
--
--Per Bothner
per@bothner.com http://per.bothner.com/
More information about the Java
mailing list