< prev index next >

src/jdk.jpackage/share/classes/jdk/jpackage/internal/Arguments.java

Print this page




 639             deployParams.addBundleArgument(
 640                     StandardBundlerParam.SECONDARY_LAUNCHERS.getID(),
 641                     launchersAsMap);
 642 
 643             // at this point deployParams should be already configured
 644 
 645             deployParams.validate();
 646 
 647             BundleParams bp = deployParams.getBundleParams();
 648 
 649             // validate name(s)
 650             ArrayList<String> usedNames = new ArrayList<String>();
 651             usedNames.add(bp.getName()); // add main app name
 652 
 653             for (SecondaryLauncherArguments sl : secondaryLaunchers) {
 654                 Map<String, ? super Object> slMap = sl.getLauncherMap();
 655                 String slName =
 656                         (String) slMap.get(Arguments.CLIOptions.NAME.getId());
 657                 if (slName == null) {
 658                     throw new PackagerException("ERR_NoSecondaryLauncherName");
 659                 } else {


 660                     for (String usedName : usedNames) {
 661                         if (slName.equals(usedName)) {
 662                             throw new PackagerException("ERR_NoUniqueName");
 663                         }
 664                     }
 665                 }
 666                 usedNames.add(slName);
 667             }
 668             if (jreInstaller && bp.getName() == null) {
 669                 throw new PackagerException("ERR_NoJreInstallerName");
 670             }
 671 
 672             return generateBundle(bp.getBundleParamsAsMap());
 673         } catch (Exception e) {
 674             if (Log.isVerbose()) {
 675                 throw e;
 676             } else {
 677                 Log.error(e.getMessage());
 678                 if (e.getCause() != null && e.getCause() != e) {
 679                     Log.error(e.getCause().getMessage());
 680                 }
 681                 return false;
 682             }
 683         }




 639             deployParams.addBundleArgument(
 640                     StandardBundlerParam.SECONDARY_LAUNCHERS.getID(),
 641                     launchersAsMap);
 642 
 643             // at this point deployParams should be already configured
 644 
 645             deployParams.validate();
 646 
 647             BundleParams bp = deployParams.getBundleParams();
 648 
 649             // validate name(s)
 650             ArrayList<String> usedNames = new ArrayList<String>();
 651             usedNames.add(bp.getName()); // add main app name
 652 
 653             for (SecondaryLauncherArguments sl : secondaryLaunchers) {
 654                 Map<String, ? super Object> slMap = sl.getLauncherMap();
 655                 String slName =
 656                         (String) slMap.get(Arguments.CLIOptions.NAME.getId());
 657                 if (slName == null) {
 658                     throw new PackagerException("ERR_NoSecondaryLauncherName");
 659                 }
 660                 // same rules apply to secondary launcher names as app name
 661                 DeployParams.validateName(slName, false);
 662                 for (String usedName : usedNames) {
 663                     if (slName.equals(usedName)) {
 664                         throw new PackagerException("ERR_NoUniqueName");

 665                     }
 666                 }
 667                 usedNames.add(slName);
 668             }
 669             if (jreInstaller && bp.getName() == null) {
 670                 throw new PackagerException("ERR_NoJreInstallerName");
 671             }
 672 
 673             return generateBundle(bp.getBundleParamsAsMap());
 674         } catch (Exception e) {
 675             if (Log.isVerbose()) {
 676                 throw e;
 677             } else {
 678                 Log.error(e.getMessage());
 679                 if (e.getCause() != null && e.getCause() != e) {
 680                     Log.error(e.getCause().getMessage());
 681                 }
 682                 return false;
 683             }
 684         }


< prev index next >