test/lib/security/java.policy/Ext_AllPolicy.java

Print this page

        

@@ -33,9 +33,14 @@
         public static void main (String[] args) {
                 FilePermission mine = new FilePermission("/tmp/bar", "read");
                 SecurityManager sm = System.getSecurityManager();
 
                 if (sm != null) {
+                    try {
                         sm.checkPermission(mine);
+                        throw new RuntimeException(mine + " expected to deny access");
+                    } catch (AccessControlException e) {
+                        // Default has no privilege.
+                    }
                 }
         }
 }