src/jdk.jpackage/share/classes/jdk/jpackage/internal/Arguments.java
branchJDK-8200758-branch
changeset 57391 970f28090a06
parent 57330 a30edd277572
child 57392 46d4b0aa4542
equal deleted inserted replaced
57390:1cb722a11ead 57391:970f28090a06
   130                 argShortIds.put(option.getShortIdWithPrefix(), option);
   130                 argShortIds.put(option.getShortIdWithPrefix(), option);
   131             }
   131             }
   132         });
   132         });
   133     }
   133     }
   134 
   134 
   135     public Arguments(String[] args) throws PackagerException {
   135     public Arguments(String[] args) {
   136         argList = new ArrayList<String>(args.length);
   136         argList = new ArrayList<String>(args.length);
   137         for (String arg : args) {
   137         for (String arg : args) {
   138             argList.add(arg);
   138             argList.add(arg);
   139         }
   139         }
   140         Log.debug ("\njpackage argument list: \n" + argList + "\n");
   140         Log.debug ("\njpackage argument list: \n" + argList + "\n");
   481         PLATFORM_MAC,
   481         PLATFORM_MAC,
   482         PLATFORM_WIN,
   482         PLATFORM_WIN,
   483         PLATFORM_LINUX;
   483         PLATFORM_LINUX;
   484     }
   484     }
   485 
   485 
   486     public boolean processArguments() throws Exception {
   486     public boolean processArguments() {
   487         try {
   487         try {
   488 
   488 
   489             // init context of arguments
   489             // init context of arguments
   490             CLIOptions.setContext(this);
   490             CLIOptions.setContext(this);
   491 
   491 
   568             }
   568             }
   569 
   569 
   570             return generateBundle(bp.getBundleParamsAsMap());
   570             return generateBundle(bp.getBundleParamsAsMap());
   571         } catch (Exception e) {
   571         } catch (Exception e) {
   572             if (Log.isVerbose()) {
   572             if (Log.isVerbose()) {
   573                 throw e;
   573                 Log.verbose(e);
   574             } else {
   574             } else {
   575                 String msg1 = e.getMessage();
   575                 String msg1 = e.getMessage();
   576                 Log.error(msg1);
   576                 Log.error(msg1);
   577                 if (e.getCause() != null && e.getCause() != e) {
   577                 if (e.getCause() != null && e.getCause() != e) {
   578                     String msg2 = e.getCause().getMessage();
   578                     String msg2 = e.getCause().getMessage();
   579                     if (!msg1.contains(msg2)) {
   579                     if (!msg1.contains(msg2)) {
   580                         Log.error(msg2);
   580                         Log.error(msg2);
   581                     }
   581                     }
   582                 }
   582                 }
   583                 return false;
   583             }
   584             }
   584             return false;
   585         }
   585         }
   586     }
   586     }
   587 
   587 
   588     private void validateArguments() throws PackagerException {
   588     private void validateArguments() throws PackagerException {
   589         CLIOptions mode = allOptions.get(0);
   589         CLIOptions mode = allOptions.get(0);
   765             option = argShortIds.get(arg);
   765             option = argShortIds.get(arg);
   766         }
   766         }
   767         return option;
   767         return option;
   768     }
   768     }
   769 
   769 
   770     static Map<String, String> getArgumentMap(String inputString) {
       
   771         Map<String, String> map = new HashMap<>();
       
   772         List<String> list = getArgumentList(inputString);
       
   773         for (String pair : list) {
       
   774             int equals = pair.indexOf("=");
       
   775             if (equals != -1) {
       
   776                 String key = pair.substring(0, equals);
       
   777                 String value = pair.substring(equals+1, pair.length());
       
   778                 map.put(key, value);
       
   779             }
       
   780         }
       
   781         return map;
       
   782     }
       
   783 
       
   784     static Map<String, String> getPropertiesFromFile(String filename) {
   770     static Map<String, String> getPropertiesFromFile(String filename) {
   785         Map<String, String> map = new HashMap<>();
   771         Map<String, String> map = new HashMap<>();
   786         // load properties file
   772         // load properties file
   787         File file = new File(filename);
   773         File file = new File(filename);
   788         Properties properties = new Properties();
   774         Properties properties = new Properties();