Object GuardedObject.getObject() : GuardedObject « Security « Java Tutorial






import java.security.AccessControlException;
import java.security.Guard;
import java.security.GuardedObject;
import java.util.PropertyPermission;

public class Main {
  public static void main(String[] argv) throws Exception {
    String secretObj = "secret";
    Guard guard = new PropertyPermission("java.home", "read");

    GuardedObject gobj = new GuardedObject(secretObj, guard);

    try {
      Object o = gobj.getObject();
    } catch (AccessControlException e) {
      e.printStackTrace();
    }
  }
}








36.50.GuardedObject
36.50.1.new GuardedObject(Object obj, Guard)
36.50.2.Guard guard = new PropertyPermission(java.home, read);
36.50.3.Object GuardedObject.getObject()