Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 78278d4f authored by Philip P. Moltmann's avatar Philip P. Moltmann
Browse files

Issue a warning if SharedPreferences are corrupted

We already only issue a warning if the xml cannot be parsed. So if the
xml could be parsed by the result could not be cast to a map, we should
also only issue a warning.

Also log the corrupted file as this is called on an async thread and it
is not clear what file is affected.

Bug: 29006064
Test: Just logging changes.
Change-Id: I503fd4ee9b905f72668136b4d98c819cd7f9021b
parent ba1c72b0
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -139,8 +139,8 @@ final class SharedPreferencesImpl implements SharedPreferences {
                    str = new BufferedInputStream(
                            new FileInputStream(mFile), 16*1024);
                    map = XmlUtils.readMapXml(str);
                } catch (XmlPullParserException | IOException e) {
                    Log.w(TAG, "getSharedPreferences", e);
                } catch (Exception e) {
                    Log.w(TAG, "Cannot read " + mFile.getAbsolutePath(), e);
                } finally {
                    IoUtils.closeQuietly(str);
                }