--- a/jdk/test/java/rmi/server/RemoteServer/setLogPermission/SetLogPermission.java Tue Apr 01 15:14:53 2008 -0700
+++ b/jdk/test/java/rmi/server/RemoteServer/setLogPermission/SetLogPermission.java Tue Apr 01 15:41:23 2008 -0700
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2002-2003 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -25,7 +25,7 @@
* @bug 4533390
* @summary SecurityException can be obtained but is not specified.
* The RemoteServer.setLog method requires
- * java.util.log.LoggingPermission("control").
+ * java.util.log.LoggingPermission("control").
* @author Ann Wollrath
* @run main/othervm/policy=java.policy SetLogPermission
*/
@@ -40,42 +40,42 @@
public static void main(String[] args) throws Exception {
- System.err.println("\nRegression test for bug 4533390\n");
+ System.err.println("\nRegression test for bug 4533390\n");
+
+ if (System.getSecurityManager() == null) {
+ System.setSecurityManager(new SecurityManager());
+ }
+
+ CodeSource codesource = new CodeSource(null, (Certificate[]) null);
+ Permissions perms = null;
+ ProtectionDomain pd = new ProtectionDomain(codesource, perms);
+ AccessControlContext acc =
+ new AccessControlContext(new ProtectionDomain[] { pd });
- if (System.getSecurityManager() == null) {
- System.setSecurityManager(new SecurityManager());
- }
-
- CodeSource codesource = new CodeSource(null, (Certificate[]) null);
- Permissions perms = null;
- ProtectionDomain pd = new ProtectionDomain(codesource, perms);
- AccessControlContext acc =
- new AccessControlContext(new ProtectionDomain[] { pd });
-
- java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
- public Object run() {
- try {
- System.err.println(
- "Attempt to set log without permission");
- RemoteServer.setLog(new ByteArrayOutputStream());
- throw new RuntimeException(
- "TEST FAILED: set log without permission");
- } catch (SecurityException e) {
- System.err.println(
- "TEST PASSED: unable to set log without permission");
- }
- return null;
- }}, acc);
+ java.security.AccessController.doPrivileged(
+ new java.security.PrivilegedAction() {
+ public Object run() {
+ try {
+ System.err.println(
+ "Attempt to set log without permission");
+ RemoteServer.setLog(new ByteArrayOutputStream());
+ throw new RuntimeException(
+ "TEST FAILED: set log without permission");
+ } catch (SecurityException e) {
+ System.err.println(
+ "TEST PASSED: unable to set log without permission");
+ }
+ return null;
+ }}, acc);
- try {
- System.err.println("Attempt to set log with permission");
- RemoteServer.setLog(new ByteArrayOutputStream());
- System.err.println(
- "TEST PASSED: sufficient permission to set log");
- } catch (SecurityException e) {
- System.err.println("TEST FAILED: unable to set log");
- throw e;
- }
+ try {
+ System.err.println("Attempt to set log with permission");
+ RemoteServer.setLog(new ByteArrayOutputStream());
+ System.err.println(
+ "TEST PASSED: sufficient permission to set log");
+ } catch (SecurityException e) {
+ System.err.println("TEST FAILED: unable to set log");
+ throw e;
+ }
}
}