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: FormatException when reading ProcessorFrequency #3541

Merged
merged 5 commits into from
Aug 24, 2024

Conversation

bitsandfoxes
Copy link
Contributor

Fixes #3540

@bitsandfoxes bitsandfoxes mentioned this pull request Aug 16, 2024
6 tasks
@bitsandfoxes bitsandfoxes changed the title fix: Reading ProcessorFrequency fix: FormatException when reading ProcessorFrequency Aug 16, 2024
Copy link
Collaborator

@jamescrosswell jamescrosswell left a comment

Choose a reason for hiding this comment

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

LGTM but would be good to update our unit tests to match as well.

// The Java SDK reports the processorFrequency as `double`
// Java https://github.com/getsentry/sentry-java/blob/9762f09afa51944b40a9b77e116a55e54636e6c5/sentry/src/main/java/io/sentry/protocol/Device.java#L130
int? processorFrequency = null;
var processorFrequencyProperty = json.GetPropertyOrNull("processor_frequency");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we change one of our tests as well (to make sure it works when deserialising a double)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

AFAIK, we don't have any tests for Device as it's not doing anything. But the type-mismatch is obvious from looking at the Java code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't want to argue against writing tests. I've added it to #3542

Copy link
Member

@bruno-garcia bruno-garcia left a comment

Choose a reason for hiding this comment

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

Just missing some tests that cover cases int, double and something invalid like string.

@jamescrosswell jamescrosswell merged commit de216fa into main Aug 24, 2024
23 checks passed
@jamescrosswell jamescrosswell deleted the fix/processor-frequency branch August 24, 2024 02:46
@jamescrosswell jamescrosswell mentioned this pull request Aug 29, 2024
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.

[Android] FormatException when reading "processor_frequency"
3 participants