Skip to content

WebAuthenticationDetails#hashCode often returns zero #4133

@murrayw24

Description

@murrayw24

Summary

Ideally, the hashCode method defined by a class should return distinct integers for distinct objects. Not doing so impacts performance when the objects are stored in a HashMap

Actual Behavior

The algorithm in WebAuthenticationDetails#hashCode has a 26% chance of returning zero

Expected Behavior

A much broader range of hash codes are returned for distinct objects

Configuration

N/A

Version

4.0.9 and latest

Sample

https://github.com/spring-projects/spring-security/blob/master/web/src/main/java/org/springframework/security/web/authentication/WebAuthenticationDetails.java

Metadata

Metadata

Assignees

Labels

in: webAn issue in web modules (web, webmvc)type: breaks-passivityA change that breaks passivity with the previous releasetype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions