8224627: Creating installer with --runtime-image on OS X fails JDK-8200758-branch
authorherrick
Thu, 25 Jul 2019 07:59:20 -0400
branchJDK-8200758-branch
changeset 57529 e3b156ad362f
parent 57474 0af70fb03853
child 57530 9063613e9bb1
8224627: Creating installer with --runtime-image on OS X fails Reviewed-by: almatvee
src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacPkgBundler.java
--- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacPkgBundler.java	Mon Jul 15 09:44:36 2019 -0400
+++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacPkgBundler.java	Thu Jul 25 07:59:20 2019 -0400
@@ -327,7 +327,8 @@
         String[] lines = cplData.split("\n");
         try (PrintWriter out = new PrintWriter(Files.newBufferedWriter(
                 cpl.toPath()))) {
-            boolean skip = false; // Used to skip Java.runtime bundle, since
+            int skip = 0;
+            // Used to skip Java.runtime bundle, since
             // pkgbuild with --root will find two bundles app and Java runtime.
             // We cannot generate component proprty list when using
             // --component argument.
@@ -337,11 +338,11 @@
                     out.println("<false/>");
                     i++;
                 } else if (lines[i].trim().equals("<key>ChildBundles</key>")) {
-                    skip = true;
-                } else if (skip && lines[i].trim().equals("</array>")) {
-                    skip = false;
+                    ++skip;
+                } else if ((skip > 0) && lines[i].trim().equals("</array>")) {
+                    --skip;
                 } else {
-                    if (!skip) {
+                    if (skip == 0) {
                         out.println(lines[i]);
                     }
                 }