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

Deserialization validation #1571

Merged
merged 5 commits into from
Nov 27, 2024

Conversation

LikeTheSalad
Copy link
Contributor

Description:

Adding validations for cases when trying to deserialize contents from a corrupted file. These changes aim to remove the corrupted file in those cases while avoiding throwing any exceptions to the caller.

Existing Issue(s):

open-telemetry/opentelemetry-android#457

Testing:

Unit tests

Documentation:

Outstanding items:

@LikeTheSalad LikeTheSalad requested a review from a team as a code owner November 26, 2024 13:49
@github-actions github-actions bot requested a review from zeitlinger November 26, 2024 13:50
@zeitlinger zeitlinger removed their assignment Nov 27, 2024
@@ -88,12 +89,23 @@ void verifyStorageFolderIsCreated() {
assertThat(new File(rootDir, STORAGE_FOLDER_NAME).exists()).isTrue();
}

@Test
void whenDeserializationFails_returnFalse() throws IOException {
when(deserializer.deserialize(any()))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: doThrow is simpler

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I added the changes.

@trask trask merged commit b2f04ab into open-telemetry:main Nov 27, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants