Buggy code:
public abstract class AbstractDataSourceService implements Service < DataSource > { public static final ServiceName SERVICE_NAME_BASE = JBOSS . append ( "data-source" ) ; private static final DeployersLogger DEPLOYERS_LOGGER = Logger . getMessageLogger ( DeployersLogger . class , AbstractDataSourceService . AS7DataSourceDeployer . class . getName ( ) ) ; protected final InjectedValue < TransactionIntegration > transactionIntegrationValue = new InjectedValue < TransactionIntegration > ( ) ; private final InjectedValue < Driver > driverValue = new InjectedValue < Driver > ( ) ; private final InjectedValue < ManagementRepository > managementRepositoryValue = new InjectedValue < ManagementRepository > ( ) ; private final InjectedValue < SubjectFactory > subjectFactory = new InjectedValue < SubjectFactory > ( ) ; private final InjectedValue < DriverRegistry > driverRegistry = new InjectedValue < DriverRegistry > ( ) ; private final InjectedValue < CachedConnectionManager > ccmValue = new InjectedValue < CachedConnectionManager > ( ) ; private final String jndiName ; protected CommonDeployment deploymentMD ; private DataSource sqlDataSource ; private final ClassLoader classLoader ; protected AbstractDataSourceService ( final String jndiName , final ClassLoader classLoader ) { } public synchronized void start ( StartContext startContext ) throws StartException { } protected abstract AbstractDataSourceService . AS7DataSourceDeployer getDeployer ( ) throws ValidateException { } public synchronized void stop ( StopContext stopContext ) { } public CommonDeployment getDeploymentMD ( ) { } public synchronized DataSource getValue ( ) throws IllegalArgumentException , IllegalStateException { } public Injector < TransactionIntegration > getTransactionIntegrationInjector ( ) { } public Injector < Driver > getDriverInjector ( ) { } public Injector < ManagementRepository > getManagementRepositoryInjector ( ) { } public Injector < DriverRegistry > getDriverRegistryInjector ( ) { } public Injector < SubjectFactory > getSubjectFactoryInjector ( ) { } public Injector < CachedConnectionManager > getCcmInjector ( ) { } protected String buildConfigPropsString ( Map < String , String > configProps ) { } protected TransactionIntegration getTransactionIntegration ( ) { } private ClassLoader driverClassLoader ( ) { } protected class AS7DataSourceDeployer extends AbstractDsDeployer { private final DataSource dataSourceConfig ; private final XaDataSource xaDataSourceConfig ; private ServiceContainer serviceContainer ; public AS7DataSourceDeployer ( XaDataSource xaDataSourceConfig ) { } public AS7DataSourceDeployer ( org . jboss . jca . common . api . metadata . ds . DataSource dataSourceConfig ) { } public CommonDeployment deploy ( ServiceContainer serviceContainer ) throws DeployException { } @ Override protected ClassLoader getDeploymentClassLoader ( String uniqueId ) { } @ Override protected String [ ] bindConnectionFactory ( String deployment , final String jndi , Object cf ) throws Throwable { } @ Override protected Object initAndInject ( String className , List < ? extends ConfigProperty > configs , ClassLoader cl ) throws DeployException { } @ Override protected SubjectFactory getSubjectFactory ( String securityDomain ) throws DeployException { } @ Override public CachedConnectionManager getCachedConnectionManager ( ) { <START_BUG> return ccmValue . getValue ( ) ; <END_BUG> } @ Override public ManagementRepository getManagementRepository ( ) { } @ Override protected void initAndInjectClassLoaderPlugin ( ManagedConnectionFactory mcf , CommonDataSource dsMetadata ) throws DeployException { } @ Override public TransactionIntegration getTransactionIntegration ( ) { } @ Override protected ManagedConnectionFactory createMcf ( XaDataSource arg0 , String arg1 , ClassLoader arg2 ) throws NotFoundException , DeployException { } @ Override protected ManagedConnectionFactory createMcf ( org . jboss . jca . common . api . metadata . ds . DataSource arg0 , String arg1 , ClassLoader arg2 ) throws NotFoundException , DeployException { } private void setMcfProperties ( final BaseWrapperManagedConnectionFactory managedConnectionFactory , CommonDataSource dataSourceConfig , final Statement statement ) { } @ Override protected String buildJndiName ( String rawJndiName , Boolean javaContext ) { } @ Override protected DeployersLogger getLogger ( ) { } } private class WildFlyXaMCF extends XAManagedConnectionFactory { private static final long serialVersionUID = 4876371551002746953L ; public void setXaProps ( Map < String , String > inputProperties ) { } public void setTransactionSynchronizationRegistry ( javax . transaction . TransactionSynchronizationRegistry tsr ) { } } private class WildFlyLocalMCF extends LocalManagedConnectionFactory { private static final long serialVersionUID = 4876371551002746953L ; public void setTransactionSynchronizationRegistry ( javax . transaction . TransactionSynchronizationRegistry tsr ) { } } }

Fix:
return ccmValue . getOptionalValue ( ) ;