test/jdk/jdk/jfr/api/consumer/security/TestMissingPermission.java
branchJEP-349-branch
changeset 57726 6a7fa9735caf
parent 57717 4ce66d271065
child 58076 ca625d28c580
--- a/test/jdk/jdk/jfr/api/consumer/security/TestMissingPermission.java	Tue Aug 13 03:58:29 2019 +0200
+++ b/test/jdk/jdk/jfr/api/consumer/security/TestMissingPermission.java	Tue Aug 13 14:07:04 2019 +0200
@@ -36,6 +36,7 @@
  * @key jfr
  * @requires vm.hasJFR
  * @library /test/lib
+ *
  * @run main/othervm/secure=java.lang.SecurityManager/java.security.policy=no-permission.policy
  *      jdk.jfr.api.consumer.security.TestMissingPermission
  */
@@ -49,7 +50,7 @@
     private static void testRecordingStream() throws IOException {
         try {
             try (EventStream es = EventStream.openRepository()) {
-                fail();
+                throw new AssertionError("Should not be able to create EventStream without FlightRecorderPermission");
             }
         } catch (SecurityException se) {
             // OK, as expected
@@ -59,14 +60,10 @@
     private static void testOpenRepository() throws IOException {
         try {
             try (RecordingStream es = new RecordingStream()) {
-                fail();
+                throw new AssertionError("Should not be able to create RecordingStream without FlightRecorderPermission");
             }
         } catch (SecurityException se) {
             // OK, as expected
         }
     }
-
-    private static void fail() {
-        throw new AssertionError("Should not be able to create EventStream with FlightRecorderPermission");
-    }
 }