类java.security.BasicPermission源码实例Demo

下面列出了怎么用java.security.BasicPermission的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: quarkus   文件: ProtectedResource.java
@GET
@Path("/scope")
@Produces(MediaType.APPLICATION_JSON)
public Uni<List<Permission>> hasScopePermission(@QueryParam("scope") String scope) {
    return identity.checkPermission(new BasicPermission("Scope Permission Resource") {
        @Override
        public String getActions() {
            return scope;
        }
    }).onItem()
            .apply(new Function<Boolean, List<Permission>>() {
                @Override
                public List<Permission> apply(Boolean granted) {
                    if (granted) {
                        return identity.getAttribute("permissions");
                    }
                    throw new ForbiddenException();
                }
            });
}
 
源代码2 项目: dragonwell8_jdk   文件: ExitVMEquals.java
public static void main(String[] args) throws Exception {
    BasicPermission bp1 = new BP("exitVM");
    BasicPermission bp2 = new BP("exitVM.*");

    StringBuffer sb = new StringBuffer();

    // First, make sure the old restrictions on exitVM and exitVM.* still hold.
    if (!bp1.implies(bp2)) sb.append("bp1 does not implies bp2\n");
    if (!bp2.implies(bp1)) sb.append("bp2 does not implies bp1\n");

    // Test against hashCode spec
    if (bp1.hashCode() != bp1.getName().hashCode())
        sb.append("bp1 hashCode not spec consistent\n");
    if (bp2.hashCode() != bp2.getName().hashCode())
        sb.append("bp2 hashCode not spec consistent\n");

    // Test against equals spec
    if (bp1.getName().equals(bp2.getName())) {
        if (!bp1.equals(bp2)) {
            sb.append("BP breaks equals spec\n");
        }
    }
    if (!bp1.getName().equals(bp2.getName())) {
        if (bp1.equals(bp2)) {
            sb.append("BP breaks equals spec in another way\n");
        }
    }

    // Tests against common knowledge: If equals, then hashCode should be same
    if (bp1.equals(bp2)) {
        if (bp1.hashCode() != bp2.hashCode()) {
            sb.append("Equal objects have unequal hashCode?\n");
        }
    }

    if (sb.length() > 0) {
        throw new Exception(sb.toString());
    }
}
 
源代码3 项目: dragonwell8_jdk   文件: FailureDebugOption.java
public static void main (String argv[]) throws Exception {
     try {
         AccessController.checkPermission(
                     new BasicPermission("no such permission"){});
     } catch (NullPointerException npe) {
        throw new Exception("Unexpected NullPointerException for security" +
                     " debug option, -Djava.security.debug=failure");
     } catch (AccessControlException ace) {
     }
}
 
源代码4 项目: TencentKona-8   文件: ExitVMEquals.java
public static void main(String[] args) throws Exception {
    BasicPermission bp1 = new BP("exitVM");
    BasicPermission bp2 = new BP("exitVM.*");

    StringBuffer sb = new StringBuffer();

    // First, make sure the old restrictions on exitVM and exitVM.* still hold.
    if (!bp1.implies(bp2)) sb.append("bp1 does not implies bp2\n");
    if (!bp2.implies(bp1)) sb.append("bp2 does not implies bp1\n");

    // Test against hashCode spec
    if (bp1.hashCode() != bp1.getName().hashCode())
        sb.append("bp1 hashCode not spec consistent\n");
    if (bp2.hashCode() != bp2.getName().hashCode())
        sb.append("bp2 hashCode not spec consistent\n");

    // Test against equals spec
    if (bp1.getName().equals(bp2.getName())) {
        if (!bp1.equals(bp2)) {
            sb.append("BP breaks equals spec\n");
        }
    }
    if (!bp1.getName().equals(bp2.getName())) {
        if (bp1.equals(bp2)) {
            sb.append("BP breaks equals spec in another way\n");
        }
    }

    // Tests against common knowledge: If equals, then hashCode should be same
    if (bp1.equals(bp2)) {
        if (bp1.hashCode() != bp2.hashCode()) {
            sb.append("Equal objects have unequal hashCode?\n");
        }
    }

    if (sb.length() > 0) {
        throw new Exception(sb.toString());
    }
}
 
