Skip to content

Commit 83dff0a

Browse files
lukaszlenartclaude
andcommitted
fix(dispatcher): WW-3576 remove redundant volatile from SessionMap fields
The volatile keyword on non-primitive fields (HttpSession, Set) triggers Sonar rule S3077 because volatile only guarantees reference visibility, not thread-safety of object contents. Since all field accesses are already protected by synchronized(this), the volatile keyword is redundant - synchronization already provides both visibility (happens-before) and atomicity guarantees. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 7f710ef commit 83dff0a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

core/src/main/java/org/apache/struts2/dispatcher/SessionMap.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ public class SessionMap extends AbstractMap<String, Object> implements Serializa
3939
@Serial
4040
private static final long serialVersionUID = 4678843241638046854L;
4141

42-
protected volatile HttpSession session;
43-
protected volatile Set<Entry<String, Object>> entries;
42+
protected HttpSession session;
43+
protected Set<Entry<String, Object>> entries;
4444
protected HttpServletRequest request;
4545

4646

0 commit comments

Comments
 (0)