mirror of
https://github.com/moparisthebest/davmail
synced 2025-02-28 09:21:49 -05:00
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:
parent
3b2d225412
commit
d8eaa3bc0c
@ -65,7 +65,7 @@ public class DavGateway {
|
||||
DavGatewayTray.error(new BundleMessage("LOG_UNABLE_TO_CREATE_LOG_FILE_DIR"));
|
||||
}
|
||||
} 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();
|
||||
DavGatewayTray.info(new BundleMessage("LOG_DAVMAIL_GATEWAY_LISTENING",
|
||||
currentVersion==null?"":currentVersion, messages));
|
||||
currentVersion == null ? "" : currentVersion, messages));
|
||||
if (!errorMessages.isEmpty()) {
|
||||
DavGatewayTray.error(new BundleMessage("LOG_MESSAGE", errorMessages));
|
||||
}
|
||||
@ -152,27 +152,29 @@ public class DavGateway {
|
||||
|
||||
public static String getReleasedVersion() {
|
||||
String version = null;
|
||||
BufferedReader versionReader = null;
|
||||
HttpClient httpClient = DavGatewayHttpClientFacade.getInstance();
|
||||
GetMethod getMethod = new GetMethod(HTTP_DAVMAIL_SOURCEFORGE_NET_VERSION_TXT);
|
||||
try {
|
||||
httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(1000);
|
||||
int status = httpClient.executeMethod(getMethod);
|
||||
if (status == HttpStatus.SC_OK) {
|
||||
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
|
||||
if (!Settings.getBooleanProperty("davmail.disableUpdateCheck")) {
|
||||
BufferedReader versionReader = null;
|
||||
HttpClient httpClient = DavGatewayHttpClientFacade.getInstance();
|
||||
GetMethod getMethod = new GetMethod(HTTP_DAVMAIL_SOURCEFORGE_NET_VERSION_TXT);
|
||||
try {
|
||||
httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(1000);
|
||||
int status = httpClient.executeMethod(getMethod);
|
||||
if (status == HttpStatus.SC_OK) {
|
||||
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
|
||||
}
|
||||
}
|
||||
getMethod.releaseConnection();
|
||||
}
|
||||
getMethod.releaseConnection();
|
||||
}
|
||||
return version;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user