(refs #380)Close stream certainly

This commit is contained in:
Naoki Takezoe
2014-06-02 16:04:45 +09:00
parent e2fd7d9d8e
commit 6d6f529d40

View File

@@ -43,7 +43,10 @@ trait SystemSettingsService {
ldap.keystore.foreach(x => props.setProperty(LdapKeystore, x))
}
}
props.store(new java.io.FileOutputStream(GitBucketConf), null)
using(new java.io.FileOutputStream(GitBucketConf)) {
out =>
props.store(out, null)
}
}
}
@@ -51,7 +54,10 @@ trait SystemSettingsService {
def loadSystemSettings(): SystemSettings = {
defining(new java.util.Properties()){ props =>
if(GitBucketConf.exists){
props.load(new java.io.FileInputStream(GitBucketConf))
using(new java.io.FileInputStream(GitBucketConf)) {
in =>
props.load(in)
}
}
SystemSettings(
getOptionValue[String](props, BaseURL, None).map(x => x.replaceFirst("/\\Z", "")),