$ the-wire · showcase
Spring Framework fixes duplicate key code lookup
By RepoJournal · Filed · About Spring
Spring Framework patched a binary search bug in SQLErrorCodes that could cause duplicate key error codes to be missed.
Spring Framework aligned SQLErrorCodes with the rest of its error code handling [1]. setDuplicateKeyCodes was the only setter storing its array unsorted, while SQLErrorCodeSQLExceptionTranslator relies on Arrays.binarySearch, which requires sorted input. The setter now sorts the codes via StringUtils.sortStringArray, so translation behaves deterministically for all error codes.
Two smaller changes also landed: synthesized annotation toString() handling for NaN and Infinity now matches the JDK [2], and a test-support method was renamed from maxAttemptsReached() to maxElapsedTimeReached() to reflect its actual intent [3]. Spring Boot and Spring Framework both had routine maintenance via branch merges and polish commits, with no behavior changes on those axes [4][5][6][7].
Action items
- → Review any code relying on setDuplicateKeyCodes order; behavior is now sorted as documented spring-projects/spring-framework [plan]
References
- [1] Sort duplicate key codes in SQLErrorCodes ↗ spring-projects/spring-framework
- [2] Align synthesized annotation toString() with JDK for NaN/Infinity ↗ spring-projects/spring-framework
- [3] Rename maxAttemptsReached() to maxElapsedTimeReached() and organize tests ↗ spring-projects/spring-framework
- [4] Merge branch '4.1.x' ↗ spring-projects/spring-boot
- [5] Merge branch '4.0.x' into 4.1.x ↗ spring-projects/spring-boot
- [6] Polish ↗ spring-projects/spring-boot
- [7] Merge branch '7.0.x' ↗ spring-projects/spring-framework