docs: @SuppressWarnings({"checkstyle:cyclomaticcomplexity", "checkstyle:npathcomplexity"})
  	public static String[] parseCommandLine(String[] args) {
  		final CommandLineParser parser = new DefaultParser();
  		try {
  			final CommandLine cmd = parser.parse(getOptions(), args, false);
  
  			boolean noLogo = false;
  			boolean embedded = false;
  			boolean userClasspath = false;
  			int verbose = LoggerCreator.toInt(JanusConfig.VERBOSE_LEVEL_VALUE);
  
  			final Iterator<Option> optIterator = cmd.iterator();
  			while (optIterator.hasNext()) {
  				final Option opt = optIterator.next();
  				String optName = opt.getLongOpt();
  				if (Strings.isNullOrEmpty(optName)) {
  					optName = opt.getOpt();
  				}
  				switch (optName) {
  				case CLI_OPTION_HELP_LONG:
  					showHelp(true);
  					return null;
  				case CLI_OPTION_VERSION:
  					showVersion(true);
  					return null;
  				case CLI_OPTION_SHOWDEFAULTS_LONG:
  					showDefaults();
  					return null;
  				case CLI_OPTION_SHOWCLASSPATH:
  					setDefaultClasspath(userClasspath);
  					showClasspath();
  					return null;
  				case CLI_OPTION_SHOWCLIARGUMENTS_LONG:
  					showCommandLineArguments(args);
  					return null;
  				case CLI_OPTION_FILE_LONG:
  					final String rawFilename = opt.getValue();
  					if (rawFilename == null || "".equals(rawFilename)) { //$NON-NLS-1$
  						showHelp(true);
  					}
  					final File file = new File(rawFilename);
  					if (!file.canRead()) {
  						showError(MessageFormat.format(Messages.Boot_0,
  								rawFilename), null);
  						return null;
  					}
  					setPropertiesFrom(file);
  					break;
  				case CLI_OPTION_CLASSPATH_LONG:
  					userClasspath = true;
  					addToSystemClasspath(opt.getValue());
  					break;
  				case CLI_OPTION_OFFLINE_LONG:
  					setOffline(true);
  					break;
  				case CLI_OPTION_RANDOMID_LONG:
  					setRandomContextUUID();
  					break;
  				case CLI_OPTION_BOOTID_LONG:
  					setBootAgentTypeContextUUID();
  					break;
  				case CLI_OPTION_WORLDID_LONG:
  					setDefaultContextUUID();
  					break;
  				case CLI_OPTION_DEFINE_LONG:
  					final String name = opt.getValue(0);
  					if (!Strings.isNullOrEmpty(name)) {
  						setProperty(name, Strings.emptyToNull(opt.getValue(1)));
  					}
  					break;
  				case CLI_OPTION_LOG_LONG:
  					verbose = Math.max(LoggerCreator.toInt(opt.getValue()), 0);
  					break;
  				case CLI_OPTION_QUIET_LONG:
  					if (verbose > 0) {
  						--verbose;
  					}
  					break;
  				case CLI_OPTION_VERBOSE_LONG:
  					++verbose;
  					break;
  				case CLI_OPTION_NOLOGO_LONG:
  					noLogo = true;
  					break;
  				case CLI_OPTION_EMBEDDED_LONG:
  					embedded = true;
  					break;
  				default:
  				}
  			}
  
  			setDefaultClasspath(userClasspath);
  
  			// Show the help when there is no argument.
  			if (cmd.getArgs().length == 0) {
  				showHelp(true);
  				return null;
  			}
  
  			// Change the verbosity
  			setVerboseLevel(verbose);
  			// Do nothing at exit
  			if (embedded) {
  				setExiter(() -> {
  					ExecutorService.neverReturn();
  				});
  			}
  			// Show the Janus logo?
  			if (noLogo || verbose == 0) {
  				setProperty(JanusConfig.JANUS_LOGO_SHOW_NAME, Boolean.FALSE.toString());
  			}
  			return cmd.getArgs();
  		} catch (IOException | ParseException e) {
  			showError(e.getLocalizedMessage(), e);
  			// Event if showError never returns, add the return statement for
  			// avoiding compilation error.
  			return null;
  		}
  	}