replace FileReader with FileInputStream (constructor not available before 1.6)

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@83 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2007-10-20 18:33:31 +00:00
parent 0f4a12b3c4
commit 28b3fccdf5
1 changed files with 6 additions and 9 deletions

View File

@ -3,10 +3,7 @@ package davmail;
import davmail.tray.DavGatewayTray; import davmail.tray.DavGatewayTray;
import java.util.Properties; import java.util.Properties;
import java.io.File; import java.io.*;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
/** /**
* Settings facade * Settings facade
@ -28,7 +25,7 @@ public class Settings {
} }
public static synchronized void load() { public static synchronized void load() {
FileReader fileReader = null; FileInputStream fileInputStream = null;
try { try {
if (configFilePath == null) { if (configFilePath == null) {
//noinspection AccessOfSystemProperties //noinspection AccessOfSystemProperties
@ -36,8 +33,8 @@ public class Settings {
} }
File configFile = new File(configFilePath); File configFile = new File(configFilePath);
if (configFile.exists()) { if (configFile.exists()) {
fileReader = new FileReader(configFile); fileInputStream = new FileInputStream(configFile);
SETTINGS.load(fileReader); SETTINGS.load(fileInputStream);
} else { } else {
isFirstStart = true; isFirstStart = true;
@ -57,9 +54,9 @@ public class Settings {
} catch (IOException e) { } catch (IOException e) {
DavGatewayTray.error("Unable to load settings: ", e); DavGatewayTray.error("Unable to load settings: ", e);
} finally { } finally {
if (fileReader != null) { if (fileInputStream != null) {
try { try {
fileReader.close(); fileInputStream.close();
} catch (IOException e) { } catch (IOException e) {
DavGatewayTray.debug("Error closing configuration file: ", e); DavGatewayTray.debug("Error closing configuration file: ", e);
} }