This is an automated email from the ASF dual-hosted git repository. dsmiley pushed a commit to branch branch_9x in repository https://gitbox.apache.org/repos/asf/solr.git
commit 0f5553f7b56b4158c6c25aa438093cf8b98889c7 Author: David Smiley <[email protected]> AuthorDate: Sat Aug 1 12:30:51 2026 -0400 SolrRequest.setPath fix; allow null (#4686) Fixes a temporary regression from #4665 (cherry picked from commit 14405d7ec176cc5db264eb4ffb70355b3916369e) --- .../src/java/org/apache/solr/client/solrj/SolrRequest.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/SolrRequest.java b/solr/solrj/src/java/org/apache/solr/client/solrj/SolrRequest.java index 6b1e93ee017..5ff3f70f9d3 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/SolrRequest.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/SolrRequest.java @@ -172,7 +172,7 @@ public abstract class SolrRequest<T extends SolrResponse> implements Serializabl public SolrRequest(METHOD m, String path) { this.method = m; - this.path = path; + this.path = validatePath(path); } // --------------------------------------------------------- @@ -196,11 +196,14 @@ public abstract class SolrRequest<T extends SolrResponse> implements Serializabl } public void setPath(String path) { - if (path == null || !path.startsWith("/")) { + this.path = validatePath(path); + } + + private static String validatePath(String path) { + if (path != null && !path.startsWith("/")) { throw new IllegalArgumentException("Must start with a '/': " + path); } - - this.path = path; + return path; } /**
