Skip to content

Fix NPE on class init if solr tests base is not provided (and doesn't exist).#4225

Open
dweiss wants to merge 1 commit intoapache:mainfrom
dweiss:npe-on-init
Open

Fix NPE on class init if solr tests base is not provided (and doesn't exist).#4225
dweiss wants to merge 1 commit intoapache:mainfrom
dweiss:npe-on-init

Conversation

@dweiss
Copy link
Contributor

@dweiss dweiss commented Mar 18, 2026

The order of arguments in the loop is not right.

Copy link
Contributor

@epugh epugh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm.

@dsmiley dsmiley requested a review from Copilot March 18, 2026 23:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR intends to prevent a null-pointer failure during ExternalPaths initialization when the Solr source/test base directory can’t be determined (e.g., when tests.src.home isn’t provided and the expected directories don’t exist).

Changes:

  • Fixes the short-circuit evaluation order in the directory-walk loop so base is checked for null before calling base.resolve(...).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


Path base = file.toAbsolutePath();
while (!Files.exists(base.resolve("solr/test-framework/build.gradle")) && null != base) {
while (null != base && !Files.exists(base.resolve("solr/test-framework/build.gradle"))) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants