This is an automated email from the ASF dual-hosted git repository.
dsmiley pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/main by this push:
new 14405d7ec17 SolrRequest.setPath fix; allow null (#4686)
14405d7ec17 is described below
commit 14405d7ec176cc5db264eb4ffb70355b3916369e
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
---
.../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;
}
/**