< prev index next >

test/hotspot/jtreg/runtime/Nestmates/privateMethods/TestInvokeErrors.java

Print this page
rev 59275 : [mq]: v1

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -72,12 +72,16 @@
             try {
                 MissingNestHost m = new MissingNestHost();
                 m.priv_invoke();
                 throw new Error("Unexpected success invoking MissingNestHost.priv_invoke");
             }
-            catch (NoClassDefFoundError ncdfe) {
-                System.out.println("Got expected exception:" + ncdfe);
+            catch (IllegalAccessError iae) {
+                if (iae.getMessage().contains("java.lang.NoClassDefFoundError: NoSuchClass")) {
+                    System.out.println("Got expected exception:" + iae);
+                } else {
+                    throw new Error("Unexpected exception", iae);
+                }
             }
         }
     }
 
     public static void main(String[] args) throws Throwable {

@@ -103,13 +107,13 @@
 
         // Verification of Helper will trigger the nestmate access check failure
         try {
             Helper.doTest();
         }
-        catch (NoClassDefFoundError ncdfe) {
+        catch (IllegalAccessError iae) {
             if (verifying)
-                System.out.println("Got expected exception:" + ncdfe);
+                System.out.println("Got expected exception:" + iae);
             else
-                throw new Error("Unexpected error loading Helper class with verification disabled");
+                throw new Error("Unexpected error loading Helper class with verification disabled", iae);
         }
     }
 }
< prev index next >