Issue #1940 Fix NPE

This commit is contained in:
Jan Bartel 2017-11-22 09:37:42 +01:00
parent 6a2f39fb3c
commit 8cc9f9ddcf
2 changed files with 4 additions and 2 deletions

View File

@ -130,7 +130,8 @@ public class EmbeddedCdiHandler extends ServletContextHandler
|| (weldListener instanceof HttpSessionListener) || (weldListener instanceof HttpSessionListener)
|| (weldListener instanceof HttpSessionIdListener)) || (weldListener instanceof HttpSessionIdListener))
{ {
getSessionHandler().addEventListener(weldListener); if (getSessionHandler() != null)
getSessionHandler().addEventListener(weldListener);
} }
} }
finally finally

View File

@ -29,6 +29,7 @@ import java.net.URI;
import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector; import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.toolchain.test.MavenTestingUtils; import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
import org.eclipse.jetty.util.IO; import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.util.log.JettyLogHandler; import org.eclipse.jetty.util.log.JettyLogHandler;
@ -55,7 +56,7 @@ public class WeldInitializationTest
connector.setPort(0); connector.setPort(0);
server.addConnector(connector); server.addConnector(connector);
EmbeddedCdiHandler context = new EmbeddedCdiHandler(); EmbeddedCdiHandler context = new EmbeddedCdiHandler(ServletContextHandler.SESSIONS);
File baseDir = MavenTestingUtils.getTestResourcesDir(); File baseDir = MavenTestingUtils.getTestResourcesDir();