Buggy code:
class CommandContextImpl implements CommandContext { private static final Logger log = Logger . getLogger ( CommandContext . class ) ; private final CliConfig config ; private final CommandRegistry cmdRegistry = new CommandRegistry ( ) ; private Console console ; private boolean terminate ; private String cmdLine ; private DefaultCallbackHandler parsedCmd = new DefaultCallbackHandler ( true ) ; private boolean domainMode ; private ModelControllerClient client ; private String defaultControllerHost ; private int defaultControllerPort ; private String controllerHost ; private int controllerPort = - 1 ; private String username ; private char [ ] password ; private SSLContext sslContext ; private CommandContextImpl . LazyDelagatingTrustManager trustManager ; private Map < String , Object > map = new HashMap < String , Object > ( ) ; private final OperationRequestAddress prefix = new DefaultOperationRequestAddress ( ) ; private final NodePathFormatter prefixFormatter = new DefaultPrefixFormatter ( ) ; private final OperationCandidatesProvider operationCandidatesProvider ; private final OperationRequestHandler operationHandler ; private BatchManager batchManager = new DefaultBatchManager ( ) ; private final CommandCompleter cmdCompleter ; private BufferedWriter outputTarget ; private List < CliEventListener > listeners = new ArrayList < CliEventListener > ( ) ; private int exitCode ; private File currentDir = new File ( "" ) ; private boolean resolveParameterValues ; CommandContextImpl ( ) throws CliInitializationException { } CommandContextImpl ( String username , char [ ] password ) throws CliInitializationException { } CommandContextImpl ( String defaultControllerHost , int defaultControllerPort , String username , char [ ] password , boolean initConsole ) throws CliInitializationException { } CommandContextImpl ( String defaultControllerHost , int defaultControllerPort , String username , char [ ] password , InputStream consoleInput , OutputStream consoleOutput ) throws CliInitializationException { } protected void initBasicConsole ( InputStream consoleInput , OutputStream consoleOutput ) throws CliInitializationException { } private void copyConfigSettingsToConsole ( InputStream consoleInput , OutputStream consoleOutput ) { } private void initCommands ( ) { cmdRegistry . registerHandler ( new PrefixHandler ( ) , "cd" , "cn" ) ; cmdRegistry . registerHandler ( new ClearScreenHandler ( ) , "clear" , "cls" ) ; cmdRegistry . registerHandler ( new org . jboss . as . cli . handlers . CommandCommandHandler ( cmdRegistry ) , "command" ) ; cmdRegistry . registerHandler ( new ConnectHandler ( ) , "connect" ) ; cmdRegistry . registerHandler ( new EchoDMRHandler ( ) , "echo-dmr" ) ; <START_BUG> cmdRegistry . registerHandler ( new HelpHandler ( ) , "help" , "h" ) ; <END_BUG> cmdRegistry . registerHandler ( new HistoryHandler ( ) , "history" ) ; cmdRegistry . registerHandler ( new LsHandler ( ) , "ls" ) ; cmdRegistry . registerHandler ( new ASModuleHandler ( this ) , "module" ) ; cmdRegistry . registerHandler ( new PrintWorkingNodeHandler ( ) , "pwd" , "pwn" ) ; cmdRegistry . registerHandler ( new QuitHandler ( ) , "quit" , "q" , "exit" ) ; cmdRegistry . registerHandler ( new ReadAttributeHandler ( this ) , "read-attribute" ) ; cmdRegistry . registerHandler ( new ReadOperationHandler ( this ) , "read-operation" ) ; cmdRegistry . registerHandler ( new VersionHandler ( ) , "version" ) ; cmdRegistry . registerHandler ( new DeployHandler ( this ) , "deploy" ) ; cmdRegistry . registerHandler ( new UndeployHandler ( this ) , "undeploy" ) ; cmdRegistry . registerHandler ( new DeploymentInfoHandler ( this ) , "deployment-info" ) ; cmdRegistry . registerHandler ( new BatchHandler ( this ) , "batch" ) ; cmdRegistry . registerHandler ( new BatchDiscardHandler ( ) , "discard-batch" ) ; cmdRegistry . registerHandler ( new BatchListHandler ( ) , "list-batch" ) ; cmdRegistry . registerHandler ( new BatchHoldbackHandler ( ) , "holdback-batch" ) ; cmdRegistry . registerHandler ( new BatchRunHandler ( this ) , "run-batch" ) ; cmdRegistry . registerHandler ( new BatchClearHandler ( ) , "clear-batch" ) ; cmdRegistry . registerHandler ( new BatchRemoveLineHandler ( ) , "remove-batch-line" ) ; cmdRegistry . registerHandler ( new BatchMoveLineHandler ( ) , "move-batch-line" ) ; cmdRegistry . registerHandler ( new BatchEditLineHandler ( ) , "edit-batch-line" ) ; cmdRegistry . registerHandler ( new TryHandler ( ) , "try" ) ; cmdRegistry . registerHandler ( new CatchHandler ( ) , "catch" ) ; cmdRegistry . registerHandler ( new FinallyHandler ( ) , "finally" ) ; cmdRegistry . registerHandler ( new EndTryHandler ( ) , "end-try" ) ; cmdRegistry . registerHandler ( new IfHandler ( ) , "if" ) ; cmdRegistry . registerHandler ( new ElseHandler ( ) , "else" ) ; cmdRegistry . registerHandler ( new EndIfHandler ( ) , "end-if" ) ; GenericTypeOperationHandler dsHandler = new GenericTypeOperationHandler ( this , "//subsystem=datasources//data-source" , null ) ; final DefaultCompleter driverNameCompleter = new DefaultCompleter ( JDBCDriverNameProvider . INSTANCE ) ; dsHandler . addValueCompleter ( DRIVER_NAME , driverNameCompleter ) ; cmdRegistry . registerHandler ( dsHandler , "data-source" ) ; GenericTypeOperationHandler xaDsHandler = new GenericTypeOperationHandler ( this , "//subsystem=datasources//xa-data-source" , null ) ; xaDsHandler . addValueCompleter ( DRIVER_NAME , driverNameCompleter ) ; final XADataSourceAddCompositeHandler xaDsAddHandler = new XADataSourceAddCompositeHandler ( this , "//subsystem=datasources//xa-data-source" ) ; xaDsAddHandler . addValueCompleter ( DRIVER_NAME , driverNameCompleter ) ; xaDsHandler . addHandler ( "add" , xaDsAddHandler ) ; cmdRegistry . registerHandler ( xaDsHandler , "xa-data-source" ) ; cmdRegistry . registerHandler ( new JDBCDriverInfoHandler ( this ) , "jdbc-driver-info" ) ; cmdRegistry . registerHandler ( new GenericTypeOperationHandler ( this , "//subsystem=messaging//hornetq-server=default//jms-queue" , "queue-address" ) , "jms-queue" ) ; cmdRegistry . registerHandler ( new GenericTypeOperationHandler ( this , "//subsystem=messaging//hornetq-server=default//jms-topic" , "topic-address" ) , "jms-topic" ) ; cmdRegistry . registerHandler ( new GenericTypeOperationHandler ( this , "//subsystem=messaging//hornetq-server=default//connection-factory" , null ) , "connection-factory" ) ; cmdRegistry . registerHandler ( new CreateJmsResourceHandler ( this ) , false , "create-jms-resource" ) ; cmdRegistry . registerHandler ( new DeleteJmsResourceHandler ( this ) , false , "delete-jms-resource" ) ; final GenericTypeOperationHandler rolloutPlan = new GenericTypeOperationHandler ( this , "//management-client-content=rollout-plans//rollout-plan" , null ) ; rolloutPlan . addValueConverter ( "content" , INSTANCE ) ; rolloutPlan . addValueCompleter ( "content" , RolloutPlanCompleter . INSTANCE ) ; cmdRegistry . registerHandler ( rolloutPlan , "rollout-plan" ) ; cmdRegistry . registerHandler ( new ArchiveHandler ( this ) , false , "archive" ) ; } public int getExitCode ( ) { }

Fix:
cmdRegistry . registerHandler ( new org . jboss . as . cli . handlers . HelpHandler ( cmdRegistry ) , "help" , "h" ) ;