Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TestKit encoding where ByteBuffer.array may not exactly represent UTF8 encoded bytes #264

Closed
wants to merge 1 commit into from

Conversation

rusher
Copy link

@rusher rusher commented Feb 3, 2022

Issue description

Testkit correction:

backing array ByteBuffer.array may not exactly represent UTF8 encoded bytes.
PR permit to ensure test is valid whatever the JVM is used

Example using jdk8:

  • "test-value".getBytes(StandardCharsets.UTF_8) => 0x746573742D76616C7565
  • StandardCharsets.UTF_8.encode("test-value").array() => 0x746573742D76616C756500 having an additional ending 0x00

Signed-off-by: diego Dupindiego.dupin@gmail.com

Testkit correction:

backing array ByteBuffer.array may not exactly represent UTF8 encoded bytes.
PR permit to ensure test is valid whatever the JVM is used

Example using jdk8:

"test-value".getBytes(StandardCharsets.UTF_8) => 0x746573742D76616C7565
StandardCharsets.UTF_8.encode("test-value").array() => 0x746573742D76616C756500 having an additional ending 0x00
Signed-off-by: diego Dupin <diego.dupin@gmail.com>
@mp911de mp911de changed the title Issue description Fix TestKit encoding where ByteBuffer.array may not exactly represent UTF8 encoded bytes Feb 3, 2022
@mp911de mp911de added the type: bug A general bug label Feb 3, 2022
@mp911de
Copy link
Member

mp911de commented Feb 3, 2022

Thanks a lot for the fix. Going to merge it for 0.8, 0.9 and main development lines.

@mp911de mp911de added this to the 0.8.7.RELEASE milestone Feb 3, 2022
mp911de pushed a commit that referenced this pull request Feb 3, 2022
…sent UTF8 encoded bytes.

backing array ByteBuffer.array may not exactly represent UTF8 encoded bytes.
PR permit to ensure test is valid whatever the JVM is used

Example using jdk8:

"test-value".getBytes(StandardCharsets.UTF_8) => 0x746573742D76616C7565
StandardCharsets.UTF_8.encode("test-value").array() => 0x746573742D76616C756500 having an additional ending 0x00
Signed-off-by: diego Dupin <diego.dupin@gmail.com>

[resolves #264]

Signed-off-by: Mark Paluch <mpaluch@vmware.com>
@mp911de mp911de closed this in f6e2498 Feb 3, 2022
mp911de pushed a commit that referenced this pull request Feb 3, 2022
…sent UTF8 encoded bytes.

backing array ByteBuffer.array may not exactly represent UTF8 encoded bytes.
PR permit to ensure test is valid whatever the JVM is used

Example using jdk8:

"test-value".getBytes(StandardCharsets.UTF_8) => 0x746573742D76616C7565
StandardCharsets.UTF_8.encode("test-value").array() => 0x746573742D76616C756500 having an additional ending 0x00
Signed-off-by: diego Dupin <diego.dupin@gmail.com>

[resolves #264]

Signed-off-by: Mark Paluch <mpaluch@vmware.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants