This is an automated email from the ASF dual-hosted git repository.

mgrigorov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/wicket.git


The following commit(s) were added to refs/heads/master by this push:
     new a12f1ca568 [WICKET-7173] JavaxWebSocketConfigurator: Add back null 
check for httpSession (#1356)
a12f1ca568 is described below

commit a12f1ca56837e7cf986646b916cbd5b16ee1f590
Author: Anna Weber <[email protected]>
AuthorDate: Fri Jan 23 12:32:38 2026 +0100

    [WICKET-7173] JavaxWebSocketConfigurator: Add back null check for 
httpSession (#1356)
    
    Changes for WICKET-7162 removed a null check, leading to another NPE when 
trying to add httpSession to the userProperties map
---
 .../wicket/protocol/ws/javax/WicketServerEndpointConfig.java   | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git 
a/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/org/apache/wicket/protocol/ws/javax/WicketServerEndpointConfig.java
 
b/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/org/apache/wicket/protocol/ws/javax/WicketServerEndpointConfig.java
index 8e7f3299d8..4a260f31fb 100644
--- 
a/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/org/apache/wicket/protocol/ws/javax/WicketServerEndpointConfig.java
+++ 
b/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/org/apache/wicket/protocol/ws/javax/WicketServerEndpointConfig.java
@@ -143,13 +143,15 @@ public class WicketServerEndpointConfig implements 
ServerEndpointConfig
 
                        Object httpSession = request.getHttpSession();
                        LOG.trace("httpSession: {}", httpSession);
-                       userProperties.put(JavaxUpgradeHttpRequest.SESSION, 
httpSession);
-                       if (httpSession instanceof HttpSession)
+                       if (httpSession != null)
                        {
-                               
userProperties.put(JavaxUpgradeHttpRequest.CONTEXT_PATH,((HttpSession)httpSession).getServletContext().getContextPath());
+                               
userProperties.put(JavaxUpgradeHttpRequest.SESSION, httpSession);
+                               if (httpSession instanceof HttpSession)
+                               {
+                                       
userProperties.put(JavaxUpgradeHttpRequest.CONTEXT_PATH,((HttpSession)httpSession).getServletContext().getContextPath());
+                               }
                        }
 
-
                        Map<String, List<String>> headers = 
request.getHeaders();
                        LOG.trace("headers: {}", headers);
                        if (headers != null)

Reply via email to