-
Bug
-
Resolution: Done
-
Major
-
None
-
None
In WFLY-19833 some of collections were changed from mutable collections to immutable collections. When using collections which don't allow null values, we shouldn't be passing in null keys in their contains() method. This will throw a NullPointException given the key is null.
Example Exception
2024-12-02 13:29:25,120 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service jboss.deployment.unit."jaxrs_jaxrs21_ee_sse_ssebroadcaster_web.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."jaxrs_jaxrs21_ee_sse_ssebroadcaster_web.war".POST_MODULE: WFLYSRV0153: Failed to process phase POST_MODULE of deployment "jaxrs_jaxrs21_ee_sse_ssebroadcaster_web.war" at org.jboss.as.server@27.0.0.Beta3//org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:172) at org.jboss.msc@1.5.5.Final//org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1617) at org.jboss.msc@1.5.5.Final//org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1580) at org.jboss.msc@1.5.5.Final//org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1438) at org.jboss.threads@2.4.0.Final//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35) at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990) at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486) at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377) at java.base/java.lang.Thread.run(Thread.java:1583) Caused by: java.lang.NullPointerException at java.base/java.util.Objects.requireNonNull(Objects.java:233) at java.base/java.util.ImmutableCollections$SetN.contains(ImmutableCollections.java:944) at org.jboss.as.jaxrs@35.0.0.Beta1-SNAPSHOT//org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.hasBootClasses(JaxrsScanningProcessor.java:200) at org.jboss.as.jaxrs@35.0.0.Beta1-SNAPSHOT//org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.scanWebDeployment(JaxrsScanningProcessor.java:219) at org.jboss.as.jaxrs@35.0.0.Beta1-SNAPSHOT//org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.deploy(JaxrsScanningProcessor.java:88) at org.jboss.as.server@27.0.0.Beta3//org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:165) ... 8 more
While this is a specific case, we should check where we've used other immutable collections and check if they could potentially pass null values where null is not allowed.