Don't choke on proxy detection if allow_offline = true.

This unfortunately relies on _app.init() happening *inside* detect proxy in the
particular code path that results in failed proxy detection. I wish app.init
wasn't such a twisty maze of spaghetti, but that ship has long since sailed.
This commit is contained in:
Michael Bayne
2014-04-09 07:15:47 -07:00
parent 6134d3a967
commit df4eabbf09
2 changed files with 11 additions and 1 deletions
@@ -829,6 +829,14 @@ public class Application
return _optimumJvmArgs != null;
}
/**
* Returns true if the app should attempt to run even if we have no Internet connection.
*/
public boolean allowOffline ()
{
return _allowOffline;
}
/**
* Attempts to redownload the <code>getdown.txt</code> file based on information parsed from a
* previous call to {@link #init}.
@@ -162,7 +162,9 @@ public abstract class Getdown extends Thread
try {
_dead = false;
if (detectProxy()) {
// if we fail to detect a proxy, but we're allowed to run offline, then go ahead and
// run the app anyway because we're prepared to cope with not being able to update
if (detectProxy() || _app.allowOffline()) {
getdown();
} else if (_silent) {
log.warning("Need a proxy, but we don't want to bother anyone. Exiting.");