Suppress expected exception due to missing network_watchlist.xml

Test: NULL
Bug:73264037
Change-Id: I640ad865fe85191f7d9e5fe887be10884c7bb801
This commit is contained in:
Ricky Wai
2018-03-23 18:05:49 +00:00
parent b133cbfd0b
commit aff0bc189a
2 changed files with 9 additions and 1 deletions

View File

@@ -107,6 +107,10 @@ class WatchlistConfig {
* Reload watchlist by reading config file.
*/
public void reloadConfig() {
if (!mXmlFile.exists()) {
// No config file
return;
}
try (FileInputStream stream = new FileInputStream(mXmlFile)){
final List<byte[]> crc32DomainList = new ArrayList<>();
final List<byte[]> sha256DomainList = new ArrayList<>();

View File

@@ -87,6 +87,10 @@ class WatchlistSettings {
}
public void reloadSettings() {
if (!mXmlFile.exists()) {
// No settings config
return;
}
try (FileInputStream stream = mXmlFile.openRead()){
XmlPullParser parser = Xml.newPullParser();
parser.setInput(stream, StandardCharsets.UTF_8.name());
@@ -97,7 +101,7 @@ class WatchlistSettings {
mPrivacySecretKey = parseSecretKey(parser);
}
}
Log.i(TAG, "Reload watchlist settings done");
Slog.i(TAG, "Reload watchlist settings done");
} catch (IllegalStateException | NullPointerException | NumberFormatException |
XmlPullParserException | IOException | IndexOutOfBoundsException e) {
Slog.e(TAG, "Failed parsing xml", e);