Istvan Farkas created SOLR-13921: ------------------------------------ Summary: 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: 8.3, 7.4 Reporter: Istvan Farkas
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-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org