Re: HELP: checkPackageAccess

Roland Schemers (Roland.Schemers@Eng)
Sat, 2 May 1998 01:02:16 -0800 (PDT)

From: Roland.Schemers@Eng (Roland Schemers)
Message-Id: <199805020802.BAA06258@crypto.eng.sun.com>
Subject: Re: HELP: checkPackageAccess
To: Li.Gong@Eng (Li Gong)
Date: Sat, 2 May 1998 01:02:16 -0800 (PDT)
In-Reply-To: <199805020539.WAA13283@games.eng.sun.com> from "Li Gong" at May 1, 98 10:39:57 pm

I think he is trying to ask if you reference the public class and it
in turn references the private class, does checkPackageAccess get
called once or twice. The answer is once because classes loaded
by the system class loader do not invoke checkPackageAccess.

At least that is how I read it :-) I could be wrong...

roland

>
> I am not sure what you are driving at. RMI uses checkPackageAccess(),
> but classloader does not, or at least from my quick look over the code.
>
> Back one-level up, what does it matter if it is checked once or twice?
> What is the problem you are encountering?
>
> Li
> --
>
> Ke-Qiang Liao writes:
> > Hi,
> >
> > I have a detailed question concerning the method
> > checkPackageAccess of SecurityManager.
> >
> > Say we have two packages pv (private) and pb (public),
> > and we implement the security manager in such a way that
> > an applet can not access the private package pv but
> > it can access the public package pb, subject to some
> > other security restrictions. My question is:
> >
> > If an applet uses (subclass, invoke a method, implement
> > an interface, etc.) a class in pb and that class in pb
> > uses in its turn another class in pv, is the method
> > checkPackageAccess() called twice (for both pv and pb
> > accesses) or just once (for pb access only)?
> >
> > Basically, the question is about the interactions
> > between an applet class loader (implemented by us) and
> > the system class loader.
> >
> > According to the HTML documentation of JDK1.1.4, the method
> > checkPackageAccess(String pkg)
> >
> > Throws a SecurityException if the calling thread is not
> > allowed to access the package specified by the argument.
> >
> > That means the method is called twice in the above-mentioned
> > case. I have tried several cases, however the results do not
> > lead to a clear conclusion.
> >
> > Could you help me? Many thanks in advance.
> >
> > Christian Liao
> > Nortel, Canada
> >
>