源代码5 项目: TencentKona-8   文件: FailureDebugOption.java
public static void main (String argv[]) throws Exception {
     try {
         AccessController.checkPermission(
                     new BasicPermission("no such permission"){});
     } catch (NullPointerException npe) {
        throw new Exception("Unexpected NullPointerException for security" +
                     " debug option, -Djava.security.debug=failure");
     } catch (AccessControlException ace) {
     }
}
 
源代码6 项目: jdk8u60   文件: ExitVMEquals.java
public static void main(String[] args) throws Exception {
    BasicPermission bp1 = new BP("exitVM");
    BasicPermission bp2 = new BP("exitVM.*");

    StringBuffer sb = new StringBuffer();

    // First, make sure the old restrictions on exitVM and exitVM.* still hold.
    if (!bp1.implies(bp2)) sb.append("bp1 does not implies bp2\n");
    if (!bp2.implies(bp1)) sb.append("bp2 does not implies bp1\n");

    // Test against hashCode spec
    if (bp1.hashCode() != bp1.getName().hashCode())
        sb.append("bp1 hashCode not spec consistent\n");
    if (bp2.hashCode() != bp2.getName().hashCode())
        sb.append("bp2 hashCode not spec consistent\n");

    // Test against equals spec
    if (bp1.getName().equals(bp2.getName())) {
        if (!bp1.equals(bp2)) {
            sb.append("BP breaks equals spec\n");
        }
    }
    if (!bp1.getName().equals(bp2.getName())) {
        if (bp1.equals(bp2)) {
            sb.append("BP breaks equals spec in another way\n");
        }
    }

    // Tests against common knowledge: If equals, then hashCode should be same
    if (bp1.equals(bp2)) {
        if (bp1.hashCode() != bp2.hashCode()) {
            sb.append("Equal objects have unequal hashCode?\n");
        }
    }

    if (sb.length() > 0) {
        throw new Exception(sb.toString());
    }
}
 
源代码7 项目: jdk8u60   文件: FailureDebugOption.java
public static void main (String argv[]) throws Exception {
     try {
         AccessController.checkPermission(
                     new BasicPermission("no such permission"){});
     } catch (NullPointerException npe) {
        throw new Exception("Unexpected NullPointerException for security" +
                     " debug option, -Djava.security.debug=failure");
     } catch (AccessControlException ace) {
     }
}
 
源代码8 项目: openjdk-jdk8u   文件: ExitVMEquals.java
public static void main(String[] args) throws Exception {
    BasicPermission bp1 = new BP("exitVM");
    BasicPermission bp2 = new BP("exitVM.*");

    StringBuffer sb = new StringBuffer();

    // First, make sure the old restrictions on exitVM and exitVM.* still hold.
    if (!bp1.implies(bp2)) sb.append("bp1 does not implies bp2\n");
    if (!bp2.implies(bp1)) sb.append("bp2 does not implies bp1\n");

    // Test against hashCode spec
    if (bp1.hashCode() != bp1.getName().hashCode())
        sb.append("bp1 hashCode not spec consistent\n");
    if (bp2.hashCode() != bp2.getName().hashCode())
        sb.append("bp2 hashCode not spec consistent\n");

    // Test against equals spec
    if (bp1.getName().equals(bp2.getName())) {
        if (!bp1.equals(bp2)) {
            sb.append("BP breaks equals spec\n");
        }
    }
    if (!bp1.getName().equals(bp2.getName())) {
        if (bp1.equals(bp2)) {
            sb.append("BP breaks equals spec in another way\n");
        }
    }

    // Tests against common knowledge: If equals, then hashCode should be same
    if (bp1.equals(bp2)) {
        if (bp1.hashCode() != bp2.hashCode()) {
            sb.append("Equal objects have unequal hashCode?\n");
        }
    }

    if (sb.length() > 0) {
        throw new Exception(sb.toString());
    }
}
 
源代码9 项目: openjdk-jdk8u   文件: FailureDebugOption.java
public static void main (String argv[]) throws Exception {
     try {
         AccessController.checkPermission(
                     new BasicPermission("no such permission"){});
     } catch (NullPointerException npe) {
        throw new Exception("Unexpected NullPointerException for security" +
                     " debug option, -Djava.security.debug=failure");
     } catch (AccessControlException ace) {
     }
}
 
