private SocketFactory getFactory ( int index ) throws ConnectException { synchronized ( mFactories ) { int size = mFactories . size ( ) ; if ( size <= 0 ) { throw new ConnectException ( "No SocketFactories available" ) ; } return ( SocketFactory ) mFactories . get ( index % size ) ; } }
The provided index must be positive but it can be out of the factory list bounds .