lucene-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Risden (Jira)" <j...@apache.org>
Subject [jira] [Assigned] (SOLR-13921) Processing UpdateRequest with delegation token throws NullPointerException
Date Wed, 13 Nov 2019 14:29:00 GMT

     [ https://issues.apache.org/jira/browse/SOLR-13921?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Kevin Risden reassigned SOLR-13921:
-----------------------------------

    Assignee: Kevin Risden

> Processing UpdateRequest with delegation token throws NullPointerException
> --------------------------------------------------------------------------
>
>                 Key: SOLR-13921
>                 URL: https://issues.apache.org/jira/browse/SOLR-13921
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: SolrJ
>    Affects Versions: 7.4, 8.3
>            Reporter: Istvan Farkas
>            Assignee: Kevin Risden
>            Priority: Minor
>         Attachments: SOLR-13921.patch
>
>
> When sending UpdateRequests with delegation tokens to Solr using SolrJ, the createMethod
of DelegationTokenHttpSolrClient will throw a NullPointerException:
>  
> {code:java}
>   [junit4] ERROR   3.41s | TestSolrCloudWithDelegationTokens.testDelegationTokenSolrClientWithUpdateRequests
<<<
>    [junit4]    > Throwable #1: java.lang.NullPointerException
>    [junit4]    > 	at __randomizedtesting.SeedInfo.seed([B9AE8E4E0CDF1B3D:DBA0B722C813061D]:0)
>    [junit4]    > 	at org.apache.solr.client.solrj.impl.DelegationTokenHttpSolrClient.createMethod(DelegationTokenHttpSolrClient.java:93)
>    [junit4]    > 	at org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:258)
>    [junit4]    > 	at org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:249)
>    [junit4]    > 	at org.apache.solr.cloud.TestSolrCloudWithDelegationTokens.doSolrRequest(TestSolrCloudWithDelegationTokens.java:246)
>    [junit4]    > 	at org.apache.solr.cloud.TestSolrCloudWithDelegationTokens.testDelegationTokenSolrClientWithUpdateRequests(TestSolrCloudWithDelegationTokens.java:477)
>    [junit4]    > 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
>    [junit4]    > 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>    [junit4]    > 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>    [junit4]    > 	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
>    [junit4]    > 	at java.base/java.lang.Thread.run(Thread.java:834) {code}
> This happens to all SolrJ clients including the Spark Crunch indexer which use Delegation
Tokens and do not specify commit / optimize commands. 
> The cause seems to be a missing null check before dereferencing 'params'. The intention
of the code seems to be verifying if the delegation token is passed a parameter of the SolrRequest
(which is not supported), however the check fails with NPE if the request has no params at
all. For update requests which do commit  or optimize, the setCommand method initializes the
params so no NPE is thrown. 
> {code}
> @Override
>   protected HttpRequestBase createMethod(final SolrRequest request, String collection)
throws IOException, SolrServerException {
>     SolrParams params = request.getParams();
>     if (params.getParams(DELEGATION_TOKEN_PARAM) != null) {
>       throw new IllegalArgumentException(DELEGATION_TOKEN_PARAM + " parameter not supported");
>     }
>     return super.createMethod(request, collection);
>   }
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


Mime
View raw message