diff --git a/jetty-websocket/websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/internal/UpgradeHttpServletRequest.java b/jetty-websocket/websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/internal/UpgradeHttpServletRequest.java index 32679424b1a..7694a9357bb 100644 --- a/jetty-websocket/websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/internal/UpgradeHttpServletRequest.java +++ b/jetty-websocket/websocket-core-server/src/main/java/org/eclipse/jetty/websocket/core/server/internal/UpgradeHttpServletRequest.java @@ -430,7 +430,8 @@ public class UpgradeHttpServletRequest implements HttpServletRequest { if (request == null) attributes.put(name, value); - request.setAttribute(name, value); + else + request.setAttribute(name, value); } @Override @@ -438,7 +439,8 @@ public class UpgradeHttpServletRequest implements HttpServletRequest { if (request == null) attributes.remove(name); - request.removeAttribute(name); + else + request.removeAttribute(name); } @Override