You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2017/04/21 03:57:12 UTC
[13/17] james-project git commit: JAMES-2004 Fail when file not found
in PropertiesProvider
JAMES-2004 Fail when file not found in PropertiesProvider
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/9f7a4dc0
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/9f7a4dc0
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/9f7a4dc0
Branch: refs/heads/master
Commit: 9f7a4dc0c848042459f259192b8f50c813543830
Parents: fec6a27
Author: benwa <bt...@linagora.com>
Authored: Tue Apr 18 12:37:55 2017 +0700
Committer: benwa <bt...@linagora.com>
Committed: Fri Apr 21 08:27:41 2017 +0700
----------------------------------------------------------------------
.../main/java/org/apache/james/utils/PropertiesProvider.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/9f7a4dc0/server/container/guice/configuration/src/main/java/org/apache/james/utils/PropertiesProvider.java
----------------------------------------------------------------------
diff --git a/server/container/guice/configuration/src/main/java/org/apache/james/utils/PropertiesProvider.java b/server/container/guice/configuration/src/main/java/org/apache/james/utils/PropertiesProvider.java
index 780b5ee..d9a090a 100644
--- a/server/container/guice/configuration/src/main/java/org/apache/james/utils/PropertiesProvider.java
+++ b/server/container/guice/configuration/src/main/java/org/apache/james/utils/PropertiesProvider.java
@@ -19,6 +19,7 @@
package org.apache.james.utils;
+import java.io.File;
import java.io.FileNotFoundException;
import javax.inject.Inject;
@@ -41,6 +42,10 @@ public class PropertiesProvider {
public PropertiesConfiguration getConfiguration(String fileName) throws FileNotFoundException, ConfigurationException {
Preconditions.checkArgument(!Strings.isNullOrEmpty(fileName));
- return new PropertiesConfiguration(fileSystem.getFile(FileSystem.FILE_PROTOCOL_AND_CONF + fileName + ".properties"));
+ File file = fileSystem.getFile(FileSystem.FILE_PROTOCOL_AND_CONF + fileName + ".properties");
+ if (!file.exists()) {
+ throw new FileNotFoundException();
+ }
+ return new PropertiesConfiguration(file);
}
}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org