Buggy code:
public class QueryComponent extends SearchComponent { public static final String COMPONENT_NAME = "query" ; @ Override public void prepare ( ResponseBuilder rb ) throws IOException { SolrQueryRequest req = rb . req ; SolrParams params = req . getParams ( ) ; if ( ! ( params . getBool ( QueryComponent . COMPONENT_NAME , true ) ) ) { return ; } SolrQueryResponse rsp = rb . rsp ; String fl = params . get ( FL ) ; int fieldFlags = 0 ; if ( fl != null ) { fieldFlags |= SolrPluginUtils . setReturnFields ( fl , rsp ) ; } rb . setFieldFlags ( fieldFlags ) ; String defType = params . get ( DEFTYPE ) ; defType = ( defType == null ) ? QParserPlugin . DEFAULT_QTYPE : defType ; if ( ( rb . getQueryString ( ) ) == null ) { rb . setQueryString ( params . get ( Q ) ) ; } try { QParser parser = QParser . getParser ( rb . getQueryString ( ) , defType , req ) ; rb . setQuery ( parser . getQuery ( ) ) ; rb . setSortSpec ( parser . getSort ( true ) ) ; rb . setQparser ( parser ) ; String [ ] fqs = req . getParams ( ) . getParams ( FQ ) ; if ( ( fqs != null ) && ( ( fqs . length ) != 0 ) ) { List < Query > filters = rb . getFilters ( ) ; if ( filters == null ) { filters = new ArrayList < Query > ( ) ; rb . setFilters ( filters ) ; } for ( String fq : fqs ) { if ( ( fq != null ) && ( ( fq . trim ( ) . length ( ) ) != 0 ) ) { QParser fqp = QParser . getParser ( fq , null , req ) ; filters . add ( fqp . getQuery ( ) ) ; } } } } catch ( ParseException e ) { throw new org . apache . solr . common . SolrException ( ErrorCode . BAD_REQUEST , e ) ; } rb . isDistrib = params . getBool ( "distrib" , false ) ; String shards = params . get ( SHARDS ) ; <START_BUG> boolean hasShardURL = ( shards != null ) && ( ( shards . charAt ( '//' ) ) > 0 ) ; <END_BUG> rb . isDistrib = hasShardURL | ( rb . isDistrib ) ; if ( rb . isDistrib ) { CloudState cloudState = null ; Map < String , Slice > slices = null ; if ( shards != null ) { List < String > lst = StrUtils . splitSmart ( shards , "," , true ) ; rb . shards = lst . toArray ( new String [ lst . size ( ) ] ) ; rb . slices = new String [ rb . shards . length ] ; for ( int i = 0 ; i < ( rb . shards . length ) ; i ++ ) { if ( ( rb . shards [ i ] . indexOf ( '//' ) ) < 0 ) { rb . slices [ i ] = rb . shards [ i ] ; rb . shards [ i ] = null ; } } } else { cloudState = req . getCore ( ) . getCoreDescriptor ( ) . getCoreContainer ( ) . getZooKeeperController ( ) . getCloudState ( ) ; slices = cloudState . getSlices ( req . getCore ( ) . getCoreDescriptor ( ) . getName ( ) ) ; rb . slices = slices . keySet ( ) . toArray ( new String [ slices . size ( ) ] ) ; } for ( int i = 0 ; i < ( rb . shards . length ) ; i ++ ) { if ( ( rb . shards [ i ] ) == null ) { if ( cloudState == null ) { cloudState = req . getCore ( ) . getCoreDescriptor ( ) . getCoreContainer ( ) . getZooKeeperController ( ) . getCloudState ( ) ; slices = cloudState . getSlices ( req . getCore ( ) . getCoreDescriptor ( ) . getName ( ) ) ; } String sliceName = rb . slices [ i ] ; Slice slice = slices . get ( sliceName ) ; if ( slice == null ) { rb . shards [ i ] = "" ; continue ; } Map < String , ZkNodeProps > sliceShards = slice . getShards ( ) ; Set < String > liveNodes = cloudState . getLiveNodes ( ) ; StringBuilder sliceShardsStr = new StringBuilder ( ) ; boolean first = true ; for ( ZkNodeProps nodeProps : sliceShards . values ( ) ) { if ( ! ( liveNodes . contains ( nodeProps . get ( NODE_NAME ) ) ) ) continue ; if ( first ) { first = false ; } else { sliceShardsStr . append ( '|' ) ; } String url = nodeProps . get ( "url" ) ; if ( url . startsWith ( "http:////" ) ) url = url . substring ( 7 ) ; sliceShardsStr . append ( url ) ; } rb . shards [ i ] = sliceShardsStr . toString ( ) ; } } } String shards_rows = params . get ( SHARDS_ROWS ) ; if ( shards_rows != null ) { rb . shards_rows = Integer . parseInt ( shards_rows ) ; } String shards_start = params . get ( SHARDS_START ) ; if ( shards_start != null ) { rb . shards_start = Integer . parseInt ( shards_start ) ; } } @ Override public void process ( ResponseBuilder rb ) throws IOException { } protected void doFieldSortValues ( ResponseBuilder rb , SolrIndexSearcher searcher ) throws IOException { }

Fix:
boolean hasShardURL = ( shards != null ) && ( ( shards . indexOf ( '//' ) ) > 0 ) ;