Skip to content

Make stripeError transient on StripeException #834

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

Merged
merged 1 commit into from
Aug 30, 2019

Conversation

ob-stripe
Copy link
Contributor

r? @brandur-stripe
cc @stripe/api-libraries

Make stripeError transient on StripeException. This ensures that StripeException is serializable, as it implements the Serializable interface (all exceptions do) and StripeObjects are not serializable.

I briefly considered making StripeObjects serializable, but it seems like the general consensus is that Java's serialization mechanism is flawed and shouldn't be used in new code (https://stackoverflow.com/a/53889695/5307473) so this is the easiest fix.

Fixes #832.

@brandur-stripe
Copy link
Contributor

Wow, TIL. Sorry for the nit, but mind throwing a comment on there that indicates that the transient flag allows the class to be serializable because StripeError is not? Would never have understood that by looking at it if you hadn't explained it in the PR description.

@brandur-stripe
Copy link
Contributor

ptal @ob-stripe

@ob-stripe ob-stripe force-pushed the ob-exception-serializable branch from e7e5639 to 2bdcd1b Compare August 30, 2019 18:33
@ob-stripe
Copy link
Contributor Author

mind throwing a comment on there that indicates that the transient flag allows the class to be serializable because StripeError is not?

Done!

@ob-stripe ob-stripe merged commit 7667311 into master Aug 30, 2019
@ob-stripe ob-stripe deleted the ob-exception-serializable branch August 30, 2019 18:59
@ob-stripe
Copy link
Contributor Author

Released as 11.5.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

StripeException implements Serializable, but its stripeError field is not serializable
2 participants