Buggy code:
public class CreateJmsResourceHandler extends BatchModeCommandHandler { public CreateJmsResourceHandler ( ) { } @ Override public ModelNode buildRequest ( CommandContext ctx ) throws OperationFormatException { try { <START_BUG> if ( ! ( ctx . getParsedArguments ( ) . hasProperties ( ) ) ) { <END_BUG> throw new OperationFormatException ( "Arguments<seq2seq4repair_space>are<seq2seq4repair_space>missing" ) ; } } catch ( CommandFormatException e ) { throw new OperationFormatException ( e . getLocalizedMessage ( ) ) ; } String restype = null ; String propsStr = null ; String jndiName = null ; String [ ] args = ctx . getArgumentsString ( ) . split ( "\\s+" ) ; int i = 0 ; while ( i < ( args . length ) ) { String arg = args [ ( i ++ ) ] ; if ( arg . equals ( "--restype" ) ) { if ( i < ( args . length ) ) { restype = args [ ( i ++ ) ] ; } } else if ( arg . equals ( "--target" ) ) { } else if ( arg . equals ( "--description" ) ) { } else if ( arg . equals ( "--property" ) ) { if ( i < ( args . length ) ) { propsStr = args [ ( i ++ ) ] ; } } else if ( arg . equals ( "--enabled" ) ) { } else { jndiName = arg ; } } if ( restype == null ) { throw new OperationFormatException ( "Required<seq2seq4repair_space>parameter<seq2seq4repair_space>--restype<seq2seq4repair_space>is<seq2seq4repair_space>missing." ) ; } if ( jndiName == null ) { throw new OperationFormatException ( "JNDI<seq2seq4repair_space>name<seq2seq4repair_space>is<seq2seq4repair_space>missing." ) ; } String name = null ; final Map < String , String > props ; if ( propsStr != null ) { props = new HashMap < String , String > ( ) ; String [ ] propsArr = propsStr . split ( ":" ) ; for ( String prop : propsArr ) { int equalsIndex = prop . indexOf ( '=' ) ; if ( ( equalsIndex < 0 ) || ( equalsIndex == ( ( prop . length ( ) ) - 1 ) ) ) { throw new OperationFormatException ( ( ( "Failed<seq2seq4repair_space>to<seq2seq4repair_space>parse<seq2seq4repair_space>property<seq2seq4repair_space>'" + prop ) + "'" ) ) ; } String propName = prop . substring ( 0 , equalsIndex ) . trim ( ) ; String propValue = prop . substring ( ( equalsIndex + 1 ) ) . trim ( ) ; if ( propName . isEmpty ( ) ) { throw new OperationFormatException ( ( ( "Failed<seq2seq4repair_space>to<seq2seq4repair_space>parse<seq2seq4repair_space>property<seq2seq4repair_space>'" + prop ) + "'" ) ) ; } if ( ( propName . equals ( "imqDestinationName" ) ) || ( propName . equalsIgnoreCase ( "name" ) ) ) { name = propValue ; } else if ( "ClientId" . equals ( propName ) ) { props . put ( "client-id" , propValue ) ; } } } else { props = Collections . emptyMap ( ) ; } if ( name == null ) { name = jndiName . replace ( '//' , '_' ) ; } if ( restype . equals ( "javax.jms.Queue" ) ) { DefaultOperationRequestBuilder builder = new DefaultOperationRequestBuilder ( ) ; builder . addNode ( "subsystem" , "messaging" ) ; builder . addNode ( "jms-queue" , name ) ; builder . setOperationName ( "add" ) ; builder . getModelNode ( ) . get ( "entries" ) . add ( jndiName ) ; for ( String prop : props . keySet ( ) ) { builder . addProperty ( prop , props . get ( prop ) ) ; } return builder . buildRequest ( ) ; } else if ( restype . equals ( "javax.jms.Topic" ) ) { DefaultOperationRequestBuilder builder = new DefaultOperationRequestBuilder ( ) ; builder . addNode ( "subsystem" , "messaging" ) ; builder . addNode ( "jms-topic" , name ) ; builder . setOperationName ( "add" ) ; builder . getModelNode ( ) . get ( "entries" ) . add ( jndiName ) ; for ( String prop : props . keySet ( ) ) { builder . addProperty ( prop , props . get ( prop ) ) ; } return builder . buildRequest ( ) ; } else if ( ( ( restype . equals ( "javax.jms.ConnectionFactory" ) ) || ( restype . equals ( "javax.jms.TopicConnectionFactory" ) ) ) || ( restype . equals ( "javax.jms.QueueConnectionFactory" ) ) ) { DefaultOperationRequestBuilder builder = new DefaultOperationRequestBuilder ( ) ; builder . addNode ( "subsystem" , "messaging" ) ; builder . addNode ( "connection-factory" , name ) ; builder . setOperationName ( "add" ) ; builder . getModelNode ( ) . get ( "entries" ) . add ( jndiName ) ; for ( String prop : props . keySet ( ) ) { builder . addProperty ( prop , props . get ( prop ) ) ; } return builder . buildRequest ( ) ; } else { throw new OperationFormatException ( ( ( "Resource<seq2seq4repair_space>type<seq2seq4repair_space>" + restype ) + "<seq2seq4repair_space>isn't<seq2seq4repair_space>supported." ) ) ; } } }

Fix:
if ( ! ( ctx . getParsedCommandLine ( ) . hasProperties ( ) ) ) {