Code example for AccessControlContext

Methods: checkPermission

0
        } 
 
        final boolean[] result = new boolean[] { false };
        Thread th = new Thread(new Runnable() {
            public void run() { 
                AccessControlContext acc = new AccessControlContext(
                        new ProtectionDomain[] { pd });
                try { 
                    acc.checkPermission(perm);
                    result[0] = true;
                } catch (SecurityException e) {
                } 
            } 
        }); 
        th.start();
        try { 
            th.join();
        } catch (InterruptedException e) {
            // ignore 
        } 
        assertTrue("Test 1: Thread should have permission", result[0]);