This is an automated email from the ASF dual-hosted git repository. dsmiley pushed a commit to branch branch_10x in repository https://gitbox.apache.org/repos/asf/solr.git
commit ddba8752b8e1a9dc99277505c8a395f283eafa8f 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 7574bd38967..fb975b9bab2 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 @@ -157,7 +157,7 @@ public abstract class SolrRequest<T> implements Serializable { public SolrRequest(METHOD m, String path, SolrRequestType requestType) { this.method = m; - this.path = path; + this.path = validatePath(path); this.requestType = requestType; } @@ -182,11 +182,14 @@ public abstract class SolrRequest<T> implements Serializable { } 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; } /**
