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 1e000c5e2126b4b7c5c8f7de48f7409dec9778c8
Author: David Smiley <[email protected]>
AuthorDate: Wed Jul 29 00:26:53 2026 -0400

    SolrRequest.getPath setPath documentation (#4665)
    
    And path enforcement
    
    (cherry picked from commit 6c793d5534160d882882f2833496ae25c1f9016b)
---
 .../solrj/src/java/org/apache/solr/client/solrj/SolrRequest.java | 9 +++++++++
 1 file changed, 9 insertions(+)

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 03b23d5dcdd..6b1e93ee017 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
@@ -186,11 +186,20 @@ public abstract class SolrRequest<T extends SolrResponse> 
implements Serializabl
     this.method = method;
   }
 
+  /**
+   * The URI path to a "request handler", such as "/select". Must start with a 
"/". For
+   * collection/core requests, this is appended to the core/collection path; 
otherwise it's a node
+   * level request and thus is relative to the solr root.
+   */
   public String getPath() {
     return path;
   }
 
   public void setPath(String path) {
+    if (path == null || !path.startsWith("/")) {
+      throw new IllegalArgumentException("Must start with a '/': " + path);
+    }
+
     this.path = path;
   }
 

Reply via email to