changeset 13559:4fb8c90b5890

Missing asserts in ModuleSetAccessibleTest Wrong module name in IllegalArgumentException thrown by ModuleClassLoader
author alanb
date Fri, 31 Jul 2015 18:50:51 +0100
parents 332b68a8d63d
children c95e84b8b1a0 b45b092e3abd
files src/java.base/share/classes/java/lang/ModuleClassLoader.java test/jdk/jigsaw/reflect/ModuleSetAccessibleTest.java
diffstat 2 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/java/lang/ModuleClassLoader.java	Fri Jul 31 17:49:55 2015 +0100
+++ b/src/java.base/share/classes/java/lang/ModuleClassLoader.java	Fri Jul 31 18:50:51 2015 +0100
@@ -44,7 +44,13 @@
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
 import java.security.SecureClassLoader;
-import java.util.*;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 
 import jdk.internal.misc.BootLoader;
@@ -210,7 +216,7 @@
         for (String mn : other) {
             omref = cf.findModule(mn);
             if (!omref.isPresent())
-                throw new IllegalArgumentException(first + " not in Configuration");
+                throw new IllegalArgumentException(mn + " not in Configuration");
             modules.add(omref.get());
         }
 
--- a/test/jdk/jigsaw/reflect/ModuleSetAccessibleTest.java	Fri Jul 31 17:49:55 2015 +0100
+++ b/test/jdk/jigsaw/reflect/ModuleSetAccessibleTest.java	Fri Jul 31 18:50:51 2015 +0100
@@ -51,6 +51,7 @@
 
         try {
             ctor.newInstance();
+            assertTrue(false);
         } catch (IllegalAccessException expected) { }
 
         ctor.setAccessible(true);
@@ -64,6 +65,7 @@
         Method m = Unsafe.class.getDeclaredMethod("throwIllegalAccessError");
         try {
             m.invoke(null);
+            assertTrue(false);
         } catch (IllegalAccessException expected) { }
 
         m.setAccessible(true);
@@ -101,6 +103,7 @@
 
         try {
             ctor.newInstance("cn=duke");
+            assertTrue(false);
         } catch (IllegalAccessException expected) { }
 
         try {