源代码10 项目: openjdk-jdk8u-backup   文件: ExitVMEquals.java
public static void main(String[] args) throws Exception {
    BasicPermission bp1 = new BP("exitVM");
    BasicPermission bp2 = new BP("exitVM.*");

    StringBuffer sb = new StringBuffer();

    // First, make sure the old restrictions on exitVM and exitVM.* still hold.
    if (!bp1.implies(bp2)) sb.append("bp1 does not implies bp2\n");
    if (!bp2.implies(bp1)) sb.append("bp2 does not implies bp1\n");

    // Test against hashCode spec
    if (bp1.hashCode() != bp1.getName().hashCode())
        sb.append("bp1 hashCode not spec consistent\n");
    if (bp2.hashCode() != bp2.getName().hashCode())
        sb.append("bp2 hashCode not spec consistent\n");

    // Test against equals spec
    if (bp1.getName().equals(bp2.getName())) {
        if (!bp1.equals(bp2)) {
            sb.append("BP breaks equals spec\n");
        }
    }
    if (!bp1.getName().equals(bp2.getName())) {
        if (bp1.equals(bp2)) {
            sb.append("BP breaks equals spec in another way\n");
        }
    }

    // Tests against common knowledge: If equals, then hashCode should be same
    if (bp1.equals(bp2)) {
        if (bp1.hashCode() != bp2.hashCode()) {
            sb.append("Equal objects have unequal hashCode?\n");
        }
    }

    if (sb.length() > 0) {
        throw new Exception(sb.toString());
    }
}
 
源代码11 项目: openjdk-jdk8u-backup   文件: FailureDebugOption.java
public static void main (String argv[]) throws Exception {
     try {
         AccessController.checkPermission(
                     new BasicPermission("no such permission"){});
     } catch (NullPointerException npe) {
        throw new Exception("Unexpected NullPointerException for security" +
                     " debug option, -Djava.security.debug=failure");
     } catch (AccessControlException ace) {
     }
}
 
源代码12 项目: openjdk-jdk9   文件: ExitVMEquals.java
public static void main(String[] args) throws Exception {
    BasicPermission bp1 = new BP("exitVM");
    BasicPermission bp2 = new BP("exitVM.*");

    StringBuffer sb = new StringBuffer();

    // First, make sure the old restrictions on exitVM and exitVM.* still hold.
    if (!bp1.implies(bp2)) sb.append("bp1 does not implies bp2\n");
    if (!bp2.implies(bp1)) sb.append("bp2 does not implies bp1\n");

    // Test against hashCode spec
    if (bp1.hashCode() != bp1.getName().hashCode())
        sb.append("bp1 hashCode not spec consistent\n");
    if (bp2.hashCode() != bp2.getName().hashCode())
        sb.append("bp2 hashCode not spec consistent\n");

    // Test against equals spec
    if (bp1.getName().equals(bp2.getName())) {
        if (!bp1.equals(bp2)) {
            sb.append("BP breaks equals spec\n");
        }
    }
    if (!bp1.getName().equals(bp2.getName())) {
        if (bp1.equals(bp2)) {
            sb.append("BP breaks equals spec in another way\n");
        }
    }

    // Tests against common knowledge: If equals, then hashCode should be same
    if (bp1.equals(bp2)) {
        if (bp1.hashCode() != bp2.hashCode()) {
            sb.append("Equal objects have unequal hashCode?\n");
        }
    }

    if (sb.length() > 0) {
        throw new Exception(sb.toString());
    }
}
 
源代码13 项目: openjdk-jdk9   文件: FailureDebugOption.java
public static void main (String argv[]) throws Exception {
     try {
         AccessController.checkPermission(
                     new BasicPermission("no such permission"){});
     } catch (NullPointerException npe) {
        throw new Exception("Unexpected NullPointerException for security" +
                     " debug option, -Djava.security.debug=failure");
     } catch (AccessControlException ace) {
     }
}
 
