equal
deleted
inserted
replaced
29 |
29 |
30 import java.net.URI; |
30 import java.net.URI; |
31 import java.nio.file.FileSystems; |
31 import java.nio.file.FileSystems; |
32 import java.nio.file.Path; |
32 import java.nio.file.Path; |
33 import java.nio.file.Paths; |
33 import java.nio.file.Paths; |
|
34 import java.util.Collections; |
34 |
35 |
35 public class WithSecurityManager { |
36 public class WithSecurityManager { |
36 public static void main(String[] args) throws Exception { |
37 public static void main(String[] args) throws Exception { |
37 boolean allow = args[0].equals("allow"); |
38 boolean allow = args[0].equals("allow"); |
38 |
39 |
59 throw se; |
60 throw se; |
60 } |
61 } |
61 |
62 |
62 // check FileSystems.newFileSystem |
63 // check FileSystems.newFileSystem |
63 try { |
64 try { |
64 FileSystems.newFileSystem(URI.create("jrt:/"), null); |
65 FileSystems.newFileSystem(URI.create("jrt:/"), Collections.emptyMap()); |
65 if (!allow) throw new RuntimeException("access not expected"); |
66 if (!allow) throw new RuntimeException("access not expected"); |
66 } catch (SecurityException se) { |
67 } catch (SecurityException se) { |
67 if (allow) |
68 if (allow) |
68 throw se; |
69 throw se; |
69 } |
70 } |