rseitz commented on code in PR #2404:
URL: https://github.com/apache/solr/pull/2404#discussion_r1580121540


##########
solr/core/src/java/org/apache/solr/servlet/SolrRequestParsers.java:
##########
@@ -252,7 +260,11 @@ private SolrQueryRequest buildRequestFrom(
         new SolrQueryRequestBase(core, params, requestTimer) {
           @Override
           public Principal getUserPrincipal() {
-            return req == null ? null : req.getUserPrincipal();
+            if (principal != null) {
+              return principal;
+            } else {
+              return req == null ? null : req.getUserPrincipal();
+            }
           }

Review Comment:
   I tried it and got a stack overflow. Here is what happens:
   
   `EmbeddedSolrServer#request ` uses `SolrRequestParsers#buildRequestFrom` to 
obtain a`SolrQueryRequest req`. It then calls 
`SolrRequestInfo.setRequestInfo(new SolrRequestInfo(req, rsp))` to designate 
that request as the current one (see 
[here](https://github.com/apache/solr/blob/9ad70743a218665254f8aff15952ab4859e65b75/solr/core/src/java/org/apache/solr/client/solrj/embedded/EmbeddedSolrServer.java#L224)).
 
   
   The `getUserPrincipal` method that I'm changing here belongs to an anonymous 
inner class that extends `SolrQueryRequestBase`. At the time this 
`getUserPrincipal` method is actually called, `SolrRequestInfo.getRequestInfo` 
would return a `SolrRequestInfo` containing the same `SolrQueryRequest` 
instance that `getUserPrincipal` is being called on in the first place. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to