3030public class ExternalPaths {
3131
3232 /**
33- * The main directory path for the solr source being built if it can be determined. If it can not
33+ * The main directory path for the solr source being built if it can be determined. If it cannot
3434 * be determined -- possibly because the current context is a client code base using the test
3535 * framework -- then this variable will be null.
3636 *
3737 * <p>Note that all other static paths available in this class are derived from the source home,
38- * and if it is null, those paths will just be relative to ' null' and may not be meaningful .
38+ * and if it is null, those paths will be null as well .
3939 */
40- public static final Path SOURCE_HOME = determineSourceHome ();
40+ public static final Path SOURCE_HOME = determineSourceHome (); // absolute
4141
4242 /**
4343 * @see #SOURCE_HOME
4444 */
45- public static Path WEBAPP_HOME = SOURCE_HOME .resolve ("webapp/web" ). toAbsolutePath ( );
45+ public static Path WEBAPP_HOME = SOURCE_HOME == null ? null : SOURCE_HOME .resolve ("webapp/web" );
4646
4747 /**
4848 * @see #SOURCE_HOME
4949 */
5050 public static Path DEFAULT_CONFIGSET =
51- SOURCE_HOME .resolve ("server/solr/configsets/_default/conf" ). toAbsolutePath ( );
51+ SOURCE_HOME == null ? null : SOURCE_HOME .resolve ("server/solr/configsets/_default/conf" );
5252
5353 /**
5454 * @see #SOURCE_HOME
5555 */
5656 public static Path TECHPRODUCTS_CONFIGSET =
57- SOURCE_HOME
58- . resolve ( "server/solr/configsets/sample_techproducts_configs/conf" )
59- . toAbsolutePath ( );
57+ SOURCE_HOME == null
58+ ? null
59+ : SOURCE_HOME . resolve ( "server/solr/configsets/sample_techproducts_configs/conf" );
6060
6161 /**
6262 * @see #SOURCE_HOME
6363 */
64- public static Path SERVER_HOME = SOURCE_HOME .resolve ("server/solr" ). toAbsolutePath ( );
64+ public static Path SERVER_HOME = SOURCE_HOME == null ? null : SOURCE_HOME .resolve ("server/solr" );
6565
6666 /**
6767 * Ugly, ugly hack to determine the example home without depending on the CWD this is needed for
@@ -83,10 +83,13 @@ static Path determineSourceHome() {
8383 }
8484
8585 Path base = file .toAbsolutePath ();
86- while (!Files .exists (base .resolve ("solr/ test-framework/build.gradle" )) && null != base ) {
86+ while (!Files .exists (base .resolve ("test-framework/build.gradle" ))) {
8787 base = base .getParent ();
88+ if (base == null ) {
89+ return null ;
90+ }
8891 }
89- return ( null == base ) ? null : base . resolve ( "solr/" ). toAbsolutePath () ;
92+ return base ;
9093 } catch (Exception e ) {
9194 // all bets are off
9295 throw new SolrException (
0 commit comments