Saturday, July 30, 2011

[android-developers] Re: Curious NPE

By the way, the whole JSONException stuff is foobar-ed:

There is a way to avoid JSONException to be thrown by using the opt*
methods for reads, which I am doing now as I know that I created the
data and it must be there. But, there is no way to avoid catching the
JSONException on put* operations as it will check the arguments to be
NULL's and if they are, it throws the JSONException instead of just a
NPE.

On Jul 30, 9:27 pm, Zsolt Vasvari <zvasv...@gmail.com> wrote:
> > I'm curious what you mean by "stop the app"?  What are you doing to
> > recover, if anything?
>
> No, let the system Force Close the app, roll back by existing SQL
> transaction and let the user submit a bug report via the Error
> Reporting.
>
> > Actually, this is a pretty good specific case to talk about.
>
> > Are you loading JSON from or saving it to a file?  
>
> No, I am using JSON for state saving complex objects.  Not sure how
> the system implements that, it may save it to a file, I don't know, I
> don't care.
>
> > I'm curious what
> > would happen in the case that a write of a file in mid-stream failed.
>
> I hope an IOException would be thrown as one would hope the file
> system would catch that.
>
> > IOException, remove the file, and notify the user?
>
> No, why would I do that?  What the f*ck could the user do about it?
> That's the whole point of this discussion.  The user cannot do
> anything about the vast majoriy of these checked expections, so there
> is point of trying to recover from them gracefully?
>
> > I'm curious to know what was in the 95% that you got rid of and what
> > you did to deal with what were previously checked exceptions?
>
> I used to just propogate these checked execptions all the way to the
> point where I could no longer, at which poiint I displayed a pop-up
> window with the exception.  I am no longer doing that and just the let
> the system terminate the app.

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment