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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

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
@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.

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