Skip to content

CAY-3080 ObjectId.toString() prints binary key values as object identity - #661

Merged
stariy95 merged 1 commit into
STABLE-5.0from
binary-key-objectid-tostring
Nov 18, 2026
Merged

stariy95 merged 1 commit into
STABLE-5.0from
binary-key-objectid-tostring

Conversation

@Jugen

@Jugen Jugen commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Problem: An ObjectId with a byte[] key prints like "BIN_ID=[B@6b5176f2". That’s useless in logs, and equal ids print differently, which breaks the guarantee documented in ObjectIdCompound.toString().

Cause: toString() appends the raw value.

Fix: ObjectIdSingle and ObjectIdCompound print byte[] values as hex, using the existing IDUtil.appendFormattedByte, e.g. ID=01020AFF. I chose hex over Arrays.toString because it’s shorter and easier to read for keys. Other values print as before.

Tests: Two new tests in ObjectIdTest, for single and compound ids.

@Jugen
Jugen marked this pull request as ready for review November 16, 2026 18:29
@stariy95
stariy95 merged commit 8ef8f39 into STABLE-5.0 Nov 18, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants