src/jdk.jpackage/share/classes/jdk/jpackage/internal/Arguments.java
branchJDK-8200758-branch
changeset 57062 044e7a644ee3
parent 57060 5103d6d2e796
child 57065 2446962c555c
equal deleted inserted replaced
57061:ac44f38300b2 57062:044e7a644ee3
   380             setOptionValue("win-dir-chooser", true);
   380             setOptionValue("win-dir-chooser", true);
   381         }),
   381         }),
   382 
   382 
   383         WIN_REGISTRY_NAME ("win-registry-name", OptionCategories.PLATFORM_WIN),
   383         WIN_REGISTRY_NAME ("win-registry-name", OptionCategories.PLATFORM_WIN),
   384 
   384 
   385         WIN_MSI_UPGRADE_UUID ("win-upgrade-uuid",
   385         WIN_UPGRADE_UUID ("win-upgrade-uuid",
   386                 OptionCategories.PLATFORM_WIN),
   386                 OptionCategories.PLATFORM_WIN),
   387 
   387 
   388         WIN_CONSOLE_HINT ("win-console", OptionCategories.PLATFORM_WIN, () -> {
   388         WIN_CONSOLE_HINT ("win-console", OptionCategories.PLATFORM_WIN, () -> {
   389             setOptionValue("win-console", true);
   389             setOptionValue("win-console", true);
   390         }),
   390         }),
   662             }
   662             }
   663             if (jreInstaller && bp.getName() == null) {
   663             if (jreInstaller && bp.getName() == null) {
   664                 throw new PackagerException("ERR_NoJreInstallerName");
   664                 throw new PackagerException("ERR_NoJreInstallerName");
   665             }
   665             }
   666 
   666 
   667             generateBundle(bp.getBundleParamsAsMap());
   667             return generateBundle(bp.getBundleParamsAsMap());
   668         } catch (Exception e) {
   668         } catch (Exception e) {
   669             if (Log.isVerbose()) {
   669             if (Log.isVerbose()) {
   670                 throw e;
   670                 throw e;
   671             } else {
   671             } else {
   672                 Log.error(e.getMessage());
   672                 Log.error(e.getMessage());
   674                     Log.error(e.getCause().getMessage());
   674                     Log.error(e.getCause().getMessage());
   675                 }
   675                 }
   676                 return false;
   676                 return false;
   677             }
   677             }
   678         }
   678         }
   679         return true;
       
   680     }
   679     }
   681 
   680 
   682     private void validateArguments() {
   681     private void validateArguments() {
   683         CLIOptions mode = allOptions.get(0);
   682         CLIOptions mode = allOptions.get(0);
   684         for (CLIOptions option : allOptions) {
   683         for (CLIOptions option : allOptions) {
   711         }
   710         }
   712 
   711 
   713         return platformBundlers;
   712         return platformBundlers;
   714     }
   713     }
   715 
   714 
   716     private void generateBundle(Map<String,? super Object> params)
   715     private boolean generateBundle(Map<String,? super Object> params)
   717             throws PackagerException {
   716             throws PackagerException {
       
   717         boolean bundleCreated = false;
       
   718 
   718         for (jdk.jpackage.internal.Bundler bundler : getPlatformBundlers()) {
   719         for (jdk.jpackage.internal.Bundler bundler : getPlatformBundlers()) {
   719             Map<String, ? super Object> localParams = new HashMap<>(params);
   720             Map<String, ? super Object> localParams = new HashMap<>(params);
   720             try {
   721             try {
   721                 if (bundler.validate(localParams)) {
   722                 if (bundler.validate(localParams)) {
   722                     File result =
   723                     File result =
   724                     bundler.cleanup(localParams);
   725                     bundler.cleanup(localParams);
   725                     if (result == null) {
   726                     if (result == null) {
   726                         throw new PackagerException("MSG_BundlerFailed",
   727                         throw new PackagerException("MSG_BundlerFailed",
   727                                 bundler.getID(), bundler.getName());
   728                                 bundler.getID(), bundler.getName());
   728                     }
   729                     }
       
   730                     bundleCreated = true; // Set that at least one bundle was created
   729                 }
   731                 }
   730             } catch (UnsupportedPlatformException e) {
   732             } catch (UnsupportedPlatformException e) {
   731                 Log.debug(MessageFormat.format(
   733                 Log.debug(MessageFormat.format(
   732                         I18N.getString("MSG_BundlerPlatformException"),
   734                         I18N.getString("MSG_BundlerPlatformException"),
   733                         bundler.getName()));
   735                         bundler.getName()));
   747                         I18N.getString("MSG_BundlerRuntimeException"),
   749                         I18N.getString("MSG_BundlerRuntimeException"),
   748                         bundler.getName(), re.toString()));
   750                         bundler.getName(), re.toString()));
   749                 Log.debug(re);
   751                 Log.debug(re);
   750             }
   752             }
   751         }
   753         }
       
   754 
       
   755         return bundleCreated;
   752     }
   756     }
   753 
   757 
   754     private void addResources(DeployParams deployParams,
   758     private void addResources(DeployParams deployParams,
   755             String inputdir, List<String> inputfiles) {
   759             String inputdir, List<String> inputfiles) {
   756 
   760