List of usage examples for org.apache.commons.cli MissingArgumentException MissingArgumentException
public MissingArgumentException(Option option)
MissingArgumentException
with the specified detail message. From source file:craterdog.security.DigitalNotaryMain.java
public static void main(String[] args) throws ParseException, IOException { HelpFormatter help = new HelpFormatter(); Options options = new Options(); options.addOption("help", false, "print this message"); options.addOption("pubfile", true, "public key input file"); options.addOption("prvfile", true, "private key input file"); try {// w w w . j a va 2s. c o m CommandLine cli = new BasicParser().parse(options, args); String pubfile = cli.getOptionValue("pubfile"); String prvfile = cli.getOptionValue("prvfile"); NotaryKey notaryKey = notarization.generateNotaryKey(); if (pubfile != null || prvfile != null) { if (pubfile == null) throw new MissingArgumentException("Missing option: pubfile"); if (prvfile == null) throw new MissingArgumentException("Missing option: prvfile"); CertificateManager manager = new RsaCertificateManager(); PublicKey publicKey = manager.decodePublicKey(FileUtils.readFileToString(new File(pubfile))); char[] password = System.console().readPassword("input private key password: "); PrivateKey privateKey = manager.decodePrivateKey(FileUtils.readFileToString(new File(prvfile)), password); notaryKey.signingKey = privateKey; notaryKey.verificationKey = publicKey; // make sure it works DigitalSeal seal = notarization.notarizeDocument("test document", "test document", notaryKey); notarization.documentIsValid("test document", seal, publicKey); } char[] password = System.console().readPassword("verficationKey password: "); System.out.println(notarization.serializeNotaryKey(notaryKey, password)); } catch (MissingArgumentException | FileNotFoundException ex) { System.out.println(ex.getMessage()); help.printHelp(CMD_LINE_SYNTAX, options); System.exit(1); } }
From source file:jlite.cli.JobMatch.java
public static void main(String[] args) { System.out.println(); // extra line CommandLineParser parser = new GnuParser(); Options options = setupOptions();/* w w w. j a v a 2 s .c o m*/ HelpFormatter helpFormatter = new HelpFormatter(); helpFormatter.setSyntaxPrefix("Usage: "); CommandLine line = null; try { line = parser.parse(options, args); if (line.hasOption("help")) { helpFormatter.printHelp(100, COMMAND, "\noptions:", options, "\n" + CLI.FOOTER, false); System.out.println(); // extra line System.exit(0); } else { if (line.hasOption("xml")) { System.out.println("<output>"); } String[] remArgs = line.getArgs(); if (remArgs.length == 1) { run(remArgs[0], line); } else if (remArgs.length == 0) { throw new MissingArgumentException("Missing required argument: <jdl_file>"); } else { throw new UnrecognizedOptionException("Unrecognized extra arguments"); } } } catch (ParseException e) { System.err.println(e.getMessage() + "\n"); helpFormatter.printHelp(100, COMMAND, "\noptions:", options, "\n" + CLI.FOOTER, false); System.out.println(); // extra line System.exit(-1); } catch (Exception e) { if (line.hasOption("xml")) { System.out.println("<error>" + e.getMessage() + "</error>"); } else { System.err.println(e.getMessage()); } } finally { if (line.hasOption("xml")) { System.out.println("</output>"); } } System.out.println(); // extra line }
From source file:jlite.cli.ProxyInit.java
public static void main(String[] args) { CommandLineParser parser = new GnuParser(); Options options = setupOptions();// w ww.j a va 2 s .c o m HelpFormatter helpFormatter = new HelpFormatter(); helpFormatter.setSyntaxPrefix("Usage: "); CommandLine line = null; try { line = parser.parse(options, args); if (line.hasOption("help")) { System.out.println(); // extra line helpFormatter.printHelp(100, COMMAND, "\noptions:", options, "\n" + CLI.FOOTER + "\n", false); System.out.println(); // extra line System.exit(0); } else { if (line.hasOption("xml")) { System.out.println("<output>"); } String[] remArgs = line.getArgs(); if (remArgs.length > 0) { run(remArgs, line); } else { throw new MissingArgumentException("Missing required argument: <voms>[:<command>]"); } } } catch (ParseException e) { System.err.println("\n" + e.getMessage() + "\n"); helpFormatter.printHelp(100, COMMAND, "\noptions:", options, "\n" + CLI.FOOTER + "\n", false); System.out.println(); // extra line System.exit(-1); } catch (Exception e) { if ((line != null) && (line.hasOption("xml"))) { System.out.println("<error>" + e.getMessage() + "</error>"); } else { System.err.println(e.getMessage()); } } finally { if (line.hasOption("xml")) { System.out.println("</output>"); } } System.out.println(); // extra line }
From source file:jlite.cli.JobSubmit.java
public static void main(String[] args) { System.out.println(); // extra line CommandLineParser parser = new GnuParser(); Options options = setupOptions();/* ww w. ja v a 2 s. c o m*/ HelpFormatter helpFormatter = new HelpFormatter(); helpFormatter.setSyntaxPrefix("Usage: "); CommandLine line = null; try { line = parser.parse(options, args); if (line.hasOption("help")) { helpFormatter.printHelp(100, COMMAND, "\noptions:", options, "\n" + CLI.FOOTER + "\n", false); System.out.println(); // extra line System.exit(0); } else { if (line.hasOption("xml")) { System.out.println("<output>"); } String[] remArgs = line.getArgs(); if (remArgs.length == 1) { run(remArgs[0], line); } else if (remArgs.length == 0) { throw new MissingArgumentException("Missing required argument: <jdl_file>"); } else { throw new UnrecognizedOptionException("Unrecognized extra arguments"); } } } catch (ParseException e) { System.err.println(e.getMessage() + "\n"); helpFormatter.printHelp(100, COMMAND, "\noptions:", options, "\n" + CLI.FOOTER + "\n", false); System.out.println(); // extra line System.exit(-1); } catch (Exception e) { if (line.hasOption("xml")) { System.out.println("<error>" + e.getMessage() + "</error>"); } else { System.err.println(e.getMessage()); } } finally { if (line.hasOption("xml")) { System.out.println("</output>"); } } System.out.println(); // extra line }
From source file:edu.ksu.cis.indus.staticanalyses.concurrency.escape.EscapeAndReadWriteCLI.java
/** * The entry point to this class./*from w w w . j a v a 2s. c o m*/ * * @param args command line arguments. * @throws RuntimeException when escape information and side-effect information calculation fails. */ public static void main(final String[] args) { final Options _options = new Options(); Option _option = new Option("h", "help", false, "Display message."); _option.setOptionalArg(false); _options.addOption(_option); _option = new Option("p", "soot-classpath", false, "Prepend this to soot class path."); _option.setArgs(1); _option.setArgName("classpath"); _option.setOptionalArg(false); _options.addOption(_option); _option = new Option("S", "scope", true, "The scope that should be analyzed."); _option.setArgs(1); _option.setArgName("scope"); _option.setRequired(false); _options.addOption(_option); final CommandLineParser _parser = new GnuParser(); try { final CommandLine _cl = _parser.parse(_options, args); if (_cl.hasOption("h")) { final String _cmdLineSyn = "java " + EscapeAndReadWriteCLI.class.getName() + " <options> <classnames>"; (new HelpFormatter()).printHelp(_cmdLineSyn, _options); System.exit(1); } if (_cl.getArgList().isEmpty()) { throw new MissingArgumentException("Please specify atleast one class."); } final EscapeAndReadWriteCLI _cli = new EscapeAndReadWriteCLI(); if (_cl.hasOption('p')) { _cli.addToSootClassPath(_cl.getOptionValue('p')); } if (_cl.hasOption('S')) { _cli.setScopeSpecFile(_cl.getOptionValue('S')); } _cli.setClassNames(_cl.getArgList()); _cli.<ITokens>execute(); } catch (final ParseException _e) { LOGGER.error("Error while parsing command line.", _e); System.out.println("Error while parsing command line." + _e); final String _cmdLineSyn = "java " + EscapeAndReadWriteCLI.class.getName() + " <options> <classnames>"; (new HelpFormatter()).printHelp(_cmdLineSyn, "Options are:", _options, ""); } catch (final Throwable _e) { LOGGER.error("Beyond our control. May day! May day!", _e); throw new RuntimeException(_e); } }
From source file:edu.ksu.cis.indus.staticanalyses.concurrency.DeadlockAnalysisCLI.java
/** * The entry point to this class.//from www . ja v a 2 s . c om * * @param args command line arguments. * @throws RuntimeException when escape information and side-effect information calculation fails. */ public static void main(final String[] args) { final Options _options = new Options(); Option _option = new Option("h", "help", false, "Display message."); _option.setOptionalArg(false); _options.addOption(_option); _option = new Option("p", "soot-classpath", false, "Prepend this to soot class path."); _option.setArgs(1); _option.setArgName("classpath"); _option.setOptionalArg(false); _options.addOption(_option); _option = new Option("S", "scope", true, "The scope that should be analyzed."); _option.setArgs(1); _option.setArgName("scope"); _option.setRequired(false); _options.addOption(_option); final CommandLineParser _parser = new GnuParser(); try { final CommandLine _cl = _parser.parse(_options, args); if (_cl.hasOption("h")) { final String _cmdLineSyn = "java " + DeadlockAnalysisCLI.class.getName() + " <options> <classnames>"; (new HelpFormatter()).printHelp(_cmdLineSyn, _options); System.exit(1); } if (_cl.getArgList().isEmpty()) { throw new MissingArgumentException("Please specify atleast one class."); } final DeadlockAnalysisCLI _cli = new DeadlockAnalysisCLI(); if (_cl.hasOption('p')) { _cli.addToSootClassPath(_cl.getOptionValue('p')); } if (_cl.hasOption('S')) { _cli.setScopeSpecFile(_cl.getOptionValue('S')); } _cli.setClassNames(_cl.getArgList()); _cli.<ITokens>execute(); } catch (final ParseException _e) { LOGGER.error("Error while parsing command line.", _e); System.out.println("Error while parsing command line." + _e); final String _cmdLineSyn = "java " + DeadlockAnalysisCLI.class.getName() + " <options> <classnames>"; (new HelpFormatter()).printHelp(_cmdLineSyn, "Options are:", _options, ""); } catch (final Throwable _e) { LOGGER.error("Beyond our control. May day! May day!", _e); throw new RuntimeException(_e); } }
From source file:edu.ksu.cis.indus.staticanalyses.concurrency.independence.IndependenceDetectionCLI.java
/** * The entry point to the program via command line. * //from w w w .j a va 2 s . com * @param args is the command line arguments. * @throws RuntimeException when CLI fails. */ public static void main(final String[] args) { final Options _options = new Options(); Option _option = new Option("o", "output", true, "Directory into which jimple files will be written into. [required]"); _option.setArgs(1); _option.setArgName("ouput-directory"); _option.setRequired(true); _options.addOption(_option); _option = new Option("h", "help", false, "Display message."); _option.setOptionalArg(false); _options.addOption(_option); _option = new Option("p", "soot-classpath", false, "Prepend this to soot class path."); _option.setArgs(1); _option.setArgName("classpath"); _option.setOptionalArg(false); _options.addOption(_option); _option = new Option("useV2", false, "Use version 2 of the atomicity detection algorithm."); _options.addOption(_option); _option = new Option("scheme", false, "Scheme to indicate atomicity. Valid values are 'tag-stmt' and 'tag-region'. By default, 'tag-stmt' " + "scheme is used. "); _option.setArgs(1); _option.setArgName("scheme-name"); _options.addOption(_option); _option = new Option("S", "scope", true, "The scope that should be analyzed."); _option.setArgs(1); _option.setArgName("scope"); _option.setRequired(false); _options.addOption(_option); final CommandLineParser _parser = new GnuParser(); try { final CommandLine _cl = _parser.parse(_options, args); if (_cl.hasOption("h")) { final String _cmdLineSyn = "java " + IndependenceDetectionCLI.class.getName() + " <options> <classnames>"; (new HelpFormatter()).printHelp(_cmdLineSyn, _options); System.exit(1); } if (_cl.getArgList().isEmpty()) { throw new MissingArgumentException("Please specify atleast one class."); } final IndependenceDetectionCLI _cli; if (_cl.hasOption("useV2")) { _cli = new IndependenceDetectionCLI(new IndependentStmtDetectorv2()); } else { _cli = new IndependenceDetectionCLI(new IndependentStmtDetector()); } if (_cl.hasOption('p')) { _cli.addToSootClassPath(_cl.getOptionValue('p')); } if (_cl.hasOption('S')) { _cli.setScopeSpecFile(_cl.getOptionValue('S')); } _cli.setClassNames(_cl.getArgList()); _cli.setOutputDir(_cl.getOptionValue('o')); _cli.<ITokens>execute(_cl); } catch (final ParseException _e) { LOGGER.error("Error while parsing command line.", _e); System.out.println("Error while parsing command line." + _e); final String _cmdLineSyn = "java " + IndependenceDetectionCLI.class.getName() + " <options> <classnames>"; (new HelpFormatter()).printHelp(_cmdLineSyn, "Options are:", _options, ""); } catch (final Throwable _e) { LOGGER.error("Beyond our control. May day! May day!", _e); throw new RuntimeException(_e); } }
From source file:edu.ksu.cis.indus.staticanalyses.callgraphs.CallGraphXMLizerCLI.java
/** * The entry point to the program via command line. * //from w ww. java 2 s.c o m * @param args is the command line arguments. * @throws RuntimeException when the analyses fail. */ public static void main(final String[] args) { final Options _options = new Options(); Option _option = new Option("c", "cumulative", false, "Builds one call graph that includes all root methods."); _options.addOption(_option); _option = new Option("o", "output", true, "Directory into which xml files will be written into. Defaults to current directory if omitted"); _option.setArgs(1); _option.setArgName("output-dir"); _options.addOption(_option); _option = new Option("j", "jimple", false, "Dump xmlized jimple."); _option.setArgName("dump-jimple"); _options.addOption(_option); _option = new Option("p", "soot-classpath", true, "Prepend this to soot class path."); _option.setArgs(1); _option.setArgName("classpath"); _option.setOptionalArg(false); _options.addOption(_option); _option = new Option("h", "help", false, "Display message."); _option.setOptionalArg(false); _options.addOption(_option); _option = new Option("t", "call-graph-type", true, "Call graph type. This has to be one of {cha, rta, ofa-oi, " + "ofa-oirt, ofa-os}."); _option.setArgs(1); _option.setArgName("type"); _option.setRequired(true); _options.addOption(_option); _option = new Option("S", "scope", true, "The scope that should be analyzed."); _option.setArgs(1); _option.setArgName("scope"); _option.setRequired(false); _options.addOption(_option); final PosixParser _parser = new PosixParser(); try { final CommandLine _cl = _parser.parse(_options, args); if (_cl.hasOption('h')) { printUsage(_options); System.exit(1); } String _outputDir = _cl.getOptionValue('o'); if (_outputDir == null) { if (LOGGER.isWarnEnabled()) { LOGGER.warn("Defaulting to current directory for output."); } _outputDir = "."; } if (_cl.getArgList().isEmpty()) { throw new MissingArgumentException("Please specify atleast one class."); } final CallGraphXMLizerCLI _cli = new CallGraphXMLizerCLI(); _cli.xmlizer.setXmlOutputDir(_outputDir); _cli.xmlizer.setGenerator(new UniqueJimpleIDGenerator()); _cli.setCumulative(_cl.hasOption('c')); _cli.setClassNames(_cl.getArgList()); _cli.addToSootClassPath(_cl.getOptionValue('p')); if (_cl.hasOption('S')) { _cli.setScopeSpecFile(_cl.getOptionValue('S')); } _cli.initialize(); _cli.execute(_cl.hasOption('j'), _cl.getOptionValue('t')); } catch (final ParseException _e) { LOGGER.error("Error while parsing command line.", _e); System.out.println("Error while parsing command line." + _e); printUsage(_options); } catch (final Throwable _e) { LOGGER.error("Beyond our control. May day! May day!", _e); throw new RuntimeException(_e); } }
From source file:edu.ksu.cis.indus.staticanalyses.flow.instances.ofa.OFAXMLizerCLI.java
/** * The entry point to the program via command line. * //from www .java2 s. c om * @param args is the command line arguments. * @throws RuntimeException when object flow analysis fails. */ public static void main(final String[] args) { final Options _options = new Options(); Option _option = new Option("c", "cumulative", false, "Consider all root methods in the same execution."); _options.addOption(_option); _option = new Option("o", "output", true, "Directory into which xml files will be written into."); _option.setArgs(1); _options.addOption(_option); _option = new Option("j", "jimple", false, "Dump xmlized jimple."); _options.addOption(_option); _option = new Option("h", "help", false, "Display message."); _options.addOption(_option); _option = new Option("p", "soot-classpath", false, "Prepend this to soot class path."); _option.setArgs(1); _option.setArgName("classpath"); _option.setOptionalArg(false); _options.addOption(_option); _option = new Option("t", "ofa-type", false, "Type of analysis : fioi, fsoi, fios, fsos, fioirt, fsoirt."); _option.setArgs(1); _option.setArgName("type"); _option.setOptionalArg(false); _option.setRequired(true); _options.addOption(_option); _option = new Option("S", "scope", true, "The scope that should be analyzed."); _option.setArgs(1); _option.setArgName("scope"); _option.setRequired(false); _options.addOption(_option); final PosixParser _parser = new PosixParser(); try { final CommandLine _cl = _parser.parse(_options, args); if (_cl.hasOption("h")) { printUsage(_options); System.exit(1); } String _outputDir = _cl.getOptionValue('o'); if (_outputDir == null) { if (LOGGER.isWarnEnabled()) { LOGGER.warn("Defaulting to current directory for output."); } _outputDir = "."; } if (_cl.getArgList().isEmpty()) { throw new MissingArgumentException("Please specify atleast one class."); } final OFAXMLizerCLI _cli = new OFAXMLizerCLI(); _cli.xmlizer.setXmlOutputDir(_outputDir); _cli.xmlizer.setGenerator(new UniqueJimpleIDGenerator()); _cli.setCumulative(_cl.hasOption('c')); _cli.setClassNames(_cl.getArgList()); _cli.type = _cl.getOptionValue('t'); if (_cl.hasOption('p')) { _cli.addToSootClassPath(_cl.getOptionValue('p')); } if (_cl.hasOption('S')) { _cli.setScopeSpecFile(_cl.getOptionValue('S')); } _cli.initialize(); _cli.<ITokens>execute(_cl.hasOption('j')); } catch (final ParseException _e) { LOGGER.error("Error while parsing command line.", _e); System.out.println("Error while parsing command line. \n" + _e); printUsage(_options); } catch (final Throwable _e) { LOGGER.error("Beyond our control. May day! May day!", _e); throw new RuntimeException(_e); } }
From source file:com.continuent.tungsten.common.security.PasswordManagerCtrl.java
/** * Password Manager entry point/*from w ww.j av a2 s.c o m*/ * * @param argv * @throws Exception */ public static void main(String argv[]) throws Exception { pwd = new PasswordManagerCtrl(); // --- Options --- ClientApplicationType clientApplicationType = null; String securityPropertiesFileLocation = null; String username = null; String password = null; CommandLine line = null; try { CommandLineParser parser = new GnuParser(); // --- Parse the command line arguments --- // --- Help line = parser.parse(pwd.helpOptions, argv, true); if (line.hasOption(_HELP)) { DisplayHelpAndExit(EXIT_CODE.EXIT_OK); } // --- Program command line options line = parser.parse(pwd.options, argv); // --- Handle options --- // --- Optional arguments : Get options --- if (line.hasOption(_HELP)) { DisplayHelpAndExit(EXIT_CODE.EXIT_OK); } if (line.hasOption(_TARGET_APPLICATION)) // Target Application { String target = line.getOptionValue(TARGET_APPLICATION); clientApplicationType = PasswordManagerCtrl.getClientApplicationType(target); } if (line.hasOption(_FILE)) // security.properties file location { securityPropertiesFileLocation = line.getOptionValue(_FILE); } if (line.hasOption(_AUTHENTICATE)) { // Make sure username + password are provided String[] authenticateArgs = line.getOptionValues(_AUTHENTICATE); if (authenticateArgs.length < 2) throw new MissingArgumentException(authenticate); username = authenticateArgs[0]; password = authenticateArgs[1]; } if (line.hasOption(_CREATE)) { // Make sure username + password are provided String[] createArgs = line.getOptionValues(_CREATE); if (createArgs.length < 2) throw new MissingArgumentException(create); username = createArgs[0]; password = createArgs[1]; } // --- Options to replace values in security.properties file --- if (line.hasOption(_ENCRYPTED_PASSWORD)) pwd.useEncryptedPassword = true; if (line.hasOption(_TRUSTSTORE_LOCATION)) pwd.truststoreLocation = line.getOptionValue(_TRUSTSTORE_LOCATION); if (line.hasOption(_TRUSTSTORE_PASSWORD)) pwd.truststorePassword = line.getOptionValue(_TRUSTSTORE_PASSWORD); if (line.hasOption(_KEYSTORE_LOCATION)) pwd.keystoreLocation = line.getOptionValue(_KEYSTORE_LOCATION); if (line.hasOption(_KEYSTORE_PASSWORD)) pwd.keystorePassword = line.getOptionValue(_KEYSTORE_PASSWORD); if (line.hasOption(_PASSWORD_FILE_LOCATION)) pwd.passwordFileLocation = (String) line.getOptionValue(_PASSWORD_FILE_LOCATION); try { pwd.passwordManager = new PasswordManager(securityPropertiesFileLocation, clientApplicationType); AuthenticationInfo authenticationInfo = pwd.passwordManager.getAuthenticationInfo(); // --- Substitute with user provided options if (pwd.useEncryptedPassword != null) authenticationInfo.setUseEncryptedPasswords(pwd.useEncryptedPassword); if (pwd.truststoreLocation != null) authenticationInfo.setTruststoreLocation(pwd.truststoreLocation); if (pwd.truststorePassword != null) authenticationInfo.setTruststorePassword(pwd.truststorePassword); if (pwd.keystoreLocation != null) authenticationInfo.setKeystoreLocation(pwd.keystoreLocation); if (pwd.keystorePassword != null) authenticationInfo.setKeystorePassword(pwd.keystorePassword); if (pwd.passwordFileLocation != null) authenticationInfo.setPasswordFileLocation(pwd.passwordFileLocation); // --- Display summary of used parameters --- logger.info("Using parameters: "); logger.info("-----------------"); if (authenticationInfo.getParentPropertiesFileLocation() != null) logger.info(MessageFormat.format("security.properties \t = {0}", authenticationInfo.getParentPropertiesFileLocation())); logger.info(MessageFormat.format("password_file.location \t = {0}", authenticationInfo.getPasswordFileLocation())); logger.info(MessageFormat.format("encrypted.password \t = {0}", authenticationInfo.isUseEncryptedPasswords())); // --- Keystore if (line.hasOption(_AUTHENTICATE)) { logger.info(MessageFormat.format("keystore.location \t = {0}", authenticationInfo.getKeystoreLocation())); logger.info(MessageFormat.format("keystore.password \t = {0}", authenticationInfo.getKeystorePassword())); } // --- Truststore if (authenticationInfo.isUseEncryptedPasswords()) { logger.info(MessageFormat.format("truststore.location \t = {0}", authenticationInfo.getTruststoreLocation())); logger.info(MessageFormat.format("truststore.password \t = {0}", authenticationInfo.getTruststorePassword())); } logger.info("-----------------"); // --- AuthenticationInfo consistency check // Try to create files if possible pwd.passwordManager.try_createAuthenticationInfoFiles(); authenticationInfo.checkAndCleanAuthenticationInfo(); } catch (ConfigurationException ce) { logger.error(MessageFormat.format( "Could not retrieve configuration information: {0}\nTry to specify a security.properties file location, provide options on the command line, or have the cluster.home variable set.", ce.getMessage())); System.exit(EXIT_CODE.EXIT_ERROR.value); } catch (ServerRuntimeException sre) { logger.error(sre.getLocalizedMessage()); // AuthenticationInfo consistency check : failed DisplayHelpAndExit(EXIT_CODE.EXIT_ERROR); } // --- Perform commands --- // ######### Authenticate ########## if (line.hasOption(_AUTHENTICATE)) { try { boolean authOK = pwd.passwordManager.authenticateUser(username, password); String msgAuthOK = (authOK) ? "SUCCESS" : "FAILED"; logger.info( MessageFormat.format("Authenticating {0}:{1} = {2}", username, password, msgAuthOK)); } catch (Exception e) { logger.error(MessageFormat.format("Error while authenticating user: {0}", e.getMessage())); } } // ######### Create ########## if (line.hasOption(_CREATE)) { try { pwd.passwordManager.setPasswordForUser(username, password); logger.info(MessageFormat.format("User created successfuly: {0}", username)); } catch (Exception e) { logger.error(MessageFormat.format("Error while creating user: {0}", e.getMessage())); } } // ########## DELETE ########## else if (line.hasOption(_DELETE)) { username = line.getOptionValue(_DELETE); try { pwd.passwordManager.deleteUser(username); logger.info(MessageFormat.format("User deleted successfuly: {0}", username)); } catch (Exception e) { logger.error(MessageFormat.format("Error while deleting user: {0}", e.getMessage())); } } } catch (ParseException exp) { logger.error(exp.getMessage()); DisplayHelpAndExit(EXIT_CODE.EXIT_ERROR); } }