This repository has been archived by the owner on Jun 15, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix NullPointerException in QaseExtension if token is unavailable
The `QaseExtension` JUnit extension fails with a `NullPointerException` if `QASE_API_TOKEN` is unset. Ideally, the extension would skip execution if the token was unavailable instead of failing. Stack trace: ``` org.apache.maven.surefire.util.SurefireReflectionException: java.util.ServiceConfigurationError: org.junit.platform.launcher.TestExecutionListener: Provider com.provectus.kafka.ui.utilities.qaseIoUtils.QaseExtension could not be instantiated at org.apache.maven.surefire.util.ReflectionUtils.instantiateOneArg(ReflectionUtils.java:139) at org.apache.maven.surefire.booter.ForkedBooter.createProviderInCurrentClassloader(ForkedBooter.java:403) at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:383) 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) Caused by: java.util.ServiceConfigurationError: org.junit.platform.launcher.TestExecutionListener: Provider com.provectus.kafka.ui.utilities.qaseIoUtils.QaseExtension could not be instantiated at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:586) at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:813) at java.base/java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:729) at java.base/java.util.ServiceLoader$3.next(ServiceLoader.java:1403) at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133) at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1921) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596) at org.junit.platform.launcher.core.LauncherFactory.registerTestExecutionListeners(LauncherFactory.java:179) at org.junit.platform.launcher.core.LauncherFactory.createDefaultLauncher(LauncherFactory.java:137) at org.junit.platform.launcher.core.LauncherFactory.create(LauncherFactory.java:125) at org.junit.platform.launcher.core.LauncherFactory.create(LauncherFactory.java:109) at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.<init>(JUnitPlatformProvider.java:86) at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:67) at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:484) at org.apache.maven.surefire.util.ReflectionUtils.instantiateOneArg(ReflectionUtils.java:135) ... 5 more Caused by: java.lang.ExceptionInInitializerError at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized0(Native Method) at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized(Unsafe.java:1160) at java.base/jdk.internal.reflect.MethodHandleAccessorFactory.ensureClassInitialized(MethodHandleAccessorFactory.java:300) at java.base/jdk.internal.reflect.MethodHandleAccessorFactory.newConstructorAccessor(MethodHandleAccessorFactory.java:103) at java.base/jdk.internal.reflect.ReflectionFactory.newConstructorAccessor(ReflectionFactory.java:201) at java.base/java.lang.reflect.Constructor.acquireConstructorAccessor(Constructor.java:547) at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:497) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:484) at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:789) ... 24 more Caused by: java.lang.NullPointerException 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:1340) at java.base/java.util.Properties.setProperty(Properties.java:230) at java.base/java.lang.System.setProperty(System.java:1043) at com.provectus.kafka.ui.utilities.qaseIoUtils.QaseExtension.<clinit>(QaseExtension.java:51) ... 33 more ``` (cherry picked from commit 88b9262)
- Loading branch information