diff options
author | Roshan Pius <rpius@google.com> | 2019-08-22 08:59:55 -0700 |
---|---|---|
committer | Roshan Pius <rpius@google.com> | 2019-08-23 09:44:09 -0700 |
commit | 6817839c81bdfd9a2a0da32edecafc4ba6ed41b4 (patch) | |
tree | 21be272143406d6ddd2c333b57fcce32d79a536b /tests | |
parent | e266f070cf3159993e0858daaddaa4a73043c15e (diff) |
WifiConfigStore: Skip unknown sections from XML
If we delete a module which previously stored some data in the config
store, we need to gracefully handle such transitions on upgrading
devices. Instead of aborting when we find a section with no
corresponding StoreData instead, gracefully skip that section entirely.
Bug: 139866000
Test: atest com.android.server.wifi.WifiConfigStoreTest
Test: Verified that the error seen on my local device in the linked bug
is no longer seen and the rest of the user store data was parsed
correctly.
Change-Id: Ia09fb1e720a46337da610e7f0ee3975b837a3aee
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiConfigStoreTest.java | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigStoreTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigStoreTest.java index 7d8695b34..5436ded65 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiConfigStoreTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigStoreTest.java @@ -746,13 +746,10 @@ public class WifiConfigStoreTest { } /** - * Verify that a XmlPullParserException will be thrown when reading an user store file - * containing unknown data. - * - * @throws Exception + * Verify that we gracefully skip unknown section when reading an user store file. */ - @Test(expected = XmlPullParserException.class) - public void testReadUserStoreContainedUnknownData() throws Exception { + @Test + public void testReadUserStoreContainedUnknownSection() throws Exception { String storeFileData = "<?xml version='1.0' encoding='utf-8' standalone='yes' ?>\n" + "<WifiConfigStoreData>\n" @@ -765,13 +762,10 @@ public class WifiConfigStoreTest { } /** - * Verify that a XmlPullParserException will be thrown when reading the share store file - * containing unknown data. - * - * @throws Exception + * Verify that we gracefully skip unknown section when reading a shared store file. */ - @Test(expected = XmlPullParserException.class) - public void testReadShareStoreContainedUnknownData() throws Exception { + @Test + public void testReadShareStoreContainedUnknownSection() throws Exception { String storeFileData = "<?xml version='1.0' encoding='utf-8' standalone='yes' ?>\n" + "<WifiConfigStoreData>\n" |