Java Code Examples for java.security.Permission#equals()

The following examples show how to use java.security.Permission#equals() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EqualsImplies.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[]args) throws Exception {

      Permission p1 = new A("foo");
      Permission p2 = new B("foo");

      if (p1.implies(p2) || p2.implies(p1) || p1.equals(p2)) {
          throw new Exception("Test failed");
      }

      // make sure permissions imply and equal themselves
      if (! (p1.implies(p1) && p1.equals(p1))) {
          throw new Exception("Test failed");
      }

    }
 
Example 2
Source File: DcmdMBeanPermissionsTest.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public final void denyPermission(final Permission perm) {
    Iterator<Permission> it = grantedPermissions.iterator();
    while (it.hasNext()) {
        Permission p = it.next();
        if (p.equals(perm)) {
            it.remove();
        }
    }
}
 
Example 3
Source File: EqualsImplies.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[]args) throws Exception {

      Permission p1 = new A("foo");
      Permission p2 = new B("foo");

      if (p1.implies(p2) || p2.implies(p1) || p1.equals(p2)) {
          throw new Exception("Test failed");
      }

      // make sure permissions imply and equal themselves
      if (! (p1.implies(p1) && p1.equals(p1))) {
          throw new Exception("Test failed");
      }

    }
 
Example 4
Source File: DcmdMBeanPermissionsTest.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public final void denyPermission(final Permission perm) {
    Iterator<Permission> it = grantedPermissions.iterator();
    while (it.hasNext()) {
        Permission p = it.next();
        if (p.equals(perm)) {
            it.remove();
        }
    }
}
 
Example 5
Source File: EqualsImplies.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[]args) throws Exception {

      Permission p1 = new A("foo");
      Permission p2 = new B("foo");

      if (p1.implies(p2) || p2.implies(p1) || p1.equals(p2)) {
          throw new Exception("Test failed");
      }

      // make sure permissions imply and equal themselves
      if (! (p1.implies(p1) && p1.equals(p1))) {
          throw new Exception("Test failed");
      }

    }
 
Example 6
Source File: DcmdMBeanPermissionsTest.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public final void denyPermission(final Permission perm) {
    Iterator<Permission> it = grantedPermissions.iterator();
    while (it.hasNext()) {
        Permission p = it.next();
        if (p.equals(perm)) {
            it.remove();
        }
    }
}
 
Example 7
Source File: EqualsImplies.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[]args) throws Exception {

      Permission p1 = new A("foo");
      Permission p2 = new B("foo");

      if (p1.implies(p2) || p2.implies(p1) || p1.equals(p2)) {
          throw new Exception("Test failed");
      }

      // make sure permissions imply and equal themselves
      if (! (p1.implies(p1) && p1.equals(p1))) {
          throw new Exception("Test failed");
      }

    }
 
Example 8
Source File: ProviderBinderTest.java    From everrest with Eclipse Public License 2.0 5 votes vote down vote up
private void setupSecurityManager() {
    defaultSecurityManager = System.getSecurityManager();
    final RuntimePermission providersManagePermission = new RuntimePermission("providersManagePermission");
    SecurityManager securityManager = new SecurityManager() {
        @Override
        public void checkPermission(Permission perm) {
            if (perm.equals(providersManagePermission)) {
                throw new SecurityException();
            }
        }
    };
    System.setSecurityManager(securityManager);
}
 
Example 9
Source File: DcmdMBeanPermissionsTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public final void denyPermission(final Permission perm) {
    Iterator<Permission> it = grantedPermissions.iterator();
    while (it.hasNext()) {
        Permission p = it.next();
        if (p.equals(perm)) {
            it.remove();
        }
    }
}
 
Example 10
Source File: DcmdMBeanPermissionsTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public final void denyPermission(final Permission perm) {
    Iterator<Permission> it = grantedPermissions.iterator();
    while (it.hasNext()) {
        Permission p = it.next();
        if (p.equals(perm)) {
            it.remove();
        }
    }
}
 
