Last Comment Bug 898044 - GeckoApp.onSaveInstanceState has an unnecessary null check for the bundle
: GeckoApp.onSaveInstanceState has an unnecessary null check for the bundle
Status: RESOLVED FIXED
[mentor=kats][good first bug][lang=java]
:
Product: Firefox for Android
Classification: Client Software
Component: General (show other bugs)
: unspecified
: All Android
: -- normal (vote)
: Firefox 25
Assigned To: Ming
: general
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-07-25 10:45 PDT by (Back on May31) Kartikaya Gupta (email:kats@mozilla.com)
Modified: 2013-07-31 10:45 PDT (History)
2 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
name.patch: delete the null check in GeckoApp.onSaveInstanceState (1.02 KB, patch)
2013-07-27 23:06 PDT, Ming
bugmail.mozilla: review+
Details | Diff | Review
Remove the unnecessary null check in GeckoApp.onSaveInstanceState (1.01 KB, patch)
2013-07-30 21:32 PDT, Ming
zmssghh: review+
Details | Diff | Review

Description (Back on May31) Kartikaya Gupta (email:kats@mozilla.com) 2013-07-25 10:45:08 PDT
http://hg.mozilla.org/mozilla-central/file/8196c86355bc/mobile/android/base/GeckoApp.java#l491

I believe the null check is unnecessary. However, if the Bundle can be null, then creating a new Bundle is pointless because the new bundle will never be saved. outState is not actually an out-variable like a C pointer; it is a Java reference and the calling code will never know about the created Bundle.

Code was originally added in http://hg.mozilla.org/mozilla-central/rev/a9c28fe6b23f and doesn't look like it was added in response to a specific NPE so I'd like to just remove it.
Comment 1 Ming 2013-07-26 00:04:59 PDT
Hi Kartikaya,

This is Ming and I am new to Firefox Android. I have looked at this bug and it seems to be quite easy. I am wondering whether I can take it? I think this bug would be a great start for me to begin learning the code base.

I am following the Fennec building wiki right now to get the source code. I am wondering whether I need to have an android phone/tablet to work with it? Any suggestions would be very helpful.

Thanks.
Comment 2 Ming 2013-07-26 00:06:02 PDT
Hi Kartikaya,

This is Ming and I am new to Firefox Android. I have looked at this bug and it seems to be quite easy. I am wondering whether I can take it? I think this bug would be a great start for me to begin learning the code base.

I am following the Fennec building wiki right now to get the source code. I am wondering whether I need to have an android phone/tablet to work with it? Any suggestions would be very helpful.

Thanks.

(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #0)
> http://hg.mozilla.org/mozilla-central/file/8196c86355bc/mobile/android/base/
> GeckoApp.java#l491
> 
> I believe the null check is unnecessary. However, if the Bundle can be null,
> then creating a new Bundle is pointless because the new bundle will never be
> saved. outState is not actually an out-variable like a C pointer; it is a
> Java reference and the calling code will never know about the created Bundle.
> 
> Code was originally added in
> http://hg.mozilla.org/mozilla-central/rev/a9c28fe6b23f and doesn't look like
> it was added in response to a specific NPE so I'd like to just remove it.
Comment 3 (Back on May31) Kartikaya Gupta (email:kats@mozilla.com) 2013-07-26 05:25:21 PDT
Hi Ming,

The first thing to do, which you mentioned, is to follow the steps on the wiki page at https://wiki.mozilla.org/Mobile/Fennec/Android#Building_Fennec to get your fennec build environment set up. In general when working on Fennec it is useful to have an actual android device, but this specific bug is simple enough that you should be able to just use the emulator.

There are instructions on how to set up the emulator so that Fennec runs on it at https://wiki.mozilla.org/Mobile/Fennec/Android/Emulator

If you have any trouble you can always ask questions in #mobile on IRC or post here.
Comment 4 Ming 2013-07-27 23:06:28 PDT
Created attachment 782222 [details] [diff] [review]
name.patch: delete the null check in GeckoApp.onSaveInstanceState
Comment 5 Ming 2013-07-27 23:14:49 PDT
Hi Kartikaya,

I have generate the patch with "hg qnew name.patch" and uploaded here. Since there are too much info on the wiki page, I cannot figure out what to do next for this bug. I am wondering what test should i run for this change? Also, I currently have a nexus 7 but it is not rooted. The wiki page mentioned that it is troublesome to run test with an unrooted device. Is there other ways to run the required test?

Also, some suggestion on how to begin learning the code base would be very helpful :)

Thanks,
Ming


