NPE in SauceOnDemandTestListener with "SELENIUM_IS_LOCAL=false"
When running tests remotely with SauceLabs with "SELENIUM_IS_LOCAL=false". It actually happens with setting it to "True" too, but that's documented in a separate issue already: https://github.com/saucelabs/sauce-java/issues/51
Below is the stack trace:
java.lang.NullPointerException at com.saucelabs.testng.SauceOnDemandTestListener.markJobStatus(SauceOnDemandTestListener.java:115) at com.saucelabs.testng.SauceOnDemandTestListener.onTestSuccess(SauceOnDemandTestListener.java:142) at org.testng.internal.TestListenerHelper.runTestListeners(TestListenerHelper.java:70) at org.testng.internal.TestInvoker.runTestResultListener(TestInvoker.java:210) at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:638) at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:172) at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46) at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:804) at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:145) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128) at java.base/java.util.ArrayList.forEach(ArrayList.java:1540) at org.testng.TestRunner.privateRun(TestRunner.java:770) at org.testng.TestRunner.run(TestRunner.java:591) at org.testng.SuiteRunner.runTest(SuiteRunner.java:402) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:396) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:355) at org.testng.SuiteRunner.run(SuiteRunner.java:304) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1180) at org.testng.TestNG.runSuitesLocally(TestNG.java:1102) at org.testng.TestNG.runSuites(TestNG.java:1032) at org.testng.TestNG.run(TestNG.java:1000) at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:135) at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeMulti(TestNGDirectoryTestSuite.java:193) at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:94) at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:146) at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345) at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418)
The NPE seems to occur because of this line in the SauceOnDemandTestListener (because the sauceREST variable has not been initialized):

That "sauceREST" variable gets initialized here, under this condition based on this.isLocal:

this.isLocal gets set to "true" here (the default value is "false"). The problem is that passing any value in for SELENIUM_IS_LOCAL will cause this method to set isLocal to "true". The only way to get isLocal to be "false" is by passing in a null/empty string:

It seems the only way to run remotely and avoid this stack trace is to use "SELENIUM_IS_LOCAL=" or not pass the parameter at all (even though passing "true" will also produce the NPE).
It's just misleading that the parameter is half boolean. Only takes either true or empty string.