Merge "Suppress expected exception due to missing network_watchlist.xml" into pi-dev

This commit is contained in:
Ricky Wai
2018-03-27 14:48:52 +00:00
committed by Android (Google) Code Review
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);