Message-Id: <199904091849.LAA15903@laguna.eng.sun.com>
Date: Fri, 9 Apr 1999 11:49:49 -0700 (PDT)
From: Jan Luehe <luehe@laguna.eng.sun.com>
Subject: Re: Custom Policy class
To: java-security@java.sun.com, Gilles.Roussel@univ-mlv.fr
Gilles:
What you are seeing has already been filed as a bug (4202504).
The problem is that in java.security.Policy, we determine the
value of the "policy.provider" property and then use Class.forName()
to define the corresponding class and create an instance of it:
policy =3D (Policy)Class.forName(policy_class).newInstance();
This means that the policy class must be on the bootstrap classpath
(i.e., included in your rt.jar) for this to work.
If the custom policy class can not be found, the system falls back
to using the default "sun.security.provider.PolicyFile".
The fix would be to search the system class loader first, so
that your custom policy class could also exist in an extension
package or on the CLASSPATH. (The fix will go into JDK 1.3.)
As a workaround, you can include your custom policy class in your
bootstrap classpath (i.e, in the rt.jar of your Java runtime).
Jan
> Date: Thu, 08 Apr 1999 15:44:22 +0200
> From: Gilles Roussel <Gilles.Roussel@univ-mlv.fr>
> X-Accept-Language: French, fr, en
> MIME-Version: 1.0
> To: java-security@java.sun.com
> Subject: Custom Policy class
> Content-Transfer-Encoding: quoted-printable
> X-MIME-Autoconverted: from 8bit to quoted-printable by engmail1.Eng.Sun.C=
OM id=20
GAA19010
>=20
> I'm trying to change the default Policy class.
> I've changer the policy.provider property to
> policy.provider=3DPolicyExtension in lib/security/java.security
>=20
> But the following code
>=20
> import java.security.*;
>=20
> public class PolicyTest {
> public static void main(String[] args) throws Exception{
> System.out.println(Policy.getPolicy());
> }
> }
>=20
> still produces
>=20
> sun.security.provider.PolicyFile@e694e1f0
>=20
> What should I do to change this behaviour
>=20
> Thanks
>=20
> --
> Gilles Roussel
> Batiment Copernic - Universit=E9 de Marne-la-Vall=E9e - Cit=E9 Descartes
> 5, boulevard Descartes - Champs sur Marne - 77454 Marne-la-Vall=E9e Cedex=
2 -=20
FRANCE
>=20
>=20
>=20