This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: need to focus on java performance?


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]