Example 11
Source File: EqualsImplies.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[]args) throws Exception {

      Permission p1 = new A("foo");
      Permission p2 = new B("foo");

      if (p1.implies(p2) || p2.implies(p1) || p1.equals(p2)) {
          throw new Exception("Test failed");
      }

      // make sure permissions imply and equal themselves
      if (! (p1.implies(p1) && p1.equals(p1))) {
          throw new Exception("Test failed");
      }

    }
 
Example 12
Source File: DcmdMBeanPermissionsTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public final void denyPermission(final Permission perm) {
    Iterator<Permission> it = grantedPermissions.iterator();
    while (it.hasNext()) {
        Permission p = it.next();
        if (p.equals(perm)) {
            it.remove();
        }
    }
}
 
Example 13
Source File: EqualsImplies.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[]args) throws Exception {

      Permission p1 = new A("foo");
      Permission p2 = new B("foo");

      if (p1.implies(p2) || p2.implies(p1) || p1.equals(p2)) {
          throw new Exception("Test failed");
      }

      // make sure permissions imply and equal themselves
      if (! (p1.implies(p1) && p1.equals(p1))) {
          throw new Exception("Test failed");
      }

    }
 
Example 14
Source File: DcmdMBeanPermissionsTest.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public final void denyPermission(final Permission perm) {
    Iterator<Permission> it = grantedPermissions.iterator();
    while (it.hasNext()) {
        Permission p = it.next();
        if (p.equals(perm)) {
            it.remove();
        }
    }
}
 
Example 15
Source File: EqualsImplies.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[]args) throws Exception {

      Permission p1 = new A("foo");
      Permission p2 = new B("foo");

      if (p1.implies(p2) || p2.implies(p1) || p1.equals(p2)) {
          throw new Exception("Test failed");
      }

      // make sure permissions imply and equal themselves
      if (! (p1.implies(p1) && p1.equals(p1))) {
          throw new Exception("Test failed");
      }

    }
 
Example 16
Source File: DcmdMBeanPermissionsTest.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public final void denyPermission(final Permission perm) {
    Iterator<Permission> it = grantedPermissions.iterator();
    while (it.hasNext()) {
        Permission p = it.next();
        if (p.equals(perm)) {
            it.remove();
        }
    }
}
 
Example 17
Source File: EqualsImplies.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[]args) throws Exception {

      Permission p1 = new A("foo");
      Permission p2 = new B("foo");

      if (p1.implies(p2) || p2.implies(p1) || p1.equals(p2)) {
          throw new Exception("Test failed");
      }

      // make sure permissions imply and equal themselves
      if (! (p1.implies(p1) && p1.equals(p1))) {
          throw new Exception("Test failed");
      }

    }
 
Example 18
Source File: DcmdMBeanPermissionsTest.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public final void denyPermission(final Permission perm) {
    Iterator<Permission> it = grantedPermissions.iterator();
    while (it.hasNext()) {
        Permission p = it.next();
        if (p.equals(perm)) {
            it.remove();
        }
    }
}
 
Example 19
Source File: EqualsImplies.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[]args) throws Exception {

      Permission p1 = new A("foo");
      Permission p2 = new B("foo");

      if (p1.implies(p2) || p2.implies(p1) || p1.equals(p2)) {
          throw new Exception("Test failed");
      }

      // make sure permissions imply and equal themselves
      if (! (p1.implies(p1) && p1.equals(p1))) {
          throw new Exception("Test failed");
      }

    }
 
Example 20
Source File: EqualsImplies.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[]args) throws Exception {

      Permission p1 = new A("foo");
      Permission p2 = new B("foo");

      if (p1.implies(p2) || p2.implies(p1) || p1.equals(p2)) {
          throw new Exception("Test failed");
      }

      // make sure permissions imply and equal themselves
      if (! (p1.implies(p1) && p1.equals(p1))) {
          throw new Exception("Test failed");
      }

    }