Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-14283

Fix NPE in SolrTestCaseJ4 preventing it from working on external projects

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 8.5
    • Fix Version/s: 8.5
    • Component/s: Tests
    • Labels:
      None

      Description

      Though it's goals were laudable, SOLR-14217 ran afoul of an untested requirement that the SolrTestCaseJ4 class continue to function even if ExternalPaths#SOURCE_HOME has been set to null by the logic in org.apache.solr.util.ExternalPaths#determineSourceHome

      The result is that in any almost all usages of the solr test framework outside of Solr that rely on SolrTestCaseJ4 or it's sub-classes including SolrCloudTestCase the following exception would be thrown:

      java.lang.NullPointerException
      	at __randomizedtesting.SeedInfo.seed([7A1D202DDAEA1C07]:0)
      	at java.base/java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:1011)
      	at java.base/java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:1006)
      	at java.base/java.util.Properties.put(Properties.java:1337)
      	at java.base/java.util.Properties.setProperty(Properties.java:225)
      	at java.base/java.lang.System.setProperty(System.java:895)
      	at org.apache.solr.SolrTestCaseJ4.setupTestCases(SolrTestCaseJ4.java:284)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      	at com.carrotsearch.randomizedtesting.RandomizedRunner.invoke(RandomizedRunner.java:1750)
      	at com.carrotsearch.randomizedtesting.RandomizedRunner$6.evaluate(RandomizedRunner.java:878)
      	at com.carrotsearch.randomizedtesting.RandomizedRunner$7.evaluate(RandomizedRunner.java:894)
      	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
      	at com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule$1.evaluate(SystemPropertiesRestoreRule.java:57)
      	at org.apache.lucene.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:45)
      	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
      	at org.apache.lucene.util.TestRuleStoreClassName$1.evaluate(TestRuleStoreClassName.java:41)
      	at com.carrotsearch.randomizedtesting.rules.NoShadowingOrOverridesOnMethodsRule$1.evaluate(NoShadowingOrOverridesOnMethodsRule.java:40)
      	at com.carrotsearch.randomizedtesting.rules.NoShadowingOrOverridesOnMethodsRule$1.evaluate(NoShadowingOrOverridesOnMethodsRule.java:40)
      	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
      	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
      	at org.apache.lucene.util.TestRuleAssertionsRequired$1.evaluate(TestRuleAssertionsRequired.java:53)
      	at org.apache.lucene.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:47)
      	at org.apache.lucene.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:64)
      	at org.apache.lucene.util.TestRuleIgnoreTestSuites$1.evaluate(TestRuleIgnoreTestSuites.java:54)
      	at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
      	at com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:368)
      	at java.base/java.lang.Thread.run(Thread.java:834)
      

      This ticket will fix the issue and provides a test so that we don't break nearly every user of the test framework other than ourselves in the future.

        Attachments

        1. SOLR-14283.patch
          41 kB
          Gus Heck

          Issue Links

            Activity

              People

              • Assignee:
                gus Gus Heck
                Reporter:
                gus Gus Heck
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: