Buggy code:
public class JndiViewOperation implements OperationStepHandler { public static final JndiViewOperation INSTANCE = new JndiViewOperation ( ) ; public static final String OPERATION_NAME = "jndi-view" ; public void execute ( final OperationContext context , final ModelNode operation ) throws OperationFailedException { final ModelNode resultNode = context . getResult ( ) ; if ( context . isNormalServer ( ) ) { context . addStep ( new OperationStepHandler ( ) { public void execute ( final OperationContext context , final ModelNode operation ) throws OperationFailedException { final ServiceRegistry serviceRegistry = context . getServiceRegistry ( false ) ; final ModelNode contextsNode = resultNode . get ( "java:<seq2seq4repair_space>contexts" ) ; final ServiceController < ? > javaContextService = serviceRegistry . getService ( JAVA_CONTEXT_SERVICE_NAME ) ; final NamingStore javaContextNamingStore = NamingStore . class . cast ( javaContextService . getValue ( ) ) ; try { addEntries ( contextsNode . get ( "java:" ) , new org . jboss . as . naming . NamingContext ( javaContextNamingStore , null ) ) ; } catch ( NamingException e ) { throw new OperationFailedException ( e , new ModelNode ( ) . set ( ROOT_LOGGER . failedToReadContextEntries ( "java:" ) ) ) ; } final ServiceController < ? > jbossContextService = serviceRegistry . getService ( JBOSS_CONTEXT_SERVICE_NAME ) ; final NamingStore jbossContextNamingStore = NamingStore . class . cast ( jbossContextService . getValue ( ) ) ; try { addEntries ( contextsNode . get ( "java:jboss" ) , new org . jboss . as . naming . NamingContext ( jbossContextNamingStore , null ) ) ; } catch ( NamingException e ) { throw new OperationFailedException ( e , new ModelNode ( ) . set ( ROOT_LOGGER . failedToReadContextEntries ( "java:jboss" ) ) ) ; } final ServiceController < ? > exportedContextService = serviceRegistry . getService ( EXPORTED_CONTEXT_SERVICE_NAME ) ; final NamingStore exportedContextNamingStore = NamingStore . class . cast ( exportedContextService . getValue ( ) ) ; try { addEntries ( contextsNode . get ( "java:jboss//exported" ) , new org . jboss . as . naming . NamingContext ( exportedContextNamingStore , null ) ) ; } catch ( NamingException e ) { throw new OperationFailedException ( e , new ModelNode ( ) . set ( ROOT_LOGGER . failedToReadContextEntries ( "java:jboss//exported" ) ) ) ; } final ServiceController < ? > globalContextService = serviceRegistry . getService ( GLOBAL_CONTEXT_SERVICE_NAME ) ; final NamingStore globalContextNamingStore = NamingStore . class . cast ( globalContextService . getValue ( ) ) ; try { addEntries ( contextsNode . get ( "java:global" ) , new org . jboss . as . naming . NamingContext ( globalContextNamingStore , null ) ) ; } catch ( NamingException e ) { throw new OperationFailedException ( e , new ModelNode ( ) . set ( ROOT_LOGGER . failedToReadContextEntries ( "java:global" ) ) ) ; } final ServiceController < ? > extensionRegistryController = serviceRegistry . getService ( SERVICE_NAME ) ; if ( extensionRegistryController != null ) { final JndiViewExtensionRegistry extensionRegistry = JndiViewExtensionRegistry . class . cast ( extensionRegistryController . getValue ( ) ) ; for ( JndiViewExtension extension : extensionRegistry . getExtensions ( ) ) { extension . execute ( new JndiViewExtensionContext ( ) { public OperationContext getOperationContext ( ) { return context ; } public ModelNode getResult ( ) { return resultNode ; } public void addEntries ( ModelNode current , Context context ) throws NamingException { JndiViewOperation . this . addEntries ( current , context ) ; } } ) ; } } context . completeStep ( NOOP_ROLLBACK_HANDLER ) ; } } , RUNTIME ) ; } else { <START_BUG> throw new OperationFailedException ( new ModelNode ( ) . set ( ROOT_LOGGER . jndiViewNotAvailable ( ) ) ) ; <END_BUG> } context . stepCompleted ( ) ; } private void addEntries ( final ModelNode current , final Context context ) throws NamingException { } }

Fix:
throw new OperationFailedException ( ROOT_LOGGER . jndiViewNotAvailable ( ) ) ;