Buggy code:
private String jndiName ; private String txSupport ; private int minPoolSize ; private int maxPoolSize ; public PooledConnectionFactoryService ( String name , List < String > connectors , String discoveryGroupName , List < PooledConnectionFactoryConfigProperties > adapterParams , String jndiName , String txSupport , int minPoolSize , int maxPoolSize ) { } public Void getValue ( ) throws IllegalArgumentException , IllegalStateException { } public void start ( StartContext context ) throws StartException { } private void createService ( ServiceTarget serviceTarget , ServiceContainer container ) throws Exception { InputStream is = null ; InputStream isIj = null ; List < ConfigProperty > properties = new ArrayList < ConfigProperty > ( ) ; try { StringBuilder connectorClassname = new StringBuilder ( ) ; StringBuilder connectorParams = new StringBuilder ( ) ; for ( String connector : connectors ) { TransportConfiguration tc = hornetQService . getValue ( ) . getConfiguration ( ) . getConnectorConfigurations ( ) . get ( connector ) ; if ( tc == null ) { throw MessagingMessages . MESSAGES . connectorNotDefined ( connector ) ; } if ( ( connectorClassname . length ( ) ) > 0 ) { connectorClassname . append ( "," ) ; connectorParams . append ( "," ) ; } connectorClassname . append ( tc . getFactoryClassName ( ) ) ; Map < String , Object > params = tc . getParams ( ) ; boolean multiple = false ; for ( Map . Entry < String , Object > entry : params . entrySet ( ) ) { if ( multiple ) { connectorParams . append ( ";" ) ; } connectorParams . append ( entry . getKey ( ) ) . append ( "=" ) . append ( entry . getValue ( ) ) ; multiple = true ; } } if ( ( connectorClassname . length ( ) ) > 0 ) { properties . add ( PooledConnectionFactoryService . simpleProperty15 ( PooledConnectionFactoryService . CONNECTOR_CLASSNAME , PooledConnectionFactoryService . STRING_TYPE , connectorClassname . toString ( ) ) ) ; } if ( ( connectorParams . length ( ) ) > 0 ) { properties . add ( PooledConnectionFactoryService . simpleProperty15 ( PooledConnectionFactoryService . CONNECTION_PARAMETERS , PooledConnectionFactoryService . STRING_TYPE , connectorParams . toString ( ) ) ) ; } if ( ( discoveryGroupName ) != null ) { DiscoveryGroupConfiguration discoveryGroupConfiguration = hornetQService . getValue ( ) . getConfiguration ( ) . getDiscoveryGroupConfigurations ( ) . get ( discoveryGroupName ) ; properties . add ( PooledConnectionFactoryService . simpleProperty15 ( PooledConnectionFactoryService . GROUP_ADDRESS , PooledConnectionFactoryService . STRING_TYPE , discoveryGroupConfiguration . getGroupAddress ( ) ) ) ; properties . add ( PooledConnectionFactoryService . simpleProperty15 ( PooledConnectionFactoryService . DISCOVERY_INITIAL_WAIT_TIMEOUT , PooledConnectionFactoryService . LONG_TYPE , ( "" + ( discoveryGroupConfiguration . getDiscoveryInitialWaitTimeout ( ) ) ) ) ) ; properties . add ( PooledConnectionFactoryService . simpleProperty15 ( PooledConnectionFactoryService . GROUP_PORT , PooledConnectionFactoryService . INTEGER_TYPE , ( "" + ( discoveryGroupConfiguration . getGroupPort ( ) ) ) ) ) ; properties . add ( PooledConnectionFactoryService . simpleProperty15 ( PooledConnectionFactoryService . REFRESH_TIMEOUT , PooledConnectionFactoryService . LONG_TYPE , ( "" + ( discoveryGroupConfiguration . getRefreshTimeout ( ) ) ) ) ) ; properties . add ( PooledConnectionFactoryService . simpleProperty15 ( PooledConnectionFactoryService . DISCOVERY_LOCAL_BIND_ADDRESS , PooledConnectionFactoryService . STRING_TYPE , ( "" + ( discoveryGroupConfiguration . getLocalBindAddress ( ) ) ) ) ) ; } boolean hasReconnect = false ; <START_BUG> final String reconnectName = Common . RECONNECT_ATTEMPTS_PROP_NAME ; <END_BUG> for ( PooledConnectionFactoryConfigProperties adapterParam : adapterParams ) { hasReconnect |= reconnectName . equals ( adapterParam . getName ( ) ) ; properties . add ( PooledConnectionFactoryService . simpleProperty15 ( adapterParam . getName ( ) , adapterParam . getType ( ) , adapterParam . getValue ( ) ) ) ; } if ( ! hasReconnect ) { properties . add ( PooledConnectionFactoryService . simpleProperty15 ( reconnectName , Integer . class . getName ( ) , PooledConnectionFactoryService . DEFAULT_MAX_RECONNECTS ) ) ; } TransactionManagerLocator . container = container ; AS7RecoveryRegistry . container = container ; properties . add ( PooledConnectionFactoryService . simpleProperty15 ( PooledConnectionFactoryService . TRANSACTION_MANAGER_LOCATOR_CLASS , PooledConnectionFactoryService . STRING_TYPE , TransactionManagerLocator . class . getName ( ) ) ) ; properties . add ( PooledConnectionFactoryService . simpleProperty15 ( PooledConnectionFactoryService . TRANSACTION_MANAGER_LOCATOR_METHOD , PooledConnectionFactoryService . STRING_TYPE , "getTransactionManager" ) ) ; OutboundResourceAdapter outbound = PooledConnectionFactoryService . createOutbound ( ) ; InboundResourceAdapter inbound = createInbound ( ) ; ResourceAdapter1516 ra = createResourceAdapter15 ( properties , outbound , inbound ) ; Connector15 cmd = PooledConnectionFactoryService . createConnector15 ( ra ) ; CommonConnDef common = PooledConnectionFactoryService . createConnDef ( jndiName , minPoolSize , maxPoolSize ) ; IronJacamar ijmd = PooledConnectionFactoryService . createIron ( common , txSupport ) ; ResourceAdapterActivatorService activator = new ResourceAdapterActivatorService ( cmd , ijmd , PooledConnectionFactoryService . class . getClassLoader ( ) , name ) ; serviceTarget . addService ( RESOURCE_ADAPTER_ACTIVATOR_SERVICE . append ( name ) , activator ) . addDependency ( IRONJACAMAR_MDR , AS7MetadataRepository . class , activator . getMdrInjector ( ) ) . addDependency ( RA_REPOSITORY_SERVICE , ResourceAdapterRepository . class , activator . getRaRepositoryInjector ( ) ) . addDependency ( MANAGEMENT_REPOSITORY_SERVICE , ManagementRepository . class , activator . getManagementRepositoryInjector ( ) ) . addDependency ( RESOURCE_ADAPTER_REGISTRY_SERVICE , ResourceAdapterDeploymentRegistry . class , activator . getRegistryInjector ( ) ) . addDependency ( TRANSACTION_INTEGRATION_SERVICE , TransactionIntegration . class , activator . getTxIntegrationInjector ( ) ) . addDependency ( CONNECTOR_CONFIG_SERVICE , JcaSubsystemConfiguration . class , activator . getConfigInjector ( ) ) . addDependency ( SERVICE_NAME , SubjectFactory . class , activator . getSubjectFactoryInjector ( ) ) . addDependency ( CCM_SERVICE , CachedConnectionManager . class , activator . getCcmInjector ( ) ) . addDependency ( NamingService . SERVICE_NAME ) . addDependency ( JBOSS_TXN_TRANSACTION_MANAGER ) . setInitialMode ( ACTIVE ) . install ( ) ; serviceTarget . addService ( RESOURCE_ADAPTER_DEPLOYER_SERVICE_PREFIX . append ( name ) , NULL ) . install ( ) ; } finally { if ( is != null ) is . close ( ) ;

Fix:
final String reconnectName = Pooled . RECONNECT_ATTEMPTS_PROP_NAME ;