changeset 14819:b8d6539ab73b

Fix for 8135170, JLink: IllegalArgumentException thrown if modules with the same packages are encountered on the plugin module path
author jfdenise
date Wed, 23 Dec 2015 09:13:08 +0100
parents cb9d90339d43
children 135353aa285a
files src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java
diffstat 1 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java	Wed Dec 23 09:13:07 2015 +0100
+++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java	Wed Dec 23 09:13:08 2015 +0100
@@ -699,14 +699,18 @@
         }
 
         Configuration bootConfiguration = Layer.boot().configuration();
+        try {
+            Configuration cf
+                    = Configuration.resolve(ModuleFinder.empty(), bootConfiguration, finder);
 
-        Configuration cf
-                = Configuration.resolve(ModuleFinder.empty(), bootConfiguration, finder);
+            cf = cf.bind();
 
-        cf = cf.bind();
-
-        ClassLoader scl = ClassLoader.getSystemClassLoader();
-        return Layer.createWithOneLoader(cf, Layer.boot(), scl);
+            ClassLoader scl = ClassLoader.getSystemClassLoader();
+            return Layer.createWithOneLoader(cf, Layer.boot(), scl);
+        } catch (Exception ex) {
+            // Malformed plugin modules (e.g.: same package in multiple modules).
+            throw new PluginException("Invalid modules in the plugins path: " + ex);
+        }
     }
 
     // Display all plugins or pre processors only.