< prev index next >

jdk/test/java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted.java

Print this page




 104             //rmid.addOptions(new String[] {"-C-Djava.rmi.server.logCalls=true"});
 105 
 106             // Ensure that activation groups run with the correct
 107             // security manager.
 108             //
 109             Properties p = new Properties();
 110             p.put("java.security.policy",
 111                   TestParams.defaultGroupPolicy);
 112             p.put("java.security.manager",
 113                   "java.lang.SecurityManager");
 114 
 115             // This action causes the following classes to be created
 116             // in this VM (RMI must permit the creation of these classes):
 117             //
 118             // sun.rmi.server.Activation$ActivationSystemImpl_Stub
 119             // sun.rmi.server.Activation$ActivationMonitorImpl_Stub
 120             //
 121             System.err.println("Create activation group, in a new VM");
 122             CommandEnvironment cmd = new ActivationGroupDesc.CommandEnvironment(null,
 123                     new String[] {
 124                         "-XaddExports:java.base/sun.security.provider=ALL-UNNAMED",
 125                         "-XaddExports:java.rmi/sun.rmi.registry=ALL-UNNAMED",
 126                         "-XaddExports:java.rmi/sun.rmi.server=ALL-UNNAMED",
 127                         "-XaddExports:java.rmi/sun.rmi.transport=ALL-UNNAMED",
 128                         "-XaddExports:java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED" });
 129 
 130             ActivationGroupDesc groupDesc =
 131                 new ActivationGroupDesc(p, cmd);
 132             ActivationSystem system = ActivationGroup.getSystem();
 133             ActivationGroupID groupID = system.registerGroup(groupDesc);
 134 
 135             System.err.println("register activatable");
 136             // Fix for: 4271615: make sure activation group runs in a new VM
 137             ActivationDesc desc = new ActivationDesc
 138                 (groupID, "StubClassesPermitted", null, null);
 139             canCreateStubs = (CanCreateStubs) Activatable.register(desc);
 140 
 141             // ensure registry stub can be passed in a remote call
 142             System.err.println("getting the registry");
 143             registry = canCreateStubs.getRegistry();
 144 
 145             // make sure a client cant load just any sun.* class, just
 146             // as a sanity check, try to create a class we are not
 147             // allowed to access but which was passed in a remote call
 148             try {




 104             //rmid.addOptions(new String[] {"-C-Djava.rmi.server.logCalls=true"});
 105 
 106             // Ensure that activation groups run with the correct
 107             // security manager.
 108             //
 109             Properties p = new Properties();
 110             p.put("java.security.policy",
 111                   TestParams.defaultGroupPolicy);
 112             p.put("java.security.manager",
 113                   "java.lang.SecurityManager");
 114 
 115             // This action causes the following classes to be created
 116             // in this VM (RMI must permit the creation of these classes):
 117             //
 118             // sun.rmi.server.Activation$ActivationSystemImpl_Stub
 119             // sun.rmi.server.Activation$ActivationMonitorImpl_Stub
 120             //
 121             System.err.println("Create activation group, in a new VM");
 122             CommandEnvironment cmd = new ActivationGroupDesc.CommandEnvironment(null,
 123                     new String[] {
 124                         "--add-exports=java.base/sun.security.provider=ALL-UNNAMED",
 125                         "--add-exports=java.rmi/sun.rmi.registry=ALL-UNNAMED",
 126                         "--add-exports=java.rmi/sun.rmi.server=ALL-UNNAMED",
 127                         "--add-exports=java.rmi/sun.rmi.transport=ALL-UNNAMED",
 128                         "--add-exports=java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED" });
 129 
 130             ActivationGroupDesc groupDesc =
 131                 new ActivationGroupDesc(p, cmd);
 132             ActivationSystem system = ActivationGroup.getSystem();
 133             ActivationGroupID groupID = system.registerGroup(groupDesc);
 134 
 135             System.err.println("register activatable");
 136             // Fix for: 4271615: make sure activation group runs in a new VM
 137             ActivationDesc desc = new ActivationDesc
 138                 (groupID, "StubClassesPermitted", null, null);
 139             canCreateStubs = (CanCreateStubs) Activatable.register(desc);
 140 
 141             // ensure registry stub can be passed in a remote call
 142             System.err.println("getting the registry");
 143             registry = canCreateStubs.getRegistry();
 144 
 145             // make sure a client cant load just any sun.* class, just
 146             // as a sanity check, try to create a class we are not
 147             // allowed to access but which was passed in a remote call
 148             try {


< prev index next >