(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #3)
> Hi Ming,
> 
> The first thing to do, which you mentioned, is to follow the steps on the
> wiki page at https://wiki.mozilla.org/Mobile/Fennec/Android#Building_Fennec
> to get your fennec build environment set up. In general when working on
> Fennec it is useful to have an actual android device, but this specific bug
> is simple enough that you should be able to just use the emulator.
> 
> There are instructions on how to set up the emulator so that Fennec runs on
> it at https://wiki.mozilla.org/Mobile/Fennec/Android/Emulator
> 
> If you have any trouble you can always ask questions in #mobile on IRC or
> post here.
Comment 6 (Back on May31) Kartikaya Gupta (email:kats@mozilla.com) 2013-07-28 09:31:47 PDT
(In reply to Ming from comment #5)
> Hi Kartikaya,
> 
> I have generate the patch with "hg qnew name.patch" and uploaded here.

That looks good, thanks.

> Since
> there are too much info on the wiki page, I cannot figure out what to do
> next for this bug.

When you upload a patch that is ready for review, you should set the review flags on it. In the attachment details there is a "review" setting - set the value of that to "?" and put my name in the reviewer field (you can just type in ":kats" in the field and it should autocomplete it).

> I am wondering what test should i run for this change?
> Also, I currently have a nexus 7 but it is not rooted. The wiki page
> mentioned that it is troublesome to run test with an unrooted device. Is
> there other ways to run the required test?

Since this is a pretty simple change, just exercising the codepath on your device should be enough. Make a build with this change applied, put it on your N7 device, start Fennec, and then put fennec in the background using the home button. This should run through the onSaveInstanceState code and make sure that no NullPointerException is thrown. As long as you do that I'm satisfied that it shouldn't break anything.

> Also, some suggestion on how to begin learning the code base would be very
> helpful :)

Well the codebase is pretty large so I would say to pick concrete goals that you would like to do. If there are other bugs that you are interested in fixing then that's a great way to continue learning the codebase. If you want to implement a new feature or customization that's also a good way.
Comment 7 Ming 2013-07-29 00:03:05 PDT
Hi Kartikaya,

Thanks for the help. I would prefer helping to fix some other simple bugs first in order to learn the codebase. Since I haven't done any android app development before, I guess the curve maybe a little bit difficult for me. 

I am wondering whether there is some document about the overall architecture of the codebase? I think maybe it's better for me to learn about the general work flow of this app before look into more details.

Thanks,
Ming

(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #6)
> (In reply to Ming from comment #5)
> > Hi Kartikaya,
> > 
> > I have generate the patch with "hg qnew name.patch" and uploaded here.
> 
> That looks good, thanks.
> 
> > Since
> > there are too much info on the wiki page, I cannot figure out what to do
> > next for this bug.
> 
> When you upload a patch that is ready for review, you should set the review
> flags on it. In the attachment details there is a "review" setting - set the
> value of that to "?" and put my name in the reviewer field (you can just
> type in ":kats" in the field and it should autocomplete it).
> 
> > I am wondering what test should i run for this change?
> > Also, I currently have a nexus 7 but it is not rooted. The wiki page
> > mentioned that it is troublesome to run test with an unrooted device. Is
> > there other ways to run the required test?
> 
> Since this is a pretty simple change, just exercising the codepath on your
> device should be enough. Make a build with this change applied, put it on
> your N7 device, start Fennec, and then put fennec in the background using
> the home button. This should run through the onSaveInstanceState code and
> make sure that no NullPointerException is thrown. As long as you do that I'm
> satisfied that it shouldn't break anything.
> 
> > Also, some suggestion on how to begin learning the code base would be very
> > helpful :)
> 
> Well the codebase is pretty large so I would say to pick concrete goals that
> you would like to do. If there are other bugs that you are interested in
> fixing then that's a great way to continue learning the codebase. If you
> want to implement a new feature or customization that's also a good way.
Comment 8 (Back on May31) Kartikaya Gupta (email:kats@mozilla.com) 2013-07-29 06:58:42 PDT
Comment on attachment 782222 [details] [diff] [review]
name.patch: delete the null check in GeckoApp.onSaveInstanceState

Review of attachment 782222 [details] [diff] [review]:
-----------------------------------------------------------------

The patch itself is fine, but the commit message should indicate what the patch is doing rather than re-stating the title of the bug. In this case the commit message should be something like "Remove unnecessary null check from GeckoApp.onSaveInstanceState".

Please upload a new patch with the updated commit message. You can carry forward this r+ but just setting the review flag to "+" on your new patch, and add the "checkin-needed" keyword to the bug to get it committed by one of the sheriffs.
Comment 9 (Back on May31) Kartikaya Gupta (email:kats@mozilla.com) 2013-07-29 07:04:13 PDT
(In reply to Ming from comment #7)
> Hi Kartikaya,
> 
> Thanks for the help. I would prefer helping to fix some other simple bugs
> first in order to learn the codebase. Since I haven't done any android app
> development before, I guess the curve maybe a little bit difficult for me. 
> 

Well you're doing great so far! You can find other simple bugs by looking around on Bugs Ahoy - http://www.joshmatthews.net/bugsahoy/. Just find a bug that looks simple and interests you, and comment on the bug much like you did on this one to get started!

> I am wondering whether there is some document about the overall architecture
> of the codebase? I think maybe it's better for me to learn about the general
> work flow of this app before look into more details.

There isn't a whole lot of documentation, unfortunately. There's some scraps at https://wiki.mozilla.org/Mobile/Fennec/Android#Hacking which might be useful but keep in mind that some of it might be out of date.
Comment 10 Ming 2013-07-30 21:32:28 PDT
Created attachment 783549 [details] [diff] [review]
Remove the unnecessary null check in GeckoApp.onSaveInstanceState
Comment 11 (Back on May31) Kartikaya Gupta (email:kats@mozilla.com) 2013-07-31 05:33:55 PDT
Sorry, I should have been more clear - you should also keep the bug number in the commit message. But that's ok, I added the bug number and landed the patch for you:

https://hg.mozilla.org/integration/mozilla-inbound/rev/7d9b658f6840

Thanks!
Comment 12 Ryan VanderMeulen [:RyanVM] 2013-07-31 10:45:27 PDT
https://hg.mozilla.org/mozilla-central/rev/7d9b658f6840

Note You need to log in before you can comment on or make changes to this bug.