test/java/rmi/server/RemoteServer/setLogPermission/SetLogPermission.java

Print this page




  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /* @test
  25  * @bug 4533390
  26  * @summary SecurityException can be obtained but is not specified.
  27  * The RemoteServer.setLog method requires
  28  * java.util.log.LoggingPermission("control").
  29  * @author Ann Wollrath
  30  * @run main/othervm/policy=java.policy SetLogPermission
  31  */
  32 
  33 import java.rmi.server.RemoteServer;
  34 import java.io.ByteArrayOutputStream;
  35 import java.net.URL;
  36 import java.security.*;
  37 import java.security.cert.Certificate;
  38 
  39 public class SetLogPermission {
  40 
  41     public static void main(String[] args) throws Exception {
  42 
  43         System.err.println("\nRegression test for bug 4533390\n");
  44 
  45         if (System.getSecurityManager() == null) {
  46             System.setSecurityManager(new SecurityManager());
  47         }
  48 
  49         CodeSource codesource = new CodeSource(null, (Certificate[]) null);
  50         Permissions perms = null;




  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /* @test
  25  * @bug 4533390
  26  * @summary SecurityException can be obtained but is not specified.
  27  * The RemoteServer.setLog method requires
  28  * java.util.log.LoggingPermission("control").
  29  * @author Ann Wollrath
  30  * @run main/othervm/policy=security.policy SetLogPermission
  31  */
  32 
  33 import java.rmi.server.RemoteServer;
  34 import java.io.ByteArrayOutputStream;
  35 import java.net.URL;
  36 import java.security.*;
  37 import java.security.cert.Certificate;
  38 
  39 public class SetLogPermission {
  40 
  41     public static void main(String[] args) throws Exception {
  42 
  43         System.err.println("\nRegression test for bug 4533390\n");
  44 
  45         if (System.getSecurityManager() == null) {
  46             System.setSecurityManager(new SecurityManager());
  47         }
  48 
  49         CodeSource codesource = new CodeSource(null, (Certificate[]) null);
  50         Permissions perms = null;