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

Avoid illegal-mutation error #2037

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,10 @@
case "BYTES":
verify(v instanceof ByteBuffer, "Expected ByteBuffer, got %s", v.getClass());
ByteBuffer byteBuffer = (ByteBuffer) v;
// Prevent inplace modifications of the byte buffer by the .get() method
ByteBuffer readOnlyBuffer = byteBuffer.asReadOnlyBuffer();

Check warning on line 390 in v2/kafka-to-bigquery/src/main/java/com/google/cloud/teleport/v2/utils/BigQueryAvroUtils.java

View check run for this annotation

Codecov / codecov/patch

v2/kafka-to-bigquery/src/main/java/com/google/cloud/teleport/v2/utils/BigQueryAvroUtils.java#L390

Added line #L390 was not covered by tests
byte[] bytes = new byte[byteBuffer.limit()];
byteBuffer.get(bytes);
readOnlyBuffer.get(bytes);

Check warning on line 392 in v2/kafka-to-bigquery/src/main/java/com/google/cloud/teleport/v2/utils/BigQueryAvroUtils.java

View check run for this annotation

Codecov / codecov/patch

v2/kafka-to-bigquery/src/main/java/com/google/cloud/teleport/v2/utils/BigQueryAvroUtils.java#L392

Added line #L392 was not covered by tests
return BaseEncoding.base64().encode(bytes);
default:
throw new UnsupportedOperationException(
Expand Down
Loading