Code example for PropertyPermission

Methods: newPermissionCollection

0
        System.out.println("Passed. OKAY");
    } 
 
    static void tryPropPC() throws Exception { 
        try { 
            PropertyPermission p0 = new PropertyPermission("user.home","read");
            PermissionCollection pc = p0.newPermissionCollection();
            pc.setReadOnly();   // this should lock out future adds
            // 
            PropertyPermission p1 = new PropertyPermission("java.home","read");
            pc.add(p1);
            throw new 
                Exception("Failed...PropertyPermission added to readonly PropertyPermissionCollection.");
 
        } catch (SecurityException se) {
            System.out.println("PropertyPermissionCollection passed");
        } 
    } 
 
    static void trySockPC() throws Exception { 
        try {