Fix bug 2797272: Add disable update check

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@580 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2009-06-09 19:50:13 +00:00
parent 3b2d225412
commit d8eaa3bc0c
1 changed files with 23 additions and 21 deletions

View File

@ -65,7 +65,7 @@ public class DavGateway {
DavGatewayTray.error(new BundleMessage("LOG_UNABLE_TO_CREATE_LOG_FILE_DIR")); DavGatewayTray.error(new BundleMessage("LOG_UNABLE_TO_CREATE_LOG_FILE_DIR"));
} }
} catch (IOException e) { } catch (IOException e) {
DavGatewayTray.error(new BundleMessage("LOG_UNABLE_TO_SET_LOG_FILE_PATH")); DavGatewayTray.error(new BundleMessage("LOG_UNABLE_TO_SET_LOG_FILE_PATH"));
} }
} }
@ -117,7 +117,7 @@ public class DavGateway {
String currentVersion = getCurrentVersion(); String currentVersion = getCurrentVersion();
DavGatewayTray.info(new BundleMessage("LOG_DAVMAIL_GATEWAY_LISTENING", DavGatewayTray.info(new BundleMessage("LOG_DAVMAIL_GATEWAY_LISTENING",
currentVersion==null?"":currentVersion, messages)); currentVersion == null ? "" : currentVersion, messages));
if (!errorMessages.isEmpty()) { if (!errorMessages.isEmpty()) {
DavGatewayTray.error(new BundleMessage("LOG_MESSAGE", errorMessages)); DavGatewayTray.error(new BundleMessage("LOG_MESSAGE", errorMessages));
} }
@ -152,27 +152,29 @@ public class DavGateway {
public static String getReleasedVersion() { public static String getReleasedVersion() {
String version = null; String version = null;
BufferedReader versionReader = null; if (!Settings.getBooleanProperty("davmail.disableUpdateCheck")) {
HttpClient httpClient = DavGatewayHttpClientFacade.getInstance(); BufferedReader versionReader = null;
GetMethod getMethod = new GetMethod(HTTP_DAVMAIL_SOURCEFORGE_NET_VERSION_TXT); HttpClient httpClient = DavGatewayHttpClientFacade.getInstance();
try { GetMethod getMethod = new GetMethod(HTTP_DAVMAIL_SOURCEFORGE_NET_VERSION_TXT);
httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(1000); try {
int status = httpClient.executeMethod(getMethod); httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(1000);
if (status == HttpStatus.SC_OK) { int status = httpClient.executeMethod(getMethod);
versionReader = new BufferedReader(new InputStreamReader(getMethod.getResponseBodyAsStream())); if (status == HttpStatus.SC_OK) {
version = versionReader.readLine(); versionReader = new BufferedReader(new InputStreamReader(getMethod.getResponseBodyAsStream()));
} version = versionReader.readLine();
} catch (IOException e) {
DavGatewayTray.debug(new BundleMessage("LOG_UNABLE_TO_GET_RELEASED_VERSION"));
} finally {
if (versionReader != null) {
try {
versionReader.close();
} catch (IOException e) {
// ignore
} }
} catch (IOException e) {
DavGatewayTray.debug(new BundleMessage("LOG_UNABLE_TO_GET_RELEASED_VERSION"));
} finally {
if (versionReader != null) {
try {
versionReader.close();
} catch (IOException e) {
// ignore
}
}
getMethod.releaseConnection();
} }
getMethod.releaseConnection();
} }
return version; return version;
} }