Buggy code:
public class SolrDispatchFilter implements Filter { private static final String CONNECTION_HEADER = "Connection" ; private static final String TRANSFER_ENCODING_HEADER = "Transfer-Encoding" ; final Logger log ; protected volatile CoreContainer cores ; protected String pathPrefix = null ; protected String abortErrorMessage = null ; protected final Map < SolrConfig , SolrRequestParsers > parsers = new WeakHashMap < SolrConfig , SolrRequestParsers > ( ) ; private static final Charset UTF8 = Charset . forName ( "UTF-8" ) ; public SolrDispatchFilter ( ) { } @ Override public void init ( FilterConfig config ) throws ServletException { } private ConfigSolr loadConfigSolr ( SolrResourceLoader loader ) { } protected CoreContainer createCoreContainer ( ) { } public CoreContainer getCores ( ) { } @ Override public void destroy ( ) { } @ Override public void doFilter ( ServletRequest request , ServletResponse response , FilterChain chain ) throws IOException , ServletException { } public void doFilter ( ServletRequest request , ServletResponse response , FilterChain chain , boolean retry ) throws IOException , ServletException { } private void processAliases ( SolrQueryRequest solrReq , Aliases aliases , List < String > collectionsList ) { } private void remoteQuery ( String coreUrl , HttpServletRequest req , SolrQueryRequest solrReq , HttpServletResponse resp ) throws IOException { } private String getRemotCoreUrl ( CoreContainer cores , String collectionName , String origCorename ) { ClusterState clusterState = cores . getZkController ( ) . getClusterState ( ) ; Collection < Slice > slices = clusterState . getActiveSlices ( collectionName ) ; boolean byCoreName = false ; if ( slices == null ) { byCoreName = true ; Set < String > collections = clusterState . getCollections ( ) ; for ( String collection : collections ) { slices = new ArrayList < Slice > ( ) ; <START_BUG> slices . addAll ( clusterState . getActiveSlices ( collection ) ) ; <END_BUG> } } if ( ( slices == null ) || ( ( slices . size ( ) ) == 0 ) ) { return null ; } Set < String > liveNodes = clusterState . getLiveNodes ( ) ; Iterator < Slice > it = slices . iterator ( ) ; while ( it . hasNext ( ) ) { Slice slice = it . next ( ) ; Map < String , Replica > sliceShards = slice . getReplicasMap ( ) ; for ( ZkNodeProps nodeProps : sliceShards . values ( ) ) { ZkCoreNodeProps coreNodeProps = new ZkCoreNodeProps ( nodeProps ) ; if ( ( liveNodes . contains ( coreNodeProps . getNodeName ( ) ) ) && ( coreNodeProps . getState ( ) . equals ( ACTIVE ) ) ) { if ( byCoreName && ( ! ( collectionName . equals ( coreNodeProps . getCoreName ( ) ) ) ) ) { continue ; } if ( coreNodeProps . getBaseUrl ( ) . equals ( cores . getZkController ( ) . getBaseUrl ( ) ) ) { continue ; } String coreUrl ; if ( origCorename != null ) { coreUrl = ( ( coreNodeProps . getBaseUrl ( ) ) + "//" ) + origCorename ; } else { coreUrl = coreNodeProps . getCoreUrl ( ) ; if ( coreUrl . endsWith ( "//" ) ) { coreUrl = coreUrl . substring ( 0 , ( ( coreUrl . length ( ) ) - 1 ) ) ; } } return coreUrl ; } } } return null ; } private SolrCore getCoreByCollection ( CoreContainer cores , String corename , String path ) { } private SolrCore checkProps ( CoreContainer cores , String path , ZkNodeProps zkProps ) { } private void handleAdminRequest ( HttpServletRequest req , ServletResponse response , SolrRequestHandler handler , SolrQueryRequest solrReq ) throws IOException { } private void writeResponse ( SolrQueryResponse solrRsp , ServletResponse response , QueryResponseWriter responseWriter , SolrQueryRequest solrReq , Method reqMethod ) throws IOException { } protected void execute ( HttpServletRequest req , SolrRequestHandler handler , SolrQueryRequest sreq , SolrQueryResponse rsp ) { } protected void sendError ( SolrCore core , SolrQueryRequest req , ServletRequest request , HttpServletResponse response , Throwable ex ) throws IOException { } public void setPathPrefix ( String pathPrefix ) { } public String getPathPrefix ( ) { } }

Fix:
slices . addAll ( clusterState . getSlices ( collection ) ) ;