1

I would like to invoke my SecurityManager checkPackageAccess for a named package.

Here is my code:

System.setProperty("java.security.policy", "file:/C:/Temp/java.policy");

System.setSecurityManager(new MySecurityManager() {
        @Override
        public void checkPackageAccess(String pkg) {
            super.checkPackageAccess(pkg);
            // do my specific stuff
        }

});

and my policy file

package.restrict.access.pkgname=true
package.access=com.mypackage

However the checkPackageAccess method is getting called on every method invocation. Any idea how to restrict it so it just gets called when methods in side com.mypackage are invoked?

Thanks in advance

orion_kid
  • 405
  • 1
  • 7
  • 20

0 Answers0