From fc0b38d422230fda94bc8d4f2e0f5a361e2e2933 Mon Sep 17 00:00:00 2001 From: Jacksgong Date: Wed, 20 Apr 2016 00:45:38 +0800 Subject: [PATCH] feat(filedownloader.properties): handle the known FileNotFound exception when loading the filedownloader.properties --- .../filedownloader/services/FileDownloadService.java | 2 +- .../filedownloader/util/FileDownloadProperties.java | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/library/src/main/java/com/liulishuo/filedownloader/services/FileDownloadService.java b/library/src/main/java/com/liulishuo/filedownloader/services/FileDownloadService.java index 1b9f03f4..a1ea71e0 100644 --- a/library/src/main/java/com/liulishuo/filedownloader/services/FileDownloadService.java +++ b/library/src/main/java/com/liulishuo/filedownloader/services/FileDownloadService.java @@ -33,7 +33,7 @@ * FileDownloadService runs in the main process, and by default the FileDownloadService runs in the * separate `:filedownloader` process. */ -public class FileDownloadService extends Service { +public class FileDownloadService extends Service { private IFileDownloadServiceHandler handler; diff --git a/library/src/main/java/com/liulishuo/filedownloader/util/FileDownloadProperties.java b/library/src/main/java/com/liulishuo/filedownloader/util/FileDownloadProperties.java index 91b65c7f..a738cdc1 100644 --- a/library/src/main/java/com/liulishuo/filedownloader/util/FileDownloadProperties.java +++ b/library/src/main/java/com/liulishuo/filedownloader/util/FileDownloadProperties.java @@ -15,6 +15,7 @@ */ package com.liulishuo.filedownloader.util; +import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.util.Properties; @@ -139,7 +140,13 @@ public FileDownloadProperties() { downloadMaxNetworkThreadCount = p.getProperty(KEY_DOWNLOAD_MAX_NETWORK_THREAD_COUNT); } } catch (IOException e) { - e.printStackTrace(); + if (e instanceof FileNotFoundException) { + if (FileDownloadLog.NEED_LOG) { + FileDownloadLog.d(FileDownloadProperties.class, "not found filedownloader.properties"); + } + } else { + e.printStackTrace(); + } } finally { if (inputStream != null) { try {