1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-13 11:12:22 -05:00

configFilePath is null in some test cases

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1517 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-10-26 21:03:47 +00:00
parent 4547ee7870
commit cf98558e81

View File

@ -259,7 +259,7 @@ public final class Settings {
// disable ConsoleAppender in gui mode
if (!Settings.getBooleanProperty("davmail.server")) {
ConsoleAppender consoleAppender = (ConsoleAppender)rootLogger.getAppender("ConsoleAppender");
ConsoleAppender consoleAppender = (ConsoleAppender) rootLogger.getAppender("ConsoleAppender");
if (consoleAppender != null) {
consoleAppender.setThreshold(Level.OFF);
}
@ -280,18 +280,21 @@ public final class Settings {
* Save settings in current file path (command line or default).
*/
public static synchronized void save() {
FileOutputStream fileOutputStream = null;
try {
fileOutputStream = new FileOutputStream(configFilePath);
SETTINGS.store(fileOutputStream, "DavMail settings");
} catch (IOException e) {
DavGatewayTray.error(new BundleMessage("LOG_UNABLE_TO_STORE_SETTINGS"), e);
} finally {
if (fileOutputStream != null) {
try {
fileOutputStream.close();
} catch (IOException e) {
DavGatewayTray.debug(new BundleMessage("LOG_ERROR_CLOSING_CONFIG_FILE"), e);
// configFilePath is null in some test cases
if (configFilePath != null) {
FileOutputStream fileOutputStream = null;
try {
fileOutputStream = new FileOutputStream(configFilePath);
SETTINGS.store(fileOutputStream, "DavMail settings");
} catch (IOException e) {
DavGatewayTray.error(new BundleMessage("LOG_UNABLE_TO_STORE_SETTINGS"), e);
} finally {
if (fileOutputStream != null) {
try {
fileOutputStream.close();
} catch (IOException e) {
DavGatewayTray.debug(new BundleMessage("LOG_ERROR_CLOSING_CONFIG_FILE"), e);
}
}
}
}