Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Fix objects equal to null not being detected as null #11283

Merged
merged 1 commit into from
Sep 16, 2019
Merged

Fix objects equal to null not being detected as null #11283

merged 1 commit into from
Sep 16, 2019

Conversation

rafern
Copy link
Contributor

@rafern rafern commented Aug 20, 2019

This PR fixes flutter/flutter#37681 by allowing objects equal to null to be used in the StandardMessageCodec, since JSONObject.NULL.equals(null) is true

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

1 similar comment
@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@rafern
Copy link
Contributor Author

rafern commented Aug 20, 2019

@googlebot I signed it!

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

1 similar comment
@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@collinjackson
Copy link
Contributor

Would it be possible to include a test for this?

@rafern
Copy link
Contributor Author

rafern commented Aug 24, 2019

@collinjackson Sorry for the late response. Would a minimal flutter app that triggers the bug be enough as a test?

If so, I made an integration test on https://github.com/rafern/flutter_11283_test/tree/master/example. It should fail with the old branch and succeed with the new one

@Fallenstedt
Copy link

hi,

is it ridiculous of me to ask when this could get reviewed?

@cbracken
Copy link
Member

Thanks for your contribution! LGTM for the change. It would be good for us to check in a test that verifies we don't regress this in future.

Given the simplicity of this patch and the effect of not having it, I'm fine with landing as-is and following up with a separate patch to land a unit test in the engine to entire we don't regress this.

@mklim can provide details on how to write such a test.

Copy link
Contributor

@mklim mklim left a comment

Choose a reason for hiding this comment

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

LGTM, thank you for the fix!

I'm not 100% sure, but at a first look I think testing this should be relatively straightforward. Since the tests are new, I expect the most tedious part will be adding a new test file for StandardMessageCodec.java, following the steps described under "Adding a new test".

Then you'll want to create tests that get the main case of this PR, that null equivalent input values are written to the output ByteBuffer in encodeMessage as NULL. I'd create a test case passing in a value equaling null to encodeMessage and test that the output ByteBuffer had NULL written to it, like expected. I'd also double check while writing the test that it was red without the fix here, then green with it, just to make sure I was testing the right case.

There's much more in this class, but just that one minimal test case is enough to cover the fix in this PR.

@cbracken cbracken merged commit 63873d9 into flutter:master Sep 16, 2019
@cbracken
Copy link
Member

Merged. @rafern if you do get a moment to write a unit test, please send it along. If you don't think you'll have time to, let us know and I can try to find someone to author one so we don't regress this.

@rafern
Copy link
Contributor Author

rafern commented Sep 16, 2019

@cbracken Thank you for merging the PR. I will try to write a unit test tomorrow and inform you in case I fail to figure out how it works

@Fallenstedt
Copy link

Thank you so much everyone!

engine-flutter-autoroll added a commit to flutter/flutter that referenced this pull request Sep 16, 2019
[email protected]:flutter/engine.git/compare/8a8610a9a514...63873d9

git log 8a8610a..63873d9 --no-merges --oneline
2019-09-16 [email protected] Fix objects equal to null not being detected as null (flutter/engine#11283)
2019-09-16 [email protected] Reset NSNetService delegate to nil,when stop service. (flutter/engine#11270)


If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC [email protected] on the revert to ensure that a human
is aware of the problem.

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
@rafern rafern mentioned this pull request Sep 17, 2019
mklim pushed a commit that referenced this pull request Sep 17, 2019
Added tests for #11283. The itEncodesNullObjects test fails with the branch before the merge and succeeds with the master branch
Inconnu08 pushed a commit to Inconnu08/flutter that referenced this pull request Sep 30, 2019
[email protected]:flutter/engine.git/compare/8a8610a9a514...63873d9

git log 8a8610a..63873d9 --no-merges --oneline
2019-09-16 [email protected] Fix objects equal to null not being detected as null (flutter/engine#11283)
2019-09-16 [email protected] Reset NSNetService delegate to nil,when stop service. (flutter/engine#11270)


If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC [email protected] on the revert to ensure that a human
is aware of the problem.

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
@rafern
Copy link
Contributor Author

rafern commented Nov 1, 2019

@mklim @cbracken Would it be possible to include this patch as a hotfix for stable? Currently, the only way for my app to not crash is to use the dev channel

@Fallenstedt
Copy link

Fallenstedt commented Nov 18, 2019

Hello,

I am sorry to ping you all again, however, I agree with @rafern. Is there a way we can include this in a hotfix? I'm seeing this same issue arise in community packages. Developers are using firebase_auth with github/twitter etc to authenticate with firebase. The problem is these developers are using the stable channel while developing with Android, and are unable to build and test with Android.

See a discussion at: roughike/flutter_twitter_login#28

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

Successfully merging this pull request may close these issues.

firebase_auth Android crash when using the Github AuthProvider
6 participants