I posted an issue which is fixed:
http://code.google.com/p/android/issues/detail?id=63463
On Wednesday, October 30, 2013 12:48:12 PM UTC+2, MrMrs D wrote:
The preferences are apparently *cleared *when one tries to load them when
there is a null key which is bad ! Reproducer :
public
I quickly peeked into the source code and well, this is the way how it is
programmed. When an exception occurs while the preferences data file gets
read, SharedPreferences sets internally an empty map so you start from
scratch. I even dug a bit deeper. The XML serializer just ignores NULL keys
On Wednesday, October 30, 2013 7:44:17 PM UTC+2, Nobu Games wrote:
I quickly peeked into the source code and well, this is the way how it is
programmed. When an exception occurs while the preferences data file gets
read, SharedPreferences sets internally an empty map so you start from
Your question seems more to deal with intention rather than
complaining. I believe that Nobu's response was merely interpreting
the implementation and trying to interpret it, so there's no use in
trying to complain at him for providing a guess at something he didn't
even write.
kris
On Wed,
I did not mean to complain at Nobu - sorry if I sounded harsh :)
I just wanted to point out that my question was not so much *what *happens
but *why *- and also raise awareness to this buggy and unintuitive
behavior- or maybe have someone explain why this is so.
Should we post a bug report ?
I would honestly suspect that it's meant to be this way, and perhaps
the documentation is buggy. If you want, posting a bug report might
get some action by Android devs, if none of them respond here.
Kris
On Wed, Oct 30, 2013 at 3:39 PM, Palmer Eldritch the.u...@gmail.com wrote:
I did not
Why could one permit null keys - actually *one *null key - to have
afterwards* all the preferences cleared due to an exception *? Given that
the prefs are a persistence mechanism.
No it is at least an oversight - except if I am missing something
NB - I am talking about the default shared
I agree it's an oversight, and that at the very least there should be
something in the documentation to give the semantics in this case.
kris
On Wed, Oct 30, 2013 at 4:39 PM, Palmer Eldritch the.u...@gmail.com wrote:
Why could one permit null keys - actually one null key - to have afterwards
Starting over with shared prefs content when something goes wrong --
looks to me like a feature, and a useful one: sometimes storage goes
bad, files get corrupted, etc.
Being able to put null keys into shared prefs, and it triggering the
corruption handing code path later -- looks like a bug to
9 matches
Mail list logo