[jboss-remoting-commits] JBoss Remoting SVN: r3686 - in remoting2/branches/2.x/src/tests/org/jboss/test: security and 1 other directory.

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Thu Mar 20 16:43:43 EDT 2008


Author: david.lloyd at jboss.com
Date: 2008-03-20 16:43:43 -0400 (Thu, 20 Mar 2008)
New Revision: 3686

Added:
   remoting2/branches/2.x/src/tests/org/jboss/test/security/
   remoting2/branches/2.x/src/tests/org/jboss/test/security/LoggingSecurityManager.java
Log:
Add a logging security manager - for testing the tests :)

Added: remoting2/branches/2.x/src/tests/org/jboss/test/security/LoggingSecurityManager.java
===================================================================
--- remoting2/branches/2.x/src/tests/org/jboss/test/security/LoggingSecurityManager.java	                        (rev 0)
+++ remoting2/branches/2.x/src/tests/org/jboss/test/security/LoggingSecurityManager.java	2008-03-20 20:43:43 UTC (rev 3686)
@@ -0,0 +1,269 @@
+package org.jboss.test.security;
+
+import java.security.Permission;
+import java.io.FileDescriptor;
+import java.net.InetAddress;
+
+/**
+ *
+ */
+public final class LoggingSecurityManager extends SecurityManager {
+
+    public LoggingSecurityManager() {
+    }
+
+    private static void logAndRethrow(SecurityException ex) {
+        ex.printStackTrace(System.err);
+        throw ex;
+    }
+
+    public void checkPermission(final Permission perm) {
+        try {
+            super.checkPermission(perm);
+        } catch (SecurityException se) {
+            logAndRethrow(se);
+        }
+    }
+
+    public void checkPermission(final Permission perm, final Object context) {
+        try {
+            super.checkPermission(perm, context);
+        } catch (SecurityException se) {
+            logAndRethrow(se);
+        }
+    }
+
+    public void checkCreateClassLoader() {
+        try {
+            super.checkCreateClassLoader();
+        } catch (SecurityException se) {
+            logAndRethrow(se);
+        }
+    }
+
+    public void checkAccess(final Thread t) {
+        try {
+            super.checkAccess(t);
+        } catch (SecurityException se) {
+            logAndRethrow(se);
+        }
+    }
+
+    public void checkAccess(final ThreadGroup g) {
+        try {
+            super.checkAccess(g);
+        } catch (SecurityException se) {
+            logAndRethrow(se);
+        }
+    }
+
+    public void checkExit(final int status) {
+        try {
+            super.checkExit(status);
+        } catch (SecurityException se) {
+            logAndRethrow(se);
+        }
+    }
+
+    public void checkExec(final String cmd) {
+        try {
+            super.checkExec(cmd);
+        } catch (SecurityException se) {
+            logAndRethrow(se);
+        }
+    }
+
+    public void checkLink(final String lib) {
+        try {
+            super.checkLink(lib);
+        } catch (SecurityException se) {
+            logAndRethrow(se);
+        }
+    }
+
+    public void checkRead(final FileDescriptor fd) {
+        try {
+            super.checkRead(fd);
+        } catch (SecurityException se) {
+            logAndRethrow(se);
+        }
+    }
+
+    public void checkRead(final String file) {
+        try {
+            super.checkRead(file);
+        } catch (SecurityException se) {
+            logAndRethrow(se);
+        }
+    }
+
+    public void checkRead(final String file, final Object context) {
+        try {
+            super.checkRead(file, context);
+        } catch (SecurityException se) {
+            logAndRethrow(se);
+        }
+    }
+
+    public void checkWrite(final FileDescriptor fd) {
+        try {
+            super.checkWrite(fd);
+        } catch (SecurityException se) {
+            logAndRethrow(se);
+        }
+    }
+
+    public void checkWrite(final String file) {
+        try {
+            super.checkWrite(file);
+        } catch (SecurityException se) {
+            logAndRethrow(se);
+        }
+    }
+
+    public void checkDelete(final String file) {
+        try {
+            super.checkDelete(file);
+        } catch (SecurityException se) {
+            logAndRethrow(se);
+        }
+    }
+
+    public void checkConnect(final String host, final int port) {
+        try {
+            super.checkConnect(host, port);
+        } catch (SecurityException se) {
+            logAndRethrow(se);
+        }
+    }
+
+    public void checkConnect(final String host, final int port, final Object context) {
+        try {
+            super.checkConnect(host, port, context);
+        } catch (SecurityException se) {
+            logAndRethrow(se);
+        }
+    }
+
+    public void checkListen(final int port) {
+        try {
+            super.checkListen(port);
+        } catch (SecurityException se) {
+            logAndRethrow(se);
+        }
+    }
+
+    public void checkAccept(final String host, final int port) {
+        try {
+            super.checkAccept(host, port);
+        } catch (SecurityException se) {
+            logAndRethrow(se);
+        }
+    }
+
+    public void checkMulticast(final InetAddress maddr) {
+        try {
+            super.checkMulticast(maddr);
+        } catch (SecurityException se) {
+            logAndRethrow(se);
+        }
+    }
+
+    /** @noinspection deprecation*/
+    public void checkMulticast(final InetAddress maddr, final byte ttl) {
+        try {
+            super.checkMulticast(maddr, ttl);
+        } catch (SecurityException se) {
+            logAndRethrow(se);
+        }
+    }
+
+    public void checkPropertiesAccess() {
+        try {
+            super.checkPropertiesAccess();
+        } catch (SecurityException se) {
+            logAndRethrow(se);
+        }
+    }
+
+    public void checkPropertyAccess(final String key) {
+        try {
+            super.checkPropertyAccess(key);
+        } catch (SecurityException se) {
+            logAndRethrow(se);
+        }
+    }
+
+    public boolean checkTopLevelWindow(final Object window) {
+        try {
+            return super.checkTopLevelWindow(window);
+        } catch (SecurityException se) {
+            logAndRethrow(se);
+            return false; // not reached
+        }
+    }
+
+    public void checkPrintJobAccess() {
+        try {
+            super.checkPrintJobAccess();
+        } catch (SecurityException se) {
+            logAndRethrow(se);
+        }
+    }
+
+    public void checkSystemClipboardAccess() {
+        try {
+            super.checkSystemClipboardAccess();
+        } catch (SecurityException se) {
+            logAndRethrow(se);
+        }
+    }
+
+    public void checkAwtEventQueueAccess() {
+        try {
+            super.checkAwtEventQueueAccess();
+        } catch (SecurityException se) {
+            logAndRethrow(se);
+        }
+    }
+
+    public void checkPackageAccess(final String pkg) {
+        try {
+            super.checkPackageAccess(pkg);
+        } catch (SecurityException se) {
+            logAndRethrow(se);
+        }
+    }
+
+    public void checkPackageDefinition(final String pkg) {
+        try {
+            super.checkPackageDefinition(pkg);
+        } catch (SecurityException se) {
+            logAndRethrow(se);
+        }
+    }
+
+    public void checkSetFactory() {
+        try {
+            super.checkSetFactory();
+        } catch (SecurityException se) {
+            logAndRethrow(se);
+        }
+    }
+
+    public void checkMemberAccess(final Class clazz, final int which) {
+        try {
+            super.checkMemberAccess(clazz, which);
+        } catch (SecurityException se) {
+            logAndRethrow(se);
+        }
+    }
+
+    public void checkSecurityAccess(final String target) {
+        try {
+            super.checkSecurityAccess(target);
+        } catch (SecurityException se) {
+            logAndRethrow(se);
+        }
+    }
+}




More information about the jboss-remoting-commits mailing list