Buggy code:
public abstract class AbstractDataSourceAdd extends AbstractAddStepHandler { protected void performRuntime ( final OperationContext context , ModelNode operation , ModelNode model , final ServiceVerificationHandler verificationHandler , final List < ServiceController < ? > > controllers ) throws OperationFailedException { final ModelNode address = operation . require ( OP_ADDR ) ; final String dsName = PathAddress . pathAddress ( address ) . getLastElement ( ) . getValue ( ) ; <START_BUG> final String jndiName = ( operation . hasDefined ( Constants . JNDINAME . getName ( ) ) ) ? operation . get ( Constants . JNDINAME . getName ( ) ) . asString ( ) : dsName ; <END_BUG> final ServiceTarget serviceTarget = context . getServiceTarget ( ) ; boolean enabled = false ; ModelNode node = operation . require ( Constants . DATASOURCE_DRIVER . getName ( ) ) ; AbstractDataSourceService dataSourceService = createDataSourceService ( dsName ) ; final ManagementResourceRegistration registration = context . getResourceRegistrationForUpdate ( ) ; final ServiceName dataSourceServiceName = SERVICE_NAME_BASE . append ( jndiName ) ; final ServiceBuilder < ? > dataSourceServiceBuilder = serviceTarget . addService ( dataSourceServiceName , dataSourceService ) . addDependency ( TRANSACTION_INTEGRATION_SERVICE , TransactionIntegration . class , dataSourceService . getTransactionIntegrationInjector ( ) ) . addDependency ( MANAGEMENT_REPOSISTORY_SERVICE , ManagementRepository . class , dataSourceService . getmanagementRepositoryInjector ( ) ) . addDependency ( SERVICE_NAME , SubjectFactory . class , dataSourceService . getSubjectFactoryInjector ( ) ) . addDependency ( JDBC_DRIVER_REGISTRY_SERVICE , DriverRegistry . class , dataSourceService . getDriverRegistryInjector ( ) ) . addDependency ( CCM_SERVICE , CachedConnectionManager . class , dataSourceService . getCcmInjector ( ) ) . addDependency ( IDLE_REMOVER_SERVICE ) . addDependency ( CONNECTION_VALIDATOR_SERVICE ) . addDependency ( NamingService . SERVICE_NAME ) ; dataSourceServiceBuilder . addListener ( new DataSourceStatisticsListener ( registration , dsName ) ) ; startConfigAndAddDependency ( dataSourceServiceBuilder , dataSourceService , dsName , serviceTarget , operation , verificationHandler ) ; final String driverName = node . asString ( ) ; final ServiceName driverServiceName = JBOSS . append ( "jdbc-driver" , driverName . replaceAll ( "\\." , "_" ) ) ; if ( ! ( context . isBooting ( ) ) ) { final ServiceRegistry registry = context . getServiceRegistry ( true ) ; final ServiceController < ? > dataSourceController = registry . getService ( driverServiceName ) ; if ( ( driverServiceName != null ) && ( dataSourceController != null ) ) { dataSourceServiceBuilder . addDependency ( driverServiceName , Driver . class , dataSourceService . getDriverInjector ( ) ) ; } else { throw new OperationFailedException ( ConnectorMessages . MESSAGES . driverNotPresent ( driverName ) ) ; } } else { dataSourceServiceBuilder . addDependency ( driverServiceName , Driver . class , dataSourceService . getDriverInjector ( ) ) ; } dataSourceServiceBuilder . setInitialMode ( NEVER ) ; controllers . add ( dataSourceServiceBuilder . install ( ) ) ; } static String cleanupJavaContext ( String jndiName ) { } protected abstract void startConfigAndAddDependency ( ServiceBuilder < ? > dataSourceServiceBuilder , AbstractDataSourceService dataSourceService , String jndiName , ServiceTarget serviceTarget , final ModelNode operation , final ServiceVerificationHandler serviceVerificationHandler ) throws OperationFailedException { } protected abstract void populateModel ( final ModelNode operation , final ModelNode model ) throws OperationFailedException { } protected abstract AbstractDataSourceService createDataSourceService ( final String jndiName ) throws OperationFailedException { } static void populateAddModel ( final ModelNode operation , final ModelNode modelNode , final String connectionPropertiesProp , final SimpleAttributeDefinition [ ] attributes ) throws OperationFailedException { } }

Fix:
final String jndiName = model . get ( Constants . JNDINAME . getName ( ) ) . asString ( ) ;