Buggy code:
String t1 = "a_t" ; String i1 = "a_si" ; String nint = "n_i" ; String tint = "n_ti" ; String nfloat = "n_f" ; String tfloat = "n_tf" ; String ndouble = "n_d" ; String tdouble = "n_td" ; String nlong = "n_l" ; String tlong = "other_tl1" ; String ndate = "n_dt" ; String tdate = "n_tdt" ; String oddField = "oddField_s" ; String missingField = "ignore_exception__missing_but_valid_field_t" ; String invalidField = "ignore_exception__invalid_field_not_in_schema" ; protected int sliceCount ; protected CloudSolrServer controlClientCloud ; protected volatile CloudSolrServer cloudClient ; protected List < AbstractFullDistribZkTestBase . CloudJettyRunner > cloudJettys = new ArrayList < AbstractFullDistribZkTestBase . CloudJettyRunner > ( ) ; protected Map < String , List < AbstractFullDistribZkTestBase . CloudJettyRunner > > shardToJetty = new HashMap < String , List < AbstractFullDistribZkTestBase . CloudJettyRunner > > ( ) ; private AtomicInteger jettyIntCntr = new AtomicInteger ( 0 ) ; protected ChaosMonkey chaosMonkey ; protected Map < String , AbstractFullDistribZkTestBase . CloudJettyRunner > shardToLeaderJetty = new HashMap < String , AbstractFullDistribZkTestBase . CloudJettyRunner > ( ) ; private boolean cloudInit ; protected boolean checkCreatedVsState ; public static class CloudJettyRunner { public JettySolrRunner jetty ; public String nodeName ; public String coreNodeName ; public String url ; public AbstractFullDistribZkTestBase . CloudSolrServerClient client ; public ZkNodeProps info ; @ Override public int hashCode ( ) { } @ Override public boolean equals ( Object obj ) { } @ Override public String toString ( ) { } } static class CloudSolrServerClient { SolrServer solrClient ; String shardName ; int port ; public ZkNodeProps info ; public CloudSolrServerClient ( ) { } public CloudSolrServerClient ( SolrServer client ) { } @ Override public int hashCode ( ) { } @ Override public boolean equals ( Object obj ) { } } @ Before @ Override public void setUp ( ) throws Exception { } @ BeforeClass public static void beforeClass ( ) { } @ AfterClass public static void afterClass ( ) { } public AbstractFullDistribZkTestBase ( ) { } protected String getDataDir ( String dataDir ) throws IOException { } protected void initCloud ( ) throws Exception { } protected CloudSolrServer createCloudClient ( String defaultCollection ) throws MalformedURLException { } @ Override protected void createServers ( int numServers ) throws Exception { } protected void waitForCollection ( ZkStateReader reader , String collection , int slices ) throws Exception { } protected List < JettySolrRunner > createJettys ( int numJettys ) throws Exception { } protected List < JettySolrRunner > createJettys ( int numJettys , boolean checkCreatedVsState ) throws Exception { } protected SolrServer startCloudJetty ( String collection , String shard ) throws Exception { } protected int getTotalReplicas ( String collection ) { } public JettySolrRunner createJetty ( String dataDir , String ulogDir , String shardList , String solrConfigOverride ) throws Exception { } public JettySolrRunner createJetty ( File solrHome , String dataDir , String shardList , String solrConfigOverride , String schemaOverride ) throws Exception { } private File getRelativeSolrHomePath ( File solrHome ) { String path = SolrResourceLoader . normalizeDir ( new File ( "." ) . getAbsolutePath ( ) ) ; String base = new File ( solrHome . getPath ( ) ) . getAbsolutePath ( ) ; if ( base . startsWith ( "." ) ) ; base . replaceFirst ( "\\." , new File ( "." ) . getName ( ) ) ; if ( path . endsWith ( ( ( File . separator ) + "." ) ) ) { path = path . substring ( 0 , ( ( path . length ( ) ) - 2 ) ) ; } <START_BUG> int splits = path . split ( File . separator ) . length ; <END_BUG> StringBuilder p = new StringBuilder ( ) ; for ( int i = 0 ; i < ( splits - 2 ) ; i ++ ) { p . append ( ( ".." + ( File . separator ) ) ) ; } String prefix = FilenameUtils . getPrefix ( path ) ; if ( base . startsWith ( prefix ) ) { base = base . substring ( prefix . length ( ) ) ; } solrHome = new File ( ( ( p . toString ( ) ) + base ) ) ; return solrHome ; } protected void updateMappingsFromZk ( List < JettySolrRunner > jettys , List < SolrServer > clients ) throws Exception { } private AbstractFullDistribZkTestBase . CloudSolrServerClient findClientByPort ( int port , List < AbstractFullDistribZkTestBase . CloudSolrServerClient > theClients ) { } @ Override protected void setDistributedParams ( ModifiableSolrParams params ) { } @ Override protected void indexDoc ( SolrInputDocument doc ) throws IOException , SolrServerException { } @ Override protected void index_specific ( int serverNumber , Object ... fields ) throws Exception { } protected void index_specific ( SolrServer client , Object ... fields ) throws Exception { } @ Override protected void del ( String q ) throws Exception { } protected void waitForRecoveriesToFinish ( boolean verbose ) throws Exception { } protected void waitForRecoveriesToFinish ( String collection , boolean verbose ) throws Exception { } protected void waitForRecoveriesToFinish ( boolean verbose , int timeoutSeconds ) throws Exception { } protected void checkQueries ( ) throws Exception { } protected void indexAbunchOfDocs ( ) throws Exception { } public QueryResponse queryAndCompareReplicas ( SolrParams params , String shard ) throws Exception { } public void queryAndCompareShards ( SolrParams params ) throws Exception { } protected void checkShardConsistency ( String shard ) throws Exception { } protected String checkShardConsistency ( String shard , boolean expectFailure , boolean verbose ) throws Exception { } public void showCounts ( ) { } private String toStr ( SolrDocumentList lst , int maxSz ) { } Set < Map > showDiff ( SolrDocumentList a , SolrDocumentList b , String aName , String bName ) { } protected void checkShardConsistency ( ) throws Exception { } protected void checkShardConsistency ( boolean checkVsControl , boolean verbose ) throws Exception { }

Fix:
int splits = path . split ( ( "\\" + ( File . separator ) ) ) . length ;