源代码14 项目: jdk8u-jdk   文件: ExitVMEquals.java
public static void main(String[] args) throws Exception {
    BasicPermission bp1 = new BP("exitVM");
    BasicPermission bp2 = new BP("exitVM.*");

    StringBuffer sb = new StringBuffer();

    // First, make sure the old restrictions on exitVM and exitVM.* still hold.
    if (!bp1.implies(bp2)) sb.append("bp1 does not implies bp2\n");
    if (!bp2.implies(bp1)) sb.append("bp2 does not implies bp1\n");

    // Test against hashCode spec
    if (bp1.hashCode() != bp1.getName().hashCode())
        sb.append("bp1 hashCode not spec consistent\n");
    if (bp2.hashCode() != bp2.getName().hashCode())
        sb.append("bp2 hashCode not spec consistent\n");

    // Test against equals spec
    if (bp1.getName().equals(bp2.getName())) {
        if (!bp1.equals(bp2)) {
            sb.append("BP breaks equals spec\n");
        }
    }
    if (!bp1.getName().equals(bp2.getName())) {
        if (bp1.equals(bp2)) {
            sb.append("BP breaks equals spec in another way\n");
        }
    }

    // Tests against common knowledge: If equals, then hashCode should be same
    if (bp1.equals(bp2)) {
        if (bp1.hashCode() != bp2.hashCode()) {
            sb.append("Equal objects have unequal hashCode?\n");
        }
    }

    if (sb.length() > 0) {
        throw new Exception(sb.toString());
    }
}
 
源代码15 项目: jdk8u-jdk   文件: FailureDebugOption.java
public static void main (String argv[]) throws Exception {
     try {
         AccessController.checkPermission(
                     new BasicPermission("no such permission"){});
     } catch (NullPointerException npe) {
        throw new Exception("Unexpected NullPointerException for security" +
                     " debug option, -Djava.security.debug=failure");
     } catch (AccessControlException ace) {
     }
}
 
源代码16 项目: hottub   文件: ExitVMEquals.java
public static void main(String[] args) throws Exception {
    BasicPermission bp1 = new BP("exitVM");
    BasicPermission bp2 = new BP("exitVM.*");

    StringBuffer sb = new StringBuffer();

    // First, make sure the old restrictions on exitVM and exitVM.* still hold.
    if (!bp1.implies(bp2)) sb.append("bp1 does not implies bp2\n");
    if (!bp2.implies(bp1)) sb.append("bp2 does not implies bp1\n");

    // Test against hashCode spec
    if (bp1.hashCode() != bp1.getName().hashCode())
        sb.append("bp1 hashCode not spec consistent\n");
    if (bp2.hashCode() != bp2.getName().hashCode())
        sb.append("bp2 hashCode not spec consistent\n");

    // Test against equals spec
    if (bp1.getName().equals(bp2.getName())) {
        if (!bp1.equals(bp2)) {
            sb.append("BP breaks equals spec\n");
        }
    }
    if (!bp1.getName().equals(bp2.getName())) {
        if (bp1.equals(bp2)) {
            sb.append("BP breaks equals spec in another way\n");
        }
    }

    // Tests against common knowledge: If equals, then hashCode should be same
    if (bp1.equals(bp2)) {
        if (bp1.hashCode() != bp2.hashCode()) {
            sb.append("Equal objects have unequal hashCode?\n");
        }
    }

    if (sb.length() > 0) {
        throw new Exception(sb.toString());
    }
}
 
源代码17 项目: hottub   文件: FailureDebugOption.java
public static void main (String argv[]) throws Exception {
     try {
         AccessController.checkPermission(
                     new BasicPermission("no such permission"){});
     } catch (NullPointerException npe) {
        throw new Exception("Unexpected NullPointerException for security" +
                     " debug option, -Djava.security.debug=failure");
     } catch (AccessControlException ace) {
     }
}
 
源代码18 项目: openjdk-8-source   文件: ExitVMEquals.java
public static void main(String[] args) throws Exception {
    BasicPermission bp1 = new BP("exitVM");
    BasicPermission bp2 = new BP("exitVM.*");

    StringBuffer sb = new StringBuffer();

    // First, make sure the old restrictions on exitVM and exitVM.* still hold.
    if (!bp1.implies(bp2)) sb.append("bp1 does not implies bp2\n");
    if (!bp2.implies(bp1)) sb.append("bp2 does not implies bp1\n");

    // Test against hashCode spec
    if (bp1.hashCode() != bp1.getName().hashCode())
        sb.append("bp1 hashCode not spec consistent\n");
    if (bp2.hashCode() != bp2.getName().hashCode())
        sb.append("bp2 hashCode not spec consistent\n");

    // Test against equals spec
    if (bp1.getName().equals(bp2.getName())) {
        if (!bp1.equals(bp2)) {
            sb.append("BP breaks equals spec\n");
        }
    }
    if (!bp1.getName().equals(bp2.getName())) {
        if (bp1.equals(bp2)) {
            sb.append("BP breaks equals spec in another way\n");
        }
    }

    // Tests against common knowledge: If equals, then hashCode should be same
    if (bp1.equals(bp2)) {
        if (bp1.hashCode() != bp2.hashCode()) {
            sb.append("Equal objects have unequal hashCode?\n");
        }
    }

    if (sb.length() > 0) {
        throw new Exception(sb.toString());
    }
}
 
