diff options
author | James Moger <james.moger@gitblit.com> | 2011-05-28 17:05:34 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2011-05-28 17:05:34 -0400 |
commit | 28d6b2a860740557bf93dd0f9a48d059379ed696 (patch) | |
tree | 1a32491a9d2d42e08c40dc6707ff4cf6112a1771 /src/com/gitblit/FileSettings.java | |
parent | 1f9daef870a8c7a984955166a542628d69012ed5 (diff) | |
download | gitblit-28d6b2a860740557bf93dd0f9a48d059379ed696.tar.gz gitblit-28d6b2a860740557bf93dd0f9a48d059379ed696.zip |
Unit testing. Removal of some unused code paths.
Diffstat (limited to 'src/com/gitblit/FileSettings.java')
-rw-r--r-- | src/com/gitblit/FileSettings.java | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/com/gitblit/FileSettings.java b/src/com/gitblit/FileSettings.java index e6fb9398..393e76c0 100644 --- a/src/com/gitblit/FileSettings.java +++ b/src/com/gitblit/FileSettings.java @@ -34,10 +34,16 @@ public class FileSettings implements IStoredSettings { private final Logger logger = LoggerFactory.getLogger(FileSettings.class);
+ private final File propertiesFile;
+
private Properties properties = new Properties();
private long lastread;
+ public FileSettings(String file) {
+ this.propertiesFile = new File(file);
+ }
+
@Override
public List<String> getAllKeys(String startingWith) {
startingWith = startingWith.toLowerCase();
@@ -138,15 +144,14 @@ public class FileSettings implements IStoredSettings { return strings;
}
- private synchronized Properties read() {
- File file = new File(Constants.PROPERTIES_FILE);
- if (file.exists() && (file.lastModified() > lastread)) {
+ private synchronized Properties read() {
+ if (propertiesFile.exists() && (propertiesFile.lastModified() > lastread)) {
FileInputStream is = null;
try {
properties = new Properties();
- is = new FileInputStream(Constants.PROPERTIES_FILE);
+ is = new FileInputStream(propertiesFile);
properties.load(is);
- lastread = file.lastModified();
+ lastread = propertiesFile.lastModified();
} catch (FileNotFoundException f) {
// IGNORE - won't happen because file.exists() check above
} catch (Throwable t) {
@@ -166,6 +171,6 @@ public class FileSettings implements IStoredSettings { @Override
public String toString() {
- return new File(Constants.PROPERTIES_FILE).getAbsolutePath();
+ return propertiesFile.getAbsolutePath();
}
}
|