AuthorizationTest.java 文件源码

java
阅读 37 收藏 0 点赞 0 评论 0

项目:openjdk-jdk10 作者:
protected int doCreateRequest(MBeanServerConnection mbsc,
                              ObjectName on,
                              boolean expectedException) {
    int errorCount = 0;

    try {
        Utils.debug(Utils.DEBUG_STANDARD,
            "ClientSide::doCreateRequest: Create and register the MBean") ;

        mbsc.createMBean("Simple", on) ;

        if (expectedException) {
            System.out.println("ClientSide::doCreateRequest: " +
                "(ERROR) Create did not fail with expected SecurityException");
            errorCount++;
        } else {
            System.out.println("ClientSide::doCreateRequest: (OK) Create succeed") ;
        }
    } catch(Exception e) {
        Utils.printThrowable(e, true) ;
        if (expectedException) {
            if (e instanceof java.lang.SecurityException) {
                System.out.println("ClientSide::doCreateRequest: " +
                    "(OK) Create failed with expected SecurityException") ;
            } else {
                System.out.println("ClientSide::doCreateRequest: " +
                    "(ERROR) Create failed with " +
                    e.getClass() + " instead of expected SecurityException");
                errorCount++;
            }
        } else {
            System.out.println("ClientSide::doCreateRequest: " +
                "(ERROR) Create failed");
            errorCount++;
        }
    }
    return errorCount;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号