源代码19 项目: openjdk-8-source   文件: FailureDebugOption.java
public static void main (String argv[]) throws Exception {
     try {
         AccessController.checkPermission(
                     new BasicPermission("no such permission"){});
     } catch (NullPointerException npe) {
        throw new Exception("Unexpected NullPointerException for security" +
                     " debug option, -Djava.security.debug=failure");
     } catch (AccessControlException ace) {
     }
}
 
源代码20 项目: openjdk-8   文件: ExitVMEquals.java
public static void main(String[] args) throws Exception {
    BasicPermission bp1 = new BP("exitVM");
    BasicPermission bp2 = new BP("exitVM.*");

    StringBuffer sb = new StringBuffer();

    // First, make sure the old restrictions on exitVM and exitVM.* still hold.
    if (!bp1.implies(bp2)) sb.append("bp1 does not implies bp2\n");
    if (!bp2.implies(bp1)) sb.append("bp2 does not implies bp1\n");

    // Test against hashCode spec
    if (bp1.hashCode() != bp1.getName().hashCode())
        sb.append("bp1 hashCode not spec consistent\n");
    if (bp2.hashCode() != bp2.getName().hashCode())
        sb.append("bp2 hashCode not spec consistent\n");

    // Test against equals spec
    if (bp1.getName().equals(bp2.getName())) {
        if (!bp1.equals(bp2)) {
            sb.append("BP breaks equals spec\n");
        }
    }
    if (!bp1.getName().equals(bp2.getName())) {
        if (bp1.equals(bp2)) {
            sb.append("BP breaks equals spec in another way\n");
        }
    }

    // Tests against common knowledge: If equals, then hashCode should be same
    if (bp1.equals(bp2)) {
        if (bp1.hashCode() != bp2.hashCode()) {
            sb.append("Equal objects have unequal hashCode?\n");
        }
    }

    if (sb.length() > 0) {
        throw new Exception(sb.toString());
    }
}
 
源代码21 项目: openjdk-8   文件: FailureDebugOption.java
public static void main (String argv[]) throws Exception {
     try {
         AccessController.checkPermission(
                     new BasicPermission("no such permission"){});
     } catch (NullPointerException npe) {
        throw new Exception("Unexpected NullPointerException for security" +
                     " debug option, -Djava.security.debug=failure");
     } catch (AccessControlException ace) {
     }
}
 
源代码22 项目: jdk8u_jdk   文件: ExitVMEquals.java
public static void main(String[] args) throws Exception {
    BasicPermission bp1 = new BP("exitVM");
    BasicPermission bp2 = new BP("exitVM.*");

    StringBuffer sb = new StringBuffer();

    // First, make sure the old restrictions on exitVM and exitVM.* still hold.
    if (!bp1.implies(bp2)) sb.append("bp1 does not implies bp2\n");
    if (!bp2.implies(bp1)) sb.append("bp2 does not implies bp1\n");

    // Test against hashCode spec
    if (bp1.hashCode() != bp1.getName().hashCode())
        sb.append("bp1 hashCode not spec consistent\n");
    if (bp2.hashCode() != bp2.getName().hashCode())
        sb.append("bp2 hashCode not spec consistent\n");

    // Test against equals spec
    if (bp1.getName().equals(bp2.getName())) {
        if (!bp1.equals(bp2)) {
            sb.append("BP breaks equals spec\n");
        }
    }
    if (!bp1.getName().equals(bp2.getName())) {
        if (bp1.equals(bp2)) {
            sb.append("BP breaks equals spec in another way\n");
        }
    }

    // Tests against common knowledge: If equals, then hashCode should be same
    if (bp1.equals(bp2)) {
        if (bp1.hashCode() != bp2.hashCode()) {
            sb.append("Equal objects have unequal hashCode?\n");
        }
    }

    if (sb.length() > 0) {
        throw new Exception(sb.toString());
    }
}
 
