ahh... too many links for me to actually want to go through ;-) 
The first one is just a search, what's not to get there? It shows places 
where it found your search according to their source branch version and 
other (what it thinks are) related searches.

all the rest doesn't really matter.. who cares how ReceiverData is made? 
the code that uses it will throw an exception if the Intent part is null.

It's actually funny you care so much about it...if you'd go to such lengths 
to check such a minor thing, how can you get any code done? What promises 
you that Math.Min will always return the minimal value, or any value for 
that matter? How do you know that Activity.onCreate will get called with an 
Intent?




On Thursday, July 11, 2013 7:41:49 PM UTC+3, Palmer Eldritch wrote:
>
> a this is a step to the right direction ;)
> notice they don't check for null
>
> now any places the  ReceiverData object is initialized ?
>
> btw search in grepcode Sucks big time ! could you in the name of Mordor 
> tell me what I should make out from here : 
> http://grepcode.com/search?query=ReceiverData&n=
>
> compare : 
> http://androidxref.com/4.2.2_r1/search?q=ReceiverData&defs=&refs=&path=&hist=&project=abi&project=bionic&project=bootable&project=build&project=cts&project=dalvik&project=development&project=device&project=docs&project=external&project=frameworks&project=gdk&project=hardware&project=libcore&project=libnativehelper&project=ndk&project=packages&project=pdk&project=prebuilts&project=sdk&project=system
>
> In froyo the intent is just passed in :
>
>
> http://androidxref.com/2.2.3/xref/frameworks/base/core/java/android/app/ActivityThread.java#1563
>
> In 4.2.2 we have the same in a constructor : 
> http://androidxref.com/4.2.2_r1/xref/frameworks/base/core/java/android/app/ActivityThread.java#648
>
> Now scheduleReceiver we have in ApplicationThreadNative : 
> http://androidxref.com/4.2.2_r1/xref/frameworks/base/core/java/android/app/ApplicationThreadNative.java#758
>  and in ActivityThread : 
> http://androidxref.com/4.2.2_r1/xref/frameworks/base/core/java/android/app/ActivityThread.java#645
>
> What's the difference ?
>
> Anyway in ApplicationThreadNative it is called here 
> http://androidxref.com/4.2.2_r1/xref/frameworks/base/core/java/android/app/ApplicationThreadNative.java#197and
>  it is passed an intent from : 
>
>
> http://androidxref.com/4.2.2_r1/xref/frameworks/base/core/java/android/app/ApplicationThreadNative.java#189
>
> So Intent intent = Intent.CREATOR.createFromParcel(data);
>
> but this is where I give up - where is this "data" (a Parcel instance) 
> created ?
>
>
>
>
>
>
> On Thursday, July 11, 2013 5:54:07 PM UTC+3, Piren wrote:
>>
>> i'm pretty sure it's impossible to guarantee something like that... i 
>> don't think part of their new programmer orientation is "if you ever touch 
>> the code that runs BroadcastReceiver.onReceive...never send a null intent".
>>
>> Either way, at least on android 4.2.2_r1, it seems like it's impossible 
>> to get a null intent. feel free to verify this is true for all previous 
>> versions as well (and don't forget to keep checking this method every time 
>> they make a new build).
>>
>> http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.2.2_r1/android/app/ActivityThread.java#2335
>>
>>
>> On Thursday, July 11, 2013 4:09:27 PM UTC+3, Palmer Eldritch wrote:
>>>
>>> That's nice advice - but in this case I think one should have a guarantee
>>>
>>> Does it make sense to receive a null intent ? Is it even possible with 
>>> the current android code ?
>>>
>>> On Thursday, July 11, 2013 9:46:00 AM UTC+3, Piren wrote:
>>>>
>>>> No point of being sure here... even if the current code is structured 
>>>> in a way that it shouldn't be null, nothing says it will stay like that in 
>>>> all future code revisions.
>>>> Ever since i started getting null exceptions from android (not 
>>>> NullPointerException... a Null instead of an exception) i learned it's 
>>>> always a good idea to check for nulls when you're supposed to receive an 
>>>> object.
>>>>
>>>> On Thursday, July 11, 2013 6:01:13 AM UTC+3, Palmer Eldritch wrote:
>>>>>
>>>>> I suspect it can't be null *by construction* - I just can't pin it 
>>>>> down in code (or in docs)
>>>>>
>>>>> It's nice to be sure
>>>>>
>>>>> Can somebody point to the relevant code parts ?
>>>>>
>>>>> I mean what paths lead to the onReceive being triggered ? Can we have 
>>>>> a null intent in any of them ?
>>>>>
>>>>> On Thursday, July 11, 2013 4:18:09 AM UTC+3, TreKing wrote:
>>>>>>
>>>>>>
>>>>>> On Wed, Jul 10, 2013 at 4:14 PM, Palmer Eldritch 
>>>>>> <the....@gmail.com>wrote:
>>>>>>
>>>>>>> I mean nobody knows ??
>>>>>>>
>>>>>>> Do you ever check the intent for being null and if not why ?
>>>>>>>
>>>>>>
>>>>>> Here's what you do. Assume it will not be null, then use ACRA or some 
>>>>>> other bug-reporting tool to handle uncaught exceptions. If you get a 
>>>>>> null 
>>>>>> pointer exception from here, you know it can be null.
>>>>>>
>>>>>> You're welcome.
>>>>>>
>>>>>>
>>>>>> -------------------------------------------------------------------------------------------------
>>>>>> TreKing <http://sites.google.com/site/rezmobileapps/treking> - 
>>>>>> Chicago transit tracking app for Android-powered devices
>>>>>>  
>>>>>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to