Buggy code:
public final class ZkController { private static Logger log = LoggerFactory . getLogger ( ZkController . class ) ; static final String NEWL = System . getProperty ( "line.separator" ) ; private static final Pattern URL_POST = Pattern . compile ( "https?:////(.*)" ) ; private static final Pattern URL_PREFIX = Pattern . compile ( "(https?:////).*" ) ; private final boolean SKIP_AUTO_RECOVERY = Boolean . getBoolean ( "solrcloud.skip.autorecovery" ) ; private final DistributedQueue overseerJobQueue ; private final DistributedQueue overseerCollectionQueue ; public static final String CONFIGS_ZKNODE = "//configs" ; public static final String COLLECTION_PARAM_PREFIX = "collection." ; public static final String CONFIGNAME_PROP = "configName" ; private final Map < String , ElectionContext > electionContexts = Collections . synchronizedMap ( new HashMap < String , ElectionContext > ( ) ) ; private SolrZkClient zkClient ; private ZkCmdExecutor cmdExecutor ; private ZkStateReader zkStateReader ; private LeaderElector leaderElector ; private String zkServerAddress ; private final String localHostPort ; private final String localHostContext ; private final String localHost ; private final String hostName ; private final String nodeName ; private final String baseURL ; private LeaderElector overseerElector ; private CoreContainer cc ; protected volatile Overseer overseer ; private String leaderVoteWait ; private int clientTimeout ; private volatile boolean isClosed ; private UpdateShardHandler updateShardHandler ; public ZkController ( final CoreContainer cc , String zkServerAddress , int zkClientTimeout , int zkClientConnectTimeout , String localHost , String locaHostPort , String localHostContext , String leaderVoteWait , int distribUpdateConnTimeout , int distribUpdateSoTimeout , final CurrentCoreDescriptorProvider registerOnReconnect ) throws IOException , InterruptedException , TimeoutException { } public String getLeaderVoteWait ( ) { } private void registerAllCoresAsDown ( final CurrentCoreDescriptorProvider registerOnReconnect , boolean updateLastPublished ) { } private void markAllAsNotLeader ( final CurrentCoreDescriptorProvider registerOnReconnect ) { } public void close ( ) { } public boolean configFileExists ( String collection , String fileName ) throws InterruptedException , KeeperException { } public ClusterState getClusterState ( ) { } public byte [ ] getConfigFileData ( String zkConfigName , String fileName ) throws InterruptedException , KeeperException { } private String getHostAddress ( String host ) throws IOException { <START_BUG> if ( host == null ) { <END_BUG> String hostaddress ; try { hostaddress = InetAddress . getLocalHost ( ) . getHostAddress ( ) ; } catch ( UnknownHostException e ) { hostaddress = "127.0.0.1" ; } if ( "127.0.0.1" . equals ( hostaddress ) ) { Enumeration < NetworkInterface > netInterfaces = null ; try { netInterfaces = NetworkInterface . getNetworkInterfaces ( ) ; while ( netInterfaces . hasMoreElements ( ) ) { NetworkInterface ni = netInterfaces . nextElement ( ) ; Enumeration < InetAddress > ips = ni . getInetAddresses ( ) ; while ( ips . hasMoreElements ( ) ) { InetAddress ip = ips . nextElement ( ) ; if ( ip . isSiteLocalAddress ( ) ) { hostaddress = ip . getHostAddress ( ) ; } } } } catch ( Throwable e ) { SolrException . log ( ZkController . log , "Error<seq2seq4repair_space>while<seq2seq4repair_space>looking<seq2seq4repair_space>for<seq2seq4repair_space>a<seq2seq4repair_space>better<seq2seq4repair_space>host<seq2seq4repair_space>name<seq2seq4repair_space>than<seq2seq4repair_space>127.0.0.1" , e ) ; } } host = "http:////" + hostaddress ; } else { Matcher m = ZkController . URL_PREFIX . matcher ( host ) ; if ( m . matches ( ) ) { String prefix = m . group ( 1 ) ; host = prefix + host ; } else { host = "http:////" + host ; } } return host ; } private String getHostNameFromAddress ( String addr ) { } public String getHostName ( ) { } public String getHostPort ( ) { } public SolrZkClient getZkClient ( ) { } public String getZkServerAddress ( ) { } private void init ( CurrentCoreDescriptorProvider registerOnReconnect ) { } public void publishAndWaitForDownStates ( ) throws InterruptedException , KeeperException { } public static boolean checkChrootPath ( String zkHost , boolean create ) throws InterruptedException , KeeperException { } private static boolean containsChroot ( String zkHost ) { } public boolean isConnected ( ) { } private void createEphemeralLiveNode ( ) throws InterruptedException , KeeperException { } public String getNodeName ( ) { } public boolean pathExists ( String path ) throws InterruptedException , KeeperException { } public String readConfigName ( String collection ) throws InterruptedException , KeeperException { } public String register ( String coreName , final CoreDescriptor desc ) throws Exception { } public String register ( String coreName , final CoreDescriptor desc , boolean recoverReloadedCores , boolean afterExpiration ) throws Exception { } private String getLeader ( final CloudDescriptor cloudDesc , int timeoutms ) { } public ZkCoreNodeProps getLeaderProps ( final String collection , final String slice , int timeoutms ) throws InterruptedException { } public ZkCoreNodeProps getLeaderProps ( final String collection , final String slice , int timeoutms , boolean failImmediatelyOnExpiration ) throws InterruptedException { } private void joinElection ( CoreDescriptor cd , boolean afterExpiration ) throws IOException , InterruptedException , KeeperException { } private boolean checkRecovery ( String coreName , final CoreDescriptor desc , boolean recoverReloadedCores , final boolean isLeader , final CloudDescriptor cloudDesc , final String collection , final String shardZkNodeName , String shardId , ZkNodeProps leaderProps , SolrCore core , CoreContainer cc ) { } public String getBaseUrl ( ) { } public void publish ( final CoreDescriptor cd , final String state ) throws InterruptedException , KeeperException { } public void publish ( final CoreDescriptor cd , final String state , boolean updateLastState ) throws InterruptedException , KeeperException { } private boolean needsToBeAssignedShardId ( final CoreDescriptor desc , final ClusterState state , final String coreNodeName ) { } public void unregister ( String coreName , CoreDescriptor cd ) throws InterruptedException , KeeperException { } public void createCollection ( String collection ) throws InterruptedException , KeeperException { } public void uploadToZK ( File dir , String zkPath ) throws IOException , InterruptedException , KeeperException { } public void uploadConfigDir ( File dir , String configName ) throws IOException , InterruptedException , KeeperException { } void printLayoutToStdOut ( ) throws InterruptedException , KeeperException { } public void createCollectionZkNode ( CloudDescriptor cd ) throws InterruptedException , KeeperException { }

Fix:
if ( ( host == null ) || ( ( host . length ( ) ) == 0 ) ) {