源代码23 项目: jdk8u_jdk   文件: FailureDebugOption.java
public static void main (String argv[]) throws Exception {
     try {
         AccessController.checkPermission(
                     new BasicPermission("no such permission"){});
     } catch (NullPointerException npe) {
        throw new Exception("Unexpected NullPointerException for security" +
                     " debug option, -Djava.security.debug=failure");
     } catch (AccessControlException ace) {
     }
}
 
源代码24 项目: jdk8u-jdk   文件: ExitVMEquals.java
public static void main(String[] args) throws Exception {
    BasicPermission bp1 = new BP("exitVM");
    BasicPermission bp2 = new BP("exitVM.*");

    StringBuffer sb = new StringBuffer();

    // First, make sure the old restrictions on exitVM and exitVM.* still hold.
    if (!bp1.implies(bp2)) sb.append("bp1 does not implies bp2\n");
    if (!bp2.implies(bp1)) sb.append("bp2 does not implies bp1\n");

    // Test against hashCode spec
    if (bp1.hashCode() != bp1.getName().hashCode())
        sb.append("bp1 hashCode not spec consistent\n");
    if (bp2.hashCode() != bp2.getName().hashCode())
        sb.append("bp2 hashCode not spec consistent\n");

    // Test against equals spec
    if (bp1.getName().equals(bp2.getName())) {
        if (!bp1.equals(bp2)) {
            sb.append("BP breaks equals spec\n");
        }
    }
    if (!bp1.getName().equals(bp2.getName())) {
        if (bp1.equals(bp2)) {
            sb.append("BP breaks equals spec in another way\n");
        }
    }

    // Tests against common knowledge: If equals, then hashCode should be same
    if (bp1.equals(bp2)) {
        if (bp1.hashCode() != bp2.hashCode()) {
            sb.append("Equal objects have unequal hashCode?\n");
        }
    }

    if (sb.length() > 0) {
        throw new Exception(sb.toString());
    }
}
 
源代码25 项目: jdk8u-jdk   文件: FailureDebugOption.java
public static void main (String argv[]) throws Exception {
     try {
         AccessController.checkPermission(
                     new BasicPermission("no such permission"){});
     } catch (NullPointerException npe) {
        throw new Exception("Unexpected NullPointerException for security" +
                     " debug option, -Djava.security.debug=failure");
     } catch (AccessControlException ace) {
     }
}
 
源代码26 项目: jdk8u-dev-jdk   文件: ExitVMEquals.java
public static void main(String[] args) throws Exception {
    BasicPermission bp1 = new BP("exitVM");
    BasicPermission bp2 = new BP("exitVM.*");

    StringBuffer sb = new StringBuffer();

    // First, make sure the old restrictions on exitVM and exitVM.* still hold.
    if (!bp1.implies(bp2)) sb.append("bp1 does not implies bp2\n");
    if (!bp2.implies(bp1)) sb.append("bp2 does not implies bp1\n");

    // Test against hashCode spec
    if (bp1.hashCode() != bp1.getName().hashCode())
        sb.append("bp1 hashCode not spec consistent\n");
    if (bp2.hashCode() != bp2.getName().hashCode())
        sb.append("bp2 hashCode not spec consistent\n");

    // Test against equals spec
    if (bp1.getName().equals(bp2.getName())) {
        if (!bp1.equals(bp2)) {
            sb.append("BP breaks equals spec\n");
        }
    }
    if (!bp1.getName().equals(bp2.getName())) {
        if (bp1.equals(bp2)) {
            sb.append("BP breaks equals spec in another way\n");
        }
    }

    // Tests against common knowledge: If equals, then hashCode should be same
    if (bp1.equals(bp2)) {
        if (bp1.hashCode() != bp2.hashCode()) {
            sb.append("Equal objects have unequal hashCode?\n");
        }
    }

    if (sb.length() > 0) {
        throw new Exception(sb.toString());
    }
}
 
源代码27 项目: jdk8u-dev-jdk   文件: FailureDebugOption.java
public static void main (String argv[]) throws Exception {
     try {
         AccessController.checkPermission(
                     new BasicPermission("no such permission"){});
     } catch (NullPointerException npe) {
        throw new Exception("Unexpected NullPointerException for security" +
                     " debug option, -Djava.security.debug=failure");
     } catch (AccessControlException ace) {
     }
}
 
 类所在包
 同包方法