126 sm.checkPackageAccess(pkg);
127 } catch (SecurityException se) {
128 throw new RuntimeException("Unable to access exported package: "
129 + pkg, se);
130 }
131 try {
132 sm.checkPackageDefinition(pkg);
133 } catch (SecurityException se) {
134 throw new RuntimeException("Unable to access exported package: "
135 + pkg, se);
136 }
137 }
138 }
139
140 private static final Test[] tests = new Test[] {
141 // java.base module loaded by boot loader
142 new Test("java.base", "java.security", null, "jdk.internal.jrtfs",
143 "jdk.internal.loader", null, null),
144 // java.desktop module loaded by boot loader and has an openQual pkg
145 // that is exported
146 new Test("java.desktop", "java.applet", null, "sun.applet",
147 "sun.awt", null, "javax.swing.plaf.basic"),
148 // java.security.jgss module loaded by platform loader
149 new Test("java.security.jgss", "org.ietf.jgss", null,
150 "sun.security.krb5.internal.crypto", "sun.security.krb5",
151 null, null),
152 };
153
154 public static void main(String[] args) throws Exception {
155
156 // check expected list of restricted packages in java.security file
157 checkPackages(Arrays.asList(EXPECTED));
158
159 // check access to each module's packages
160 for (Test test : tests) {
161 test.test();
162 }
163
164 System.out.println("Test passed");
165 }
166
|
126 sm.checkPackageAccess(pkg);
127 } catch (SecurityException se) {
128 throw new RuntimeException("Unable to access exported package: "
129 + pkg, se);
130 }
131 try {
132 sm.checkPackageDefinition(pkg);
133 } catch (SecurityException se) {
134 throw new RuntimeException("Unable to access exported package: "
135 + pkg, se);
136 }
137 }
138 }
139
140 private static final Test[] tests = new Test[] {
141 // java.base module loaded by boot loader
142 new Test("java.base", "java.security", null, "jdk.internal.jrtfs",
143 "jdk.internal.loader", null, null),
144 // java.desktop module loaded by boot loader and has an openQual pkg
145 // that is exported
146 new Test("java.desktop", "java.applet", null, "sun.font",
147 "sun.awt", null, "javax.swing.plaf.basic"),
148 // java.security.jgss module loaded by platform loader
149 new Test("java.security.jgss", "org.ietf.jgss", null,
150 "sun.security.krb5.internal.crypto", "sun.security.krb5",
151 null, null),
152 };
153
154 public static void main(String[] args) throws Exception {
155
156 // check expected list of restricted packages in java.security file
157 checkPackages(Arrays.asList(EXPECTED));
158
159 // check access to each module's packages
160 for (Test test : tests) {
161 test.test();
162 }
163
164 System.out.println("Test passed");
165 }
166
|