< prev index next >

test/tools/jlink/plugins/FileCopierPluginTest.java

Print this page

        

@@ -39,10 +39,11 @@
 import java.util.Map;
 import jdk.tools.jlink.internal.ResourcePoolManager;
 import jdk.tools.jlink.builder.DefaultImageBuilder;
 
 import jdk.tools.jlink.internal.plugins.FileCopierPlugin;
+import jdk.tools.jlink.plugin.PluginException;
 import jdk.tools.jlink.plugin.ResourcePoolEntry;
 import jdk.tools.jlink.plugin.ResourcePool;
 
 public class FileCopierPluginTest {
 

@@ -101,11 +102,22 @@
                 throw new AssertionError("Null stream for file " + f.path());
             }
         });
         Path root = new File(".").toPath();
         DefaultImageBuilder imgbuilder = new DefaultImageBuilder(root);
+        try {
         imgbuilder.storeFiles(pool);
+        } catch (PluginException e) {
+            // We didn't add any .class resources of java.base module!
+            // This cannot happen in non-testing scenario as java.base module
+            // is minimum mandatory module in a .jimage. jlink depends on java.base
+            // to generate 'release' file. If the current exception came from that
+            // part of the code, then it is okay.
+            if (!e.getMessage().contains("No module-info for java.base module")) {
+                throw e;
+            }
+        }
 
         if (lic.exists()) {
             File license = new File(root.toFile(), "LICENSE");
             if (!license.exists() || license.length() == 0) {
                 throw new AssertionError("Invalide license file "
< prev index next >