Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8196547

WindowsAppImageBuilder does not allow subfolders for application resources

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      x86
    • OS:
      other

      Description

      FULL PRODUCT VERSION :
      java version "9"
      Java(TM) SE Runtime Environment (build 9+181)
      Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 10.0.16299.192]

      A DESCRIPTION OF THE PROBLEM :
      I'm the maintainer of the javafx-maven-plugin and discovered a breaking bug inside the JDK/javapackager.

      ```
      // (Open)JDK 9 - WindowsAppImageBuilder
      Files.copy(new File(srcdir, fname).toPath(), new File(appDir.toFile(), fname).toPath());
      ```

      ```
      // (Open)JDK 8 - WinAppBundler
      IOUtils.copyFile(new File(srcdir, fname), new File(appDirectory, fname));
      ```

      Inside IOUtils.copyFile there is some code, which creates subfolders:
      ```
          public static void copyFile(File sourceFile, File destFile)
                  throws IOException {
              destFile.getParentFile().mkdirs();
      ```

      This is documented here while trying to make the maven-plugin compatible: https://github.com/javafx-maven-plugin/javafx-maven-plugin/issues/287#issuecomment-360599762

      Anything in `StandardBundlerParam.APP_RESOURCES` or `StandardBundlerParam.APP_RESOURCES_LIST` having any item in subfolders (like a "lib"-folder) does not get copied, because `Files.copy` does not create non-existing target subfolders.

      This only affects Windows-bundlers, MacOS(X)- and Linux-bundlers do create the required (sub)folder within `writeEntry`-method.

      REGRESSION. Last worked in version 8u162

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      some user provided some example-project:
      https://github.com/danielpeintner/Java9Test

      Works with JDK 8 (using plugin-version 8.8.3), breaks since JDK 9 (using plugin-version 8.9.0-SNAPSHOT).

      sorry there is no native javapackager-example u can simply try :(

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Packaging-process copies files from subfolders, creating working windows-bundle.
      ACTUAL -
      Packaging-process copies no a single files from subfolders, complains at the first encounter while ignoring IOExceptions, but works even further without breaking.

      REPRODUCIBILITY :
      This bug can be reproduced always.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              vdrozdov Victor Drozdov (Inactive)
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: