Converted Getdown over to the new samskivert Logger. Added a patch from Elias
to recreate getdown.txt using the information provided to the applet if the version on the filesystem is corrupt or references an old appbase.
This commit is contained in:
@@ -20,8 +20,7 @@
|
||||
|
||||
package com.threerings.getdown;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import com.samskivert.util.Logger;
|
||||
|
||||
/**
|
||||
* A placeholder class that contains a reference to the log object used by the Getdown code.
|
||||
@@ -30,28 +29,4 @@ public class Log
|
||||
{
|
||||
/** We dispatch our log messages through this logger. */
|
||||
public static Logger log = Logger.getLogger("com.threerings.getdown");
|
||||
|
||||
/** Convenience function. */
|
||||
public static void debug (String message)
|
||||
{
|
||||
log.fine(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void info (String message)
|
||||
{
|
||||
log.info(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void warning (String message)
|
||||
{
|
||||
log.warning(message);
|
||||
}
|
||||
|
||||
/** Convenience function. */
|
||||
public static void logStackTrace (Throwable t)
|
||||
{
|
||||
log.log(Level.WARNING, t.getMessage(), t);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ import com.samskivert.text.MessageUtil;
|
||||
import com.samskivert.util.ArrayIntSet;
|
||||
import com.samskivert.util.RunAnywhere;
|
||||
import com.samskivert.util.StringUtil;
|
||||
import com.threerings.getdown.Log;
|
||||
|
||||
import com.threerings.getdown.launcher.RotatingBackgrounds;
|
||||
import com.threerings.getdown.util.ConfigUtil;
|
||||
import com.threerings.getdown.util.FileUtil;
|
||||
@@ -72,6 +72,8 @@ import com.threerings.getdown.util.LaunchUtil;
|
||||
import com.threerings.getdown.util.MetaProgressObserver;
|
||||
import com.threerings.getdown.util.ProgressObserver;
|
||||
|
||||
import static com.threerings.getdown.Log.log;
|
||||
|
||||
/**
|
||||
* Parses and provide access to the information contained in the <code>getdown.txt</code>
|
||||
* configuration file.
|
||||
@@ -293,7 +295,7 @@ public class Application
|
||||
public Resource getPatchResource (String auxgroup)
|
||||
{
|
||||
if (_targetVersion <= _version) {
|
||||
Log.warning("Requested patch resource for up-to-date or non-versioned application " +
|
||||
log.warning("Requested patch resource for up-to-date or non-versioned application " +
|
||||
"[cvers=" + _version + ", tvers=" + _targetVersion + "].");
|
||||
return null;
|
||||
}
|
||||
@@ -304,7 +306,7 @@ public class Application
|
||||
URL remote = new URL(createVAppBase(_targetVersion), pfile);
|
||||
return new Resource(pfile, remote, getLocalPath(pfile), false);
|
||||
} catch (Exception e) {
|
||||
Log.warning("Failed to create patch resource path [pfile=" + pfile +
|
||||
log.warning("Failed to create patch resource path [pfile=" + pfile +
|
||||
", appbase=" + _appbase + ", tvers=" + _targetVersion +
|
||||
", error=" + e + "].");
|
||||
return null;
|
||||
@@ -327,7 +329,7 @@ public class Application
|
||||
URL remote = new URL(createVAppBase(_targetVersion), _javaLocation);
|
||||
return new Resource(vmfile, remote, getLocalPath(vmfile), true);
|
||||
} catch (Exception e) {
|
||||
Log.warning("Failed to create VM resource [vmfile=" + vmfile + ", appbase=" + _appbase +
|
||||
log.warning("Failed to create VM resource [vmfile=" + vmfile + ", appbase=" + _appbase +
|
||||
", tvers=" + _targetVersion + ", javaloc=" + _javaLocation +
|
||||
", error=" + e + "].");
|
||||
return null;
|
||||
@@ -345,7 +347,7 @@ public class Application
|
||||
URL remote = new URL(createVAppBase(_targetVersion), file);
|
||||
return new Resource(file, remote, getLocalPath(file), false);
|
||||
} catch (Exception e) {
|
||||
Log.warning("Failed to create full resource path [file=" + file +
|
||||
log.warning("Failed to create full resource path [file=" + file +
|
||||
", appbase=" + _appbase + ", tvers=" + _targetVersion +
|
||||
", error=" + e + "].");
|
||||
return null;
|
||||
@@ -364,7 +366,7 @@ public class Application
|
||||
String suffix = _trackingURLSuffix == null ? "" : _trackingURLSuffix;
|
||||
return _trackingURL == null ? null : new URL(_trackingURL + event + suffix);
|
||||
} catch (MalformedURLException mue) {
|
||||
Log.warning("Invalid tracking URL [path=" + _trackingURL + ", event=" + event +
|
||||
log.warning("Invalid tracking URL [path=" + _trackingURL + ", event=" + event +
|
||||
", error=" + mue + "].");
|
||||
return null;
|
||||
}
|
||||
@@ -565,7 +567,7 @@ public class Application
|
||||
_jvmargs.add(pair[0] + "=" + pair[1]);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
Log.warning("Failed to parse '" + file + "': " + t);
|
||||
log.warning("Failed to parse '" + file + "': " + t);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -650,7 +652,7 @@ public class Application
|
||||
if (!m.matches()) {
|
||||
// if we can't parse the java version we're in weird land and should probably just try
|
||||
// our luck with what we've got rather than try to download a new jvm
|
||||
Log.warning("Unable to parse VM version, hoping for the best [version=" + verstr +
|
||||
log.warning("Unable to parse VM version, hoping for the best [version=" + verstr +
|
||||
", needed=" + _javaVersion + "].");
|
||||
return true;
|
||||
}
|
||||
@@ -759,7 +761,7 @@ public class Application
|
||||
String[] sargs = new String[args.size()];
|
||||
args.toArray(sargs);
|
||||
|
||||
Log.info("Running " + StringUtil.join(sargs, "\n "));
|
||||
log.info("Running " + StringUtil.join(sargs, "\n "));
|
||||
return Runtime.getRuntime().exec(sargs, null);
|
||||
}
|
||||
|
||||
@@ -793,7 +795,7 @@ public class Application
|
||||
jvmarg = processArg(jvmarg.substring(2));
|
||||
int eqidx = jvmarg.indexOf("=");
|
||||
if (eqidx == -1) {
|
||||
Log.warning("Bogus system property: '" + jvmarg + "'?");
|
||||
log.warning("Bogus system property: '" + jvmarg + "'?");
|
||||
} else {
|
||||
System.setProperty(jvmarg.substring(0, eqidx), jvmarg.substring(eqidx+1));
|
||||
}
|
||||
@@ -857,21 +859,21 @@ public class Application
|
||||
public boolean verifyMetadata (StatusDisplay status)
|
||||
throws IOException
|
||||
{
|
||||
Log.info("Verifying application: " + _vappbase);
|
||||
Log.info("Version: " + _version);
|
||||
Log.info("Class: " + _class);
|
||||
// Log.info("Code: " +
|
||||
log.info("Verifying application: " + _vappbase);
|
||||
log.info("Version: " + _version);
|
||||
log.info("Class: " + _class);
|
||||
// log.info("Code: " +
|
||||
// StringUtil.toString(getCodeResources().iterator()));
|
||||
// Log.info("Resources: " +
|
||||
// log.info("Resources: " +
|
||||
// StringUtil.toString(getActiveResources().iterator()));
|
||||
// Log.info("JVM Args: " + StringUtil.toString(_jvmargs.iterator()));
|
||||
// Log.info("App Args: " + StringUtil.toString(_appargs.iterator()));
|
||||
// log.info("JVM Args: " + StringUtil.toString(_jvmargs.iterator()));
|
||||
// log.info("App Args: " + StringUtil.toString(_appargs.iterator()));
|
||||
|
||||
// this will read in the contents of the digest file and validate itself
|
||||
try {
|
||||
_digest = new Digest(_appdir);
|
||||
} catch (IOException ioe) {
|
||||
Log.info("Failed to load digest: " + ioe.getMessage() + ". Attempting recovery...");
|
||||
log.info("Failed to load digest: " + ioe.getMessage() + ". Attempting recovery...");
|
||||
}
|
||||
|
||||
// if we have no version, then we are running in unversioned mode so we need to download
|
||||
@@ -885,12 +887,12 @@ public class Application
|
||||
downloadDigestFile();
|
||||
_digest = new Digest(_appdir);
|
||||
if (!olddig.equals(_digest.getMetaDigest())) {
|
||||
Log.info("Unversioned digest changed. Revalidating...");
|
||||
log.info("Unversioned digest changed. Revalidating...");
|
||||
status.updateStatus("m.validating");
|
||||
clearValidationMarkers();
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
Log.warning("Failed to refresh non-versioned digest: " +
|
||||
log.warning("Failed to refresh non-versioned digest: " +
|
||||
ioe.getMessage() + ". Proceeding...");
|
||||
}
|
||||
}
|
||||
@@ -919,7 +921,7 @@ public class Application
|
||||
if (_digest.validateResource(crsrc, null)) {
|
||||
init(true);
|
||||
} else {
|
||||
Log.warning(CONFIG_FILE + " failed to validate even after redownloading. " +
|
||||
log.warning(CONFIG_FILE + " failed to validate even after redownloading. " +
|
||||
"Blindly forging onward.");
|
||||
}
|
||||
}
|
||||
@@ -939,7 +941,7 @@ public class Application
|
||||
_targetVersion = Long.parseLong(vstr);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.info("Unable to read version file: " + e.getMessage());
|
||||
log.info("Unable to read version file: " + e.getMessage());
|
||||
} finally {
|
||||
StreamUtil.close(fin);
|
||||
}
|
||||
@@ -992,11 +994,11 @@ public class Application
|
||||
rsrc.markAsValid();
|
||||
continue;
|
||||
}
|
||||
Log.info("Failure unpacking resource [rsrc=" + rsrc + "].");
|
||||
log.info("Failure unpacking resource [rsrc=" + rsrc + "].");
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.info("Failure validating resource [rsrc=" + rsrc + ", error=" + e + "]. " +
|
||||
log.info("Failure validating resource [rsrc=" + rsrc + ", error=" + e + "]. " +
|
||||
"Requesting redownload...");
|
||||
|
||||
} finally {
|
||||
@@ -1056,22 +1058,19 @@ public class Application
|
||||
try {
|
||||
_lockChannel = new RandomAccessFile(getLocalPath("gettingdown.lock"), "rw").getChannel();
|
||||
} catch (FileNotFoundException e) {
|
||||
Log.warning("Unable to create lock file [message=" + e.getMessage() + "]");
|
||||
Log.logStackTrace(e);
|
||||
log.warning("Unable to create lock file [message=" + e.getMessage() + "]", e);
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
_lock = _lockChannel.tryLock();
|
||||
} catch (IOException e) {
|
||||
Log.warning("Unable to create lock [message=" + e.getMessage() + "]");
|
||||
Log.logStackTrace(e);
|
||||
log.warning("Unable to create lock [message=" + e.getMessage() + "]", e);
|
||||
return false;
|
||||
} catch (OverlappingFileLockException e) {
|
||||
Log.warning("The lock is held elsewhere in this JVM");
|
||||
Log.logStackTrace(e);
|
||||
log.warning("The lock is held elsewhere in this JVM", e);
|
||||
return false;
|
||||
}
|
||||
Log.info("Able to lock for updates: " + (_lock != null));
|
||||
log.info("Able to lock for updates: " + (_lock != null));
|
||||
return _lock != null;
|
||||
}
|
||||
|
||||
@@ -1081,18 +1080,16 @@ public class Application
|
||||
public synchronized void releaseLock ()
|
||||
{
|
||||
if (_lock != null) {
|
||||
Log.info("Releasing lock");
|
||||
log.info("Releasing lock");
|
||||
try {
|
||||
_lock.release();
|
||||
} catch (IOException e) {
|
||||
Log.warning("Unable to release lock [message=" + e.getMessage() + "]");
|
||||
Log.logStackTrace(e);
|
||||
log.warning("Unable to release lock [message=" + e.getMessage() + "]", e);
|
||||
}
|
||||
try {
|
||||
_lockChannel.close();
|
||||
} catch (IOException e) {
|
||||
Log.warning("Unable to close lock channel [message=" + e.getMessage() + "]");
|
||||
Log.logStackTrace(e);
|
||||
log.warning("Unable to close lock channel [message=" + e.getMessage() + "]", e);
|
||||
}
|
||||
_lockChannel = null;
|
||||
_lock = null;
|
||||
@@ -1128,7 +1125,7 @@ public class Application
|
||||
|
||||
if (validateSignature) {
|
||||
if (_signers == null) {
|
||||
Log.info("No signers, not verifying file [path=" + path + "].");
|
||||
log.info("No signers, not verifying file [path=" + path + "].");
|
||||
|
||||
} else {
|
||||
File signatureFile = downloadFile(path + SIGNATURE_SUFFIX);
|
||||
@@ -1160,15 +1157,15 @@ public class Application
|
||||
}
|
||||
|
||||
if (!sig.verify(Base64.decodeBase64(signature))) {
|
||||
Log.info("Signature does not match [cert=" + cert.getPublicKey() + "]");
|
||||
log.info("Signature does not match [cert=" + cert.getPublicKey() + "]");
|
||||
continue;
|
||||
} else {
|
||||
Log.info("Signature matches [cert=" + cert.getPublicKey() + "]");
|
||||
log.info("Signature matches [cert=" + cert.getPublicKey() + "]");
|
||||
validated++;
|
||||
}
|
||||
|
||||
} catch (IOException ioe) {
|
||||
Log.warning("Failure validating signature of " + target + ": " + ioe);
|
||||
log.warning("Failure validating signature of " + target + ": " + ioe);
|
||||
|
||||
} catch (GeneralSecurityException gse) {
|
||||
// no problem!
|
||||
@@ -1208,12 +1205,12 @@ public class Application
|
||||
try {
|
||||
targetURL = getRemoteURL(path);
|
||||
} catch (Exception e) {
|
||||
Log.warning("Requested to download invalid control file [appbase=" + _vappbase +
|
||||
log.warning("Requested to download invalid control file [appbase=" + _vappbase +
|
||||
", path=" + path + ", error=" + e + "].");
|
||||
throw (IOException) new IOException("Invalid path '" + path + "'.").initCause(e);
|
||||
}
|
||||
|
||||
Log.info("Attempting to refetch '" + path + "' from '" + targetURL + "'.");
|
||||
log.info("Attempting to refetch '" + path + "' from '" + targetURL + "'.");
|
||||
|
||||
// stream the URL into our temporary file
|
||||
InputStream fin = null;
|
||||
@@ -1249,7 +1246,7 @@ public class Application
|
||||
try {
|
||||
list.add(createResource(rsrc, unpack));
|
||||
} catch (Exception e) {
|
||||
Log.warning("Invalid resource '" + rsrc + "'. " + e);
|
||||
log.warning("Invalid resource '" + rsrc + "'. " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1263,7 +1260,7 @@ public class Application
|
||||
if (v != null && v.length == 4) {
|
||||
return new Rectangle(v[0], v[1], v[2], v[3]);
|
||||
} else {
|
||||
Log.warning("Ignoring invalid '" + name + "' config '" + value + "'.");
|
||||
log.warning("Ignoring invalid '" + name + "' config '" + value + "'.");
|
||||
}
|
||||
}
|
||||
return def;
|
||||
@@ -1277,7 +1274,7 @@ public class Application
|
||||
try {
|
||||
return new Color(Integer.parseInt(value, 16));
|
||||
} catch (Exception e) {
|
||||
Log.warning("Ignoring invalid '" + name + "' config '" + value + "'.");
|
||||
log.warning("Ignoring invalid '" + name + "' config '" + value + "'.");
|
||||
}
|
||||
}
|
||||
return def;
|
||||
|
||||
@@ -36,10 +36,11 @@ import java.util.List;
|
||||
import com.samskivert.text.MessageUtil;
|
||||
import com.samskivert.util.StringUtil;
|
||||
|
||||
import com.threerings.getdown.Log;
|
||||
import com.threerings.getdown.util.ConfigUtil;
|
||||
import com.threerings.getdown.util.ProgressObserver;
|
||||
|
||||
import static com.threerings.getdown.Log.log;
|
||||
|
||||
/**
|
||||
* Manages the <code>digest.txt</code> file and the computing and
|
||||
* processing of MD5 digests for an application.
|
||||
@@ -106,10 +107,10 @@ public class Digest
|
||||
if (cmd5.equals(emd5)) {
|
||||
return true;
|
||||
}
|
||||
Log.info("Resource failed digest check [rsrc=" + resource +
|
||||
log.info("Resource failed digest check [rsrc=" + resource +
|
||||
", computed=" + cmd5 + ", expected=" + emd5 + "].");
|
||||
} catch (Throwable t) {
|
||||
Log.info("Resource failed digest check [rsrc=" + resource +
|
||||
log.info("Resource failed digest check [rsrc=" + resource +
|
||||
", error=" + t + "].");
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -39,9 +39,10 @@ import com.samskivert.util.FileUtil;
|
||||
import com.samskivert.util.SortableArrayList;
|
||||
import com.samskivert.util.StringUtil;
|
||||
|
||||
import com.threerings.getdown.Log;
|
||||
import com.threerings.getdown.util.ProgressObserver;
|
||||
|
||||
import static com.threerings.getdown.Log.log;
|
||||
|
||||
/**
|
||||
* Models a single file resource used by an {@link Application}.
|
||||
*/
|
||||
@@ -135,7 +136,7 @@ public class Resource
|
||||
{
|
||||
if (_marker.exists()) {
|
||||
if (!_marker.delete()) {
|
||||
Log.warning("Failed to erase marker file '" + _marker + "'.");
|
||||
log.warning("Failed to erase marker file '" + _marker + "'.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -148,13 +149,13 @@ public class Resource
|
||||
{
|
||||
// sanity check
|
||||
if (!_local.getPath().endsWith(".jar")) {
|
||||
Log.warning("Requested to unpack non-jar file '" + _local + "'.");
|
||||
log.warning("Requested to unpack non-jar file '" + _local + "'.");
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
return FileUtil.unpackJar(new JarFile(_local), _local.getParentFile());
|
||||
} catch (IOException ioe) {
|
||||
Log.warning("Failed to create JarFile from '" + _local + "': " + ioe);
|
||||
log.warning("Failed to create JarFile from '" + _local + "': " + ioe);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -168,7 +169,7 @@ public class Resource
|
||||
clearMarker();
|
||||
if (_local.exists()) {
|
||||
if (!_local.delete()) {
|
||||
Log.warning("Failed to erase resource '" + _local + "'.");
|
||||
log.warning("Failed to erase resource '" + _local + "'.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -250,8 +251,7 @@ public class Resource
|
||||
try {
|
||||
jar.close();
|
||||
} catch (IOException ioe) {
|
||||
Log.warning("Error closing jar [path=" + target +
|
||||
", error=" + ioe + "].");
|
||||
log.warning("Error closing jar [path=" + target + ", error=" + ioe + "].");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ import com.samskivert.swing.Spacer;
|
||||
import com.samskivert.swing.VGroupLayout;
|
||||
import com.samskivert.text.MessageUtil;
|
||||
|
||||
import com.threerings.getdown.Log;
|
||||
import static com.threerings.getdown.Log.log;
|
||||
|
||||
/**
|
||||
* Displays a confirmation that the user wants to abort installation.
|
||||
@@ -104,7 +104,7 @@ public class AbortPanel extends JFrame
|
||||
try {
|
||||
return _msgs.getString(key);
|
||||
} catch (MissingResourceException mre) {
|
||||
Log.warning("Missing translation message '" + key + "'.");
|
||||
log.warning("Missing translation message '" + key + "'.");
|
||||
return key;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,6 @@ import com.samskivert.text.MessageUtil;
|
||||
import com.samskivert.util.RunAnywhere;
|
||||
import com.samskivert.util.StringUtil;
|
||||
|
||||
import com.threerings.getdown.Log;
|
||||
import com.threerings.getdown.data.Application;
|
||||
import com.threerings.getdown.data.Resource;
|
||||
import com.threerings.getdown.net.Downloader;
|
||||
@@ -70,6 +69,8 @@ import com.threerings.getdown.util.ConfigUtil;
|
||||
import com.threerings.getdown.util.LaunchUtil;
|
||||
import com.threerings.getdown.util.ProgressObserver;
|
||||
|
||||
import static com.threerings.getdown.Log.log;
|
||||
|
||||
/**
|
||||
* Manages the main control for the Getdown application updater and deployment system.
|
||||
*/
|
||||
@@ -130,7 +131,7 @@ public abstract class Getdown extends Thread
|
||||
_ifc = _app.init(true);
|
||||
createInterface(true);
|
||||
} catch (Exception e) {
|
||||
Log.warning("Failed to preinit: " + e);
|
||||
log.warning("Failed to preinit: " + e);
|
||||
createInterface(true);
|
||||
}
|
||||
}
|
||||
@@ -159,7 +160,7 @@ public abstract class Getdown extends Thread
|
||||
if (detectProxy()) {
|
||||
getdown();
|
||||
} else if (_silent) {
|
||||
Log.warning("Need a proxy, but we don't want to bother anyone. Exiting");
|
||||
log.warning("Need a proxy, but we don't want to bother anyone. Exiting.");
|
||||
} else {
|
||||
// create a panel they can use to configure the proxy settings
|
||||
_container = createContainer();
|
||||
@@ -170,7 +171,7 @@ public abstract class Getdown extends Thread
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.logStackTrace(e);
|
||||
log.warning("run() failed.", e);
|
||||
String msg = e.getMessage();
|
||||
if (msg == null) {
|
||||
msg = MessageUtil.compose("m.unknown_error", _ifc.installError);
|
||||
@@ -193,7 +194,7 @@ public abstract class Getdown extends Thread
|
||||
*/
|
||||
public void configureProxy (String host, String port)
|
||||
{
|
||||
Log.info("User configured proxy [host=" + host + ", port=" + port + "].");
|
||||
log.info("User configured proxy [host=" + host + ", port=" + port + "].");
|
||||
|
||||
// if we're provided with valid values, create a proxy.txt file
|
||||
if (!StringUtil.isBlank(host)) {
|
||||
@@ -206,7 +207,7 @@ public abstract class Getdown extends Thread
|
||||
}
|
||||
pout.close();
|
||||
} catch (IOException ioe) {
|
||||
Log.warning("Error creating proxy file '" + pfile + "': " + ioe);
|
||||
log.warning("Error creating proxy file '" + pfile + "': " + ioe);
|
||||
}
|
||||
|
||||
// also configure them in the JVM
|
||||
@@ -261,11 +262,11 @@ public abstract class Getdown extends Thread
|
||||
setProxyProperties(host, port);
|
||||
return true;
|
||||
} else {
|
||||
Log.info("Detected no proxy settings in the registry.");
|
||||
log.info("Detected no proxy settings in the registry.");
|
||||
}
|
||||
|
||||
} catch (Throwable t) {
|
||||
Log.info("Failed to find proxy settings in Windows registry [error=" + t + "].");
|
||||
log.info("Failed to find proxy settings in Windows registry [error=" + t + "].");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -277,13 +278,13 @@ public abstract class Getdown extends Thread
|
||||
setProxyProperties((String)pconf.get("host"), (String)pconf.get("port"));
|
||||
return true;
|
||||
} catch (IOException ioe) {
|
||||
Log.warning("Failed to read '" + pfile + "': " + ioe);
|
||||
log.warning("Failed to read '" + pfile + "': " + ioe);
|
||||
}
|
||||
}
|
||||
|
||||
// otherwise see if we actually need a proxy; first we have to initialize our application
|
||||
// to get some sort of interface configuration and the appbase URL
|
||||
Log.info("Checking whether we need to use a proxy...");
|
||||
log.info("Checking whether we need to use a proxy...");
|
||||
try {
|
||||
_ifc = _app.init(true);
|
||||
} catch (IOException ioe) {
|
||||
@@ -300,23 +301,23 @@ public abstract class Getdown extends Thread
|
||||
|
||||
// make sure we got a satisfactory response code
|
||||
if (ucon.getResponseCode() != HttpURLConnection.HTTP_OK) {
|
||||
Log.warning("Got a non-200 response but assuming we're OK because we got " +
|
||||
log.warning("Got a non-200 response but assuming we're OK because we got " +
|
||||
"something... [url=" + rurl + ", rsp=" + ucon.getResponseCode() + "].");
|
||||
}
|
||||
|
||||
// we got through, so we appear not to require a proxy; make a blank proxy config and
|
||||
// get on gettin' down
|
||||
Log.info("No proxy appears to be needed.");
|
||||
log.info("No proxy appears to be needed.");
|
||||
try {
|
||||
pfile.createNewFile();
|
||||
} catch (IOException ioe) {
|
||||
Log.warning("Failed to create blank proxy file '" + pfile + "': " + ioe);
|
||||
log.warning("Failed to create blank proxy file '" + pfile + "': " + ioe);
|
||||
}
|
||||
return true;
|
||||
|
||||
} catch (IOException ioe) {
|
||||
Log.info("Failed to HEAD " + rurl + ": " + ioe);
|
||||
Log.info("We probably need a proxy, but auto-detection failed.");
|
||||
log.info("Failed to HEAD " + rurl + ": " + ioe);
|
||||
log.info("We probably need a proxy, but auto-detection failed.");
|
||||
}
|
||||
|
||||
// let the caller know that we need a proxy but can't detect it
|
||||
@@ -333,7 +334,7 @@ public abstract class Getdown extends Thread
|
||||
if (!StringUtil.isBlank(port)) {
|
||||
System.setProperty("http.proxyPort", port);
|
||||
}
|
||||
Log.info("Using proxy [host=" + host + ", port=" + port + "].");
|
||||
log.info("Using proxy [host=" + host + ", port=" + port + "].");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -342,17 +343,17 @@ public abstract class Getdown extends Thread
|
||||
*/
|
||||
protected void getdown ()
|
||||
{
|
||||
Log.info("---------------- Proxy Info -----------------");
|
||||
Log.info("-- Proxy Host: " + System.getProperty("http.proxyHost"));
|
||||
Log.info("-- Proxy Port: " + System.getProperty("http.proxyPort"));
|
||||
Log.info("---------------------------------------------");
|
||||
log.info("---------------- Proxy Info -----------------");
|
||||
log.info("-- Proxy Host: " + System.getProperty("http.proxyHost"));
|
||||
log.info("-- Proxy Port: " + System.getProperty("http.proxyPort"));
|
||||
log.info("---------------------------------------------");
|
||||
|
||||
try {
|
||||
// first parses our application deployment file
|
||||
try {
|
||||
_ifc = _app.init(true);
|
||||
} catch (IOException ioe) {
|
||||
Log.warning("Failed to parse 'getdown.txt': " + ioe);
|
||||
log.warning("Failed to parse 'getdown.txt': " + ioe);
|
||||
_app.attemptRecovery(this);
|
||||
// and re-initalize
|
||||
_ifc = _app.init(true);
|
||||
@@ -366,18 +367,18 @@ public abstract class Getdown extends Thread
|
||||
// Update the config modtime so a sleeping getdown will notice the change.
|
||||
File config = _app.getLocalPath(Application.CONFIG_FILE);
|
||||
if (!config.setLastModified(System.currentTimeMillis())) {
|
||||
Log.warning("Unable to set modtime on config file, will be unable to check for "
|
||||
+ "another instance of getdown running while this one waits.");
|
||||
log.warning("Unable to set modtime on config file, will be unable to check for " +
|
||||
"another instance of getdown running while this one waits.");
|
||||
}
|
||||
if (_delay > 0) {
|
||||
// don't hold the lock while waiting, let another getdown proceed if it starts.
|
||||
_app.releaseLock();
|
||||
// Store the config modtime before waiting the delay amount of time
|
||||
long lastConfigModtime = config.lastModified();
|
||||
Log.info("Waiting " + _delay + " minutes before beginning actual work");
|
||||
log.info("Waiting " + _delay + " minutes before beginning actual work.");
|
||||
Thread.sleep(_delay * 60 * 1000);
|
||||
if (lastConfigModtime < config.lastModified()) {
|
||||
Log.warning("getdown.txt was modified while getdown was waiting");
|
||||
log.warning("getdown.txt was modified while getdown was waiting.");
|
||||
throw new MultipleGetdownRunning();
|
||||
}
|
||||
}
|
||||
@@ -396,7 +397,7 @@ public abstract class Getdown extends Thread
|
||||
if (!_app.haveValidJavaVersion()) {
|
||||
// download and install the necessary version of java, then loop back again and
|
||||
// reverify everything; if we can't download java; we'll throw an exception
|
||||
Log.info("Attempting to update Java VM...");
|
||||
log.info("Attempting to update Java VM...");
|
||||
_enableTracking = true; // always track JVM downloads
|
||||
try {
|
||||
updateJava();
|
||||
@@ -409,7 +410,7 @@ public abstract class Getdown extends Thread
|
||||
// make sure we have the desired version and that the metadata files are valid...
|
||||
setStatus("m.validating", -1, -1L, false);
|
||||
if (_app.verifyMetadata(this)) {
|
||||
Log.info("Application requires update.");
|
||||
log.info("Application requires update.");
|
||||
update();
|
||||
// loop back again and reverify the metadata
|
||||
continue;
|
||||
@@ -419,7 +420,7 @@ public abstract class Getdown extends Thread
|
||||
setStatus("m.validating", -1, -1L, false);
|
||||
List<Resource> failures = _app.verifyResources(_progobs, alreadyValid);
|
||||
if (failures == null) {
|
||||
Log.info("Resources verified.");
|
||||
log.info("Resources verified.");
|
||||
// Only launch if we aren't in silent mode. Some mystery program starting out
|
||||
// of the blue would be disconcerting.
|
||||
if (!_silent || _launchInSilent) {
|
||||
@@ -442,7 +443,7 @@ public abstract class Getdown extends Thread
|
||||
reportTrackingEvent("app_start", -1);
|
||||
|
||||
// redownload any that are corrupt or invalid...
|
||||
Log.info(failures.size() + " of " + _app.getAllResources().size() +
|
||||
log.info(failures.size() + " of " + _app.getAllResources().size() +
|
||||
" rsrcs require update (" + alreadyValid[0] + " assumed valid).");
|
||||
download(failures);
|
||||
|
||||
@@ -454,11 +455,11 @@ public abstract class Getdown extends Thread
|
||||
// now we'll loop back and try it all again
|
||||
}
|
||||
|
||||
Log.warning("Pants! We couldn't get the job done.");
|
||||
log.warning("Pants! We couldn't get the job done.");
|
||||
throw new IOException("m.unable_to_repair");
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.logStackTrace(e);
|
||||
log.warning("getdown() failed.", e);
|
||||
String msg = e.getMessage();
|
||||
if (msg == null) {
|
||||
msg = MessageUtil.compose("m.unknown_error", _ifc.installError);
|
||||
@@ -511,7 +512,7 @@ public abstract class Getdown extends Thread
|
||||
imgpath = _app.getLocalPath(path);
|
||||
return ImageIO.read(imgpath);
|
||||
} catch (IOException ioe2) {
|
||||
Log.warning("Failed to load image [path=" + imgpath + ", error=" + ioe2 + "].");
|
||||
log.warning("Failed to load image [path=" + imgpath + ", error=" + ioe2 + "].");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -551,10 +552,10 @@ public abstract class Getdown extends Thread
|
||||
File.separator + "java";
|
||||
String cmd = "chmod a+rx " + _app.getLocalPath(vmbin);
|
||||
try {
|
||||
Log.info("Please smack a Java engineer. Running: " + cmd);
|
||||
log.info("Please smack a Java engineer. Running: " + cmd);
|
||||
Runtime.getRuntime().exec(cmd);
|
||||
} catch (Exception e) {
|
||||
Log.warning("Failed to mark VM binary as executable [cmd=" + cmd +
|
||||
log.warning("Failed to mark VM binary as executable [cmd=" + cmd +
|
||||
", error=" + e + "].");
|
||||
// we should do something like tell the user or something but fucking fuck
|
||||
}
|
||||
@@ -563,10 +564,10 @@ public abstract class Getdown extends Thread
|
||||
// lastly regenerate the .jsa dump file that helps Java to start up faster
|
||||
String vmpath = LaunchUtil.getJVMPath(_app.getLocalPath(""));
|
||||
try {
|
||||
Log.info("Regenerating classes.jsa for " + vmpath + "...");
|
||||
log.info("Regenerating classes.jsa for " + vmpath + "...");
|
||||
Runtime.getRuntime().exec(vmpath + " -Xshare:dump");
|
||||
} catch (Exception e) {
|
||||
Log.warning("Failed to regenerate .jsa dum file [error=" + e + "].");
|
||||
log.warning("Failed to regenerate .jsa dum file [error=" + e + "].");
|
||||
}
|
||||
|
||||
reportTrackingEvent("jvm_complete", -1);
|
||||
@@ -607,13 +608,12 @@ public abstract class Getdown extends Thread
|
||||
Patcher patcher = new Patcher();
|
||||
patcher.patch(prsrc.getLocal().getParentFile(), prsrc.getLocal(), _progobs);
|
||||
} catch (Exception e) {
|
||||
Log.warning("Failed to apply patch [prsrc=" + prsrc + "].");
|
||||
Log.logStackTrace(e);
|
||||
log.warning("Failed to apply patch [prsrc=" + prsrc + "].", e);
|
||||
}
|
||||
|
||||
// clean up the patch file
|
||||
if (!prsrc.getLocal().delete()) {
|
||||
Log.warning("Failed to delete '" + prsrc + "'.");
|
||||
log.warning("Failed to delete '" + prsrc + "'.");
|
||||
prsrc.getLocal().deleteOnExit();
|
||||
}
|
||||
}
|
||||
@@ -670,8 +670,7 @@ public abstract class Getdown extends Thread
|
||||
|
||||
public void downloadFailed (Resource rsrc, Exception e) {
|
||||
updateStatus(MessageUtil.tcompose("m.failure", e.getMessage()));
|
||||
Log.warning("Download failed [rsrc=" + rsrc + "].");
|
||||
Log.logStackTrace(e);
|
||||
log.warning("Download failed [rsrc=" + rsrc + "].", e);
|
||||
}
|
||||
|
||||
/** The last percentage at which we checked for another getdown running, or -1 for not
|
||||
@@ -736,7 +735,7 @@ public abstract class Getdown extends Thread
|
||||
disposeContainer();
|
||||
_status = null;
|
||||
copyStream(stderr, System.err);
|
||||
Log.info("Process exited: " + proc.waitFor());
|
||||
log.info("Process exited: " + proc.waitFor());
|
||||
|
||||
} else {
|
||||
// spawn a daemon thread that will catch the early bits of stderr in case the
|
||||
@@ -764,7 +763,7 @@ public abstract class Getdown extends Thread
|
||||
exit(0);
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.logStackTrace(e);
|
||||
log.warning("launch() failed.", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -813,7 +812,7 @@ public abstract class Getdown extends Thread
|
||||
{
|
||||
if (_ifc.rotatingBackgrounds != null) {
|
||||
if (_ifc.backgroundImage != null) {
|
||||
Log.warning("ui.background_image and ui.rotating_background were both specified. " +
|
||||
log.warning("ui.background_image and ui.rotating_background were both specified. " +
|
||||
"The rotating images are being used.");
|
||||
}
|
||||
return new RotatingBackgrounds(_ifc.rotatingBackgrounds, _ifc.errorBackground,
|
||||
@@ -865,7 +864,7 @@ public abstract class Getdown extends Thread
|
||||
public void run () {
|
||||
if (_status == null) {
|
||||
if (message != null) {
|
||||
Log.info("Dropping status '" + message + "'.");
|
||||
log.info("Dropping status '" + message + "'.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -956,7 +955,7 @@ public abstract class Getdown extends Thread
|
||||
out.flush();
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
Log.warning("Failure copying [in=" + in + ", out=" + out + ", error=" + ioe + "].");
|
||||
log.warning("Failure copying [in=" + in + ", out=" + out + ", error=" + ioe + "].");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -985,7 +984,7 @@ public abstract class Getdown extends Thread
|
||||
ucon.connect();
|
||||
try {
|
||||
if (ucon.getResponseCode() != HttpURLConnection.HTTP_OK) {
|
||||
Log.warning("Failed to report tracking event [url=" + _url +
|
||||
log.warning("Failed to report tracking event [url=" + _url +
|
||||
", rcode=" + ucon.getResponseCode() + "].");
|
||||
}
|
||||
} finally {
|
||||
@@ -993,7 +992,7 @@ public abstract class Getdown extends Thread
|
||||
}
|
||||
|
||||
} catch (IOException ioe) {
|
||||
Log.warning("Failed to report tracking event [url=" + _url +
|
||||
log.warning("Failed to report tracking event [url=" + _url +
|
||||
", error=" + ioe + "].");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ import java.io.PrintStream;
|
||||
import com.samskivert.swing.util.SwingUtil;
|
||||
import com.samskivert.util.StringUtil;
|
||||
|
||||
import com.threerings.getdown.Log;
|
||||
import static com.threerings.getdown.Log.log;
|
||||
|
||||
/**
|
||||
* Does something extraordinary.
|
||||
@@ -65,35 +65,34 @@ public class GetdownApp
|
||||
// ensure a valid directory was supplied
|
||||
File appDir = new File(adarg);
|
||||
if (!appDir.exists() || !appDir.isDirectory()) {
|
||||
Log.warning("Invalid app_dir '" + adarg + "'.");
|
||||
log.warning("Invalid app_dir '" + adarg + "'.");
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
// pipe our output into a file in the application directory
|
||||
if (System.getProperty("no_log_redir") == null) {
|
||||
File log = new File(appDir, "launcher.log");
|
||||
File logFile = new File(appDir, "launcher.log");
|
||||
try {
|
||||
PrintStream logOut = new PrintStream(
|
||||
new BufferedOutputStream(new FileOutputStream(log)), true);
|
||||
new BufferedOutputStream(new FileOutputStream(logFile)), true);
|
||||
System.setOut(logOut);
|
||||
System.setErr(logOut);
|
||||
} catch (IOException ioe) {
|
||||
Log.warning("Unable to redirect output to '" + log +
|
||||
"': " + ioe);
|
||||
log.warning("Unable to redirect output to '" + logFile + "': " + ioe);
|
||||
}
|
||||
}
|
||||
|
||||
// record a few things for posterity
|
||||
Log.info("------------------ VM Info ------------------");
|
||||
Log.info("-- OS Name: " + System.getProperty("os.name"));
|
||||
Log.info("-- OS Arch: " + System.getProperty("os.arch"));
|
||||
Log.info("-- OS Vers: " + System.getProperty("os.version"));
|
||||
Log.info("-- Java Vers: " + System.getProperty("java.version"));
|
||||
Log.info("-- Java Home: " + System.getProperty("java.home"));
|
||||
Log.info("-- User Name: " + System.getProperty("user.name"));
|
||||
Log.info("-- User Home: " + System.getProperty("user.home"));
|
||||
Log.info("-- Cur dir: " + System.getProperty("user.dir"));
|
||||
Log.info("---------------------------------------------");
|
||||
log.info("------------------ VM Info ------------------");
|
||||
log.info("-- OS Name: " + System.getProperty("os.name"));
|
||||
log.info("-- OS Arch: " + System.getProperty("os.arch"));
|
||||
log.info("-- OS Vers: " + System.getProperty("os.version"));
|
||||
log.info("-- Java Vers: " + System.getProperty("java.version"));
|
||||
log.info("-- Java Home: " + System.getProperty("java.home"));
|
||||
log.info("-- User Name: " + System.getProperty("user.name"));
|
||||
log.info("-- User Home: " + System.getProperty("user.home"));
|
||||
log.info("-- Cur dir: " + System.getProperty("user.dir"));
|
||||
log.info("---------------------------------------------");
|
||||
|
||||
try {
|
||||
Getdown app = new Getdown(appDir, appId) {
|
||||
@@ -135,8 +134,9 @@ public class GetdownApp
|
||||
protected JFrame _frame;
|
||||
};
|
||||
app.start();
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.logStackTrace(e);
|
||||
log.warning("main() failed.", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,10 +31,18 @@ import java.net.URL;
|
||||
import javax.swing.JApplet;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.PrintStream;
|
||||
import java.util.Map;
|
||||
|
||||
import com.samskivert.util.RunAnywhere;
|
||||
import com.samskivert.util.StringUtil;
|
||||
|
||||
import com.threerings.getdown.Log;
|
||||
import com.threerings.getdown.util.ConfigUtil;
|
||||
|
||||
import static com.threerings.getdown.Log.log;
|
||||
|
||||
/**
|
||||
* An applet that can be used to launch a Getdown application (when signed and
|
||||
@@ -68,24 +76,24 @@ public class GetdownApplet extends JApplet
|
||||
bgimages = new RotatingBackgrounds(loadImage(imgpath));
|
||||
}
|
||||
|
||||
Log.info("App Base: " + appbase);
|
||||
Log.info("App Name: " + appname);
|
||||
log.info("App Base: " + appbase);
|
||||
log.info("App Name: " + appname);
|
||||
|
||||
File appdir = null;
|
||||
try {
|
||||
appdir = initGetdown(appbase, appname, imgpath);
|
||||
|
||||
// record a few things for posterity
|
||||
Log.info("------------------ VM Info ------------------");
|
||||
Log.info("-- OS Name: " + System.getProperty("os.name"));
|
||||
Log.info("-- OS Arch: " + System.getProperty("os.arch"));
|
||||
Log.info("-- OS Vers: " + System.getProperty("os.version"));
|
||||
Log.info("-- Java Vers: " + System.getProperty("java.version"));
|
||||
Log.info("-- Java Home: " + System.getProperty("java.home"));
|
||||
Log.info("-- User Name: " + System.getProperty("user.name"));
|
||||
Log.info("-- User Home: " + System.getProperty("user.home"));
|
||||
Log.info("-- Cur dir: " + System.getProperty("user.dir"));
|
||||
Log.info("---------------------------------------------");
|
||||
log.info("------------------ VM Info ------------------");
|
||||
log.info("-- OS Name: " + System.getProperty("os.name"));
|
||||
log.info("-- OS Arch: " + System.getProperty("os.arch"));
|
||||
log.info("-- OS Vers: " + System.getProperty("os.version"));
|
||||
log.info("-- Java Vers: " + System.getProperty("java.version"));
|
||||
log.info("-- Java Home: " + System.getProperty("java.home"));
|
||||
log.info("-- User Name: " + System.getProperty("user.name"));
|
||||
log.info("-- User Home: " + System.getProperty("user.home"));
|
||||
log.info("-- Cur dir: " + System.getProperty("user.dir"));
|
||||
log.info("---------------------------------------------");
|
||||
|
||||
} catch (Exception e) {
|
||||
_errmsg = e.getMessage();
|
||||
@@ -139,7 +147,7 @@ public class GetdownApplet extends JApplet
|
||||
try {
|
||||
dest = new URL(getParameter("redirect_on_finish"));
|
||||
} catch (MalformedURLException e) {
|
||||
Log.warning("URL in redirect_on_finish param is malformed: " + e);
|
||||
log.warning("URL in redirect_on_finish param is malformed: " + e);
|
||||
return;
|
||||
}
|
||||
String target = getParameter("redirect_on_finish_target");
|
||||
@@ -156,7 +164,7 @@ public class GetdownApplet extends JApplet
|
||||
_getdown.preInit();
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.logStackTrace(e);
|
||||
log.warning("init() failed.", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,8 +173,7 @@ public class GetdownApplet extends JApplet
|
||||
try {
|
||||
return getImage(new URL(getDocumentBase(), path));
|
||||
} catch (MalformedURLException e) {
|
||||
Log.warning("Failed to load background image [path=" + path + "].");
|
||||
Log.logStackTrace(e);
|
||||
log.warning("Failed to load background image", "path", path, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -180,7 +187,7 @@ public class GetdownApplet extends JApplet
|
||||
try {
|
||||
_getdown.start();
|
||||
} catch (Exception e) {
|
||||
Log.logStackTrace(e);
|
||||
log.warning("start() failed.", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -213,7 +220,7 @@ public class GetdownApplet extends JApplet
|
||||
sm.checkWrite("getdown");
|
||||
sm.checkPropertiesAccess();
|
||||
} catch (SecurityException se) {
|
||||
Log.warning("Signed applet rejected by user [se=" + se + "].");
|
||||
log.warning("Signed applet rejected by user", "se", se);
|
||||
throw new Exception("m.insufficient_permissions_error");
|
||||
}
|
||||
}
|
||||
@@ -240,7 +247,7 @@ public class GetdownApplet extends JApplet
|
||||
root = "AppData" + File.separator + "LocalLow";
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.warning("Couldn't parse OS version [vers=" + verStr + ", error=" + e + "].");
|
||||
log.warning("Couldn't parse OS version", "vers", verStr, "error", e);
|
||||
}
|
||||
} else if (RunAnywhere.isMacOS()) {
|
||||
root = "Library" + File.separator + "Application Support";
|
||||
@@ -266,9 +273,25 @@ public class GetdownApplet extends JApplet
|
||||
}
|
||||
}
|
||||
|
||||
// if our getdown.txt file does not exist, auto-create it
|
||||
// if our getdown.txt file does not exist, or it is corrupt, auto-/recreate it
|
||||
File gdfile = new File(appdir, "getdown.txt");
|
||||
if (!gdfile.exists()) {
|
||||
boolean createGetdown = !gdfile.exists();
|
||||
if (!createGetdown) {
|
||||
try {
|
||||
Map<String,Object> cdata = ConfigUtil.parseConfig(gdfile, false);
|
||||
String oappbase = StringUtil.trim((String)cdata.get("appbase"));
|
||||
createGetdown = (appbase != null && !appbase.trim().equals(oappbase));
|
||||
if (createGetdown) {
|
||||
log.warning("Recreating getdown.txt due to appbase mismatch",
|
||||
"nappbase", appbase, "oappbase", oappbase);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warning("Failure checking validity of getdown.txt, forcing recreate.",
|
||||
"error", e);
|
||||
createGetdown = true;
|
||||
}
|
||||
}
|
||||
if (createGetdown) {
|
||||
if (StringUtil.isBlank(appbase)) {
|
||||
throw new Exception("m.missing_appbase");
|
||||
}
|
||||
@@ -291,8 +314,7 @@ public class GetdownApplet extends JApplet
|
||||
out.close();
|
||||
return true;
|
||||
} catch (IOException ioe) {
|
||||
Log.warning("Failed to create '" + tofile + "'.");
|
||||
Log.logStackTrace(ioe);
|
||||
log.warning("Failed to create '" + tofile + "'.", ioe);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ import com.samskivert.swing.Spacer;
|
||||
import com.samskivert.swing.VGroupLayout;
|
||||
import com.samskivert.text.MessageUtil;
|
||||
|
||||
import com.threerings.getdown.Log;
|
||||
import static com.threerings.getdown.Log.log;
|
||||
|
||||
/**
|
||||
* Displays an interface with which the user can configure their proxy
|
||||
@@ -134,7 +134,7 @@ public class ProxyPanel extends JPanel
|
||||
try {
|
||||
return _msgs.getString(key);
|
||||
} catch (MissingResourceException mre) {
|
||||
Log.warning("Missing translation message '" + key + "'.");
|
||||
log.warning("Missing translation message '" + key + "'.");
|
||||
return key;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,28 @@
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// Getdown - application installer, patcher and launcher
|
||||
// Copyright (C) 2004-2006 Three Rings Design, Inc.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU General Public License as published by the Free
|
||||
// Software Foundation; either version 2 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
// more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along with
|
||||
// this program; if not, write to the: Free Software Foundation, Inc.,
|
||||
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
package com.threerings.getdown.launcher;
|
||||
|
||||
import java.awt.Image;
|
||||
|
||||
import com.threerings.getdown.Log;
|
||||
import static com.threerings.getdown.Log.log;
|
||||
|
||||
public class RotatingBackgrounds
|
||||
{
|
||||
@@ -41,7 +61,7 @@ public class RotatingBackgrounds
|
||||
for (int ii = 0; ii < backgrounds.length; ii++) {
|
||||
String[] pieces = backgrounds[ii].split(";");
|
||||
if (pieces.length != 2) {
|
||||
Log.warning("Unable to parse background image '" + backgrounds[ii] + "'");
|
||||
log.warning("Unable to parse background image '" + backgrounds[ii] + "'");
|
||||
makeEmpty();
|
||||
return;
|
||||
}
|
||||
@@ -49,8 +69,8 @@ public class RotatingBackgrounds
|
||||
try {
|
||||
minDisplayTime[ii] = Integer.parseInt(pieces[1]);
|
||||
} catch (NumberFormatException e) {
|
||||
Log.warning("Unable to parse background image display time '"
|
||||
+ backgrounds[ii] + "'");
|
||||
log.warning("Unable to parse background image display time '" +
|
||||
backgrounds[ii] + "'");
|
||||
makeEmpty();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -37,9 +37,11 @@ import com.samskivert.swing.util.SwingUtil;
|
||||
import com.samskivert.text.MessageUtil;
|
||||
import com.samskivert.util.StringUtil;
|
||||
import com.samskivert.util.Throttle;
|
||||
import com.threerings.getdown.Log;
|
||||
|
||||
import com.threerings.getdown.data.Application.UpdateInterface;
|
||||
|
||||
import static com.threerings.getdown.Log.log;
|
||||
|
||||
/**
|
||||
* Displays download and patching status.
|
||||
*/
|
||||
@@ -257,7 +259,7 @@ public class StatusPanel extends JComponent
|
||||
try {
|
||||
return _msgs.getString(key);
|
||||
} catch (MissingResourceException mre) {
|
||||
Log.warning("Missing translation message '" + key + "'.");
|
||||
log.warning("Missing translation message '" + key + "'.");
|
||||
return key;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,9 +25,10 @@ import java.io.IOException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.threerings.getdown.Log;
|
||||
import com.threerings.getdown.data.Resource;
|
||||
|
||||
import static com.threerings.getdown.Log.log;
|
||||
|
||||
/**
|
||||
* Handles the download of a collection of files, first issuing HTTP head requests to obtain size
|
||||
* information and then downloading the files individually, reporting progress back via a callback
|
||||
@@ -112,7 +113,7 @@ public abstract class Downloader extends Thread
|
||||
discoverSize(resource);
|
||||
}
|
||||
|
||||
Log.info("Downloading " + _totalSize + " bytes...");
|
||||
log.info("Downloading " + _totalSize + " bytes...");
|
||||
|
||||
// make a note of the time at which we started the download
|
||||
_start = System.currentTimeMillis();
|
||||
@@ -137,7 +138,7 @@ public abstract class Downloader extends Thread
|
||||
if (_obs != null) {
|
||||
_obs.downloadFailed(current, e);
|
||||
} else {
|
||||
Log.logStackTrace(e);
|
||||
log.warning("Observer failed.", e);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -168,7 +169,7 @@ public abstract class Downloader extends Thread
|
||||
File parent = new File(rsrc.getLocal().getParent());
|
||||
if (!parent.exists()) {
|
||||
if (!parent.mkdirs()) {
|
||||
Log.warning("Failed to create target directory for resource '" + rsrc + "'. " +
|
||||
log.warning("Failed to create target directory for resource '" + rsrc + "'. " +
|
||||
"Download will certainly fail.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,9 +27,11 @@ import java.net.HttpURLConnection;
|
||||
import java.util.List;
|
||||
|
||||
import com.samskivert.io.StreamUtil;
|
||||
import com.threerings.getdown.Log;
|
||||
|
||||
import com.threerings.getdown.data.Resource;
|
||||
|
||||
import static com.threerings.getdown.Log.log;
|
||||
|
||||
/**
|
||||
* Implements downloading files over HTTP
|
||||
*/
|
||||
@@ -89,7 +91,7 @@ public class HTTPDownloader extends Downloader
|
||||
throw new IOException(errmsg);
|
||||
}
|
||||
|
||||
Log.info("Downloading resource [url=" + rsrc.getRemote() + "].");
|
||||
log.info("Downloading resource [url=" + rsrc.getRemote() + "].");
|
||||
InputStream in = null;
|
||||
FileOutputStream out = null;
|
||||
try {
|
||||
|
||||
@@ -27,9 +27,10 @@ import java.util.List;
|
||||
import org.klomp.snark.Snark;
|
||||
import org.klomp.snark.SnarkShutdown;
|
||||
|
||||
import com.threerings.getdown.Log;
|
||||
import com.threerings.getdown.data.Resource;
|
||||
|
||||
import static com.threerings.getdown.Log.log;
|
||||
|
||||
/**
|
||||
* Implements downloading data using BitTorrent
|
||||
*/
|
||||
@@ -38,7 +39,7 @@ public class TorrentDownloader extends Downloader
|
||||
public TorrentDownloader (List<Resource> resources, Observer obs)
|
||||
{
|
||||
super(resources, obs);
|
||||
Log.info("Using bittorrent to fetch files");
|
||||
log.info("Using bittorrent to fetch files");
|
||||
for (Resource resource : resources) {
|
||||
String url = resource.getRemote().toString() + ".torrent";
|
||||
Snark snark = new Snark(url, null, -1, null, null);
|
||||
@@ -69,7 +70,7 @@ public class TorrentDownloader extends Downloader
|
||||
snark.setupNetwork();
|
||||
length = snark.meta.getTotalLength();
|
||||
} catch (IOException ioe) {
|
||||
Log.warning("Bittorrent failed, falling back to HTTP");
|
||||
log.warning("Bittorrent failed, falling back to HTTP");
|
||||
SnarkShutdown stopper = _stoppermap.get(rsrc);
|
||||
stopper.run();
|
||||
Runtime.getRuntime().removeShutdownHook(stopper);
|
||||
@@ -111,7 +112,7 @@ public class TorrentDownloader extends Downloader
|
||||
_currentSize = snark.coordinator.getDownloaded();
|
||||
if ((_currentSize < SIZE_THRESHOLD &&
|
||||
(now - _start) >= TIME_THRESHOLD)) {
|
||||
Log.info("Torrenting too slow, falling back to HTTP.");
|
||||
log.info("Torrenting too slow, falling back to HTTP.");
|
||||
// The download isn't going as planned, abort;
|
||||
snarkStopper.run();
|
||||
Runtime.getRuntime().removeShutdownHook(snarkStopper);
|
||||
|
||||
@@ -32,10 +32,11 @@ import java.util.zip.ZipEntry;
|
||||
import com.samskivert.io.StreamUtil;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import com.threerings.getdown.Log;
|
||||
import com.threerings.getdown.util.FileUtil;
|
||||
import com.threerings.getdown.util.ProgressObserver;
|
||||
|
||||
import static com.threerings.getdown.Log.log;
|
||||
|
||||
/**
|
||||
* Applies a unified patch file to an application directory, providing
|
||||
* percentage completion feedback along the way. <em>Note:</em> the
|
||||
@@ -122,7 +123,7 @@ public class Patcher
|
||||
File pdir = target.getParentFile();
|
||||
if (!pdir.exists()) {
|
||||
if (!pdir.mkdirs()) {
|
||||
Log.warning("Failed to create parent for '" + target + "'.");
|
||||
log.warning("Failed to create parent for '" + target + "'.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ import java.util.List;
|
||||
import com.samskivert.io.StreamUtil;
|
||||
import com.samskivert.util.StringUtil;
|
||||
|
||||
import com.threerings.getdown.Log;
|
||||
import static com.threerings.getdown.Log.log;
|
||||
|
||||
/**
|
||||
* Parses a file containing key/value pairs and returns a {@link HashMap} with the values. Keys may
|
||||
@@ -90,7 +90,7 @@ public class ConfigUtil
|
||||
if (pair[1].startsWith("[")) {
|
||||
cidx = pair[1].indexOf("]");
|
||||
if (cidx == -1) {
|
||||
Log.warning("Bogus platform specifier [key=" + pair[0] +
|
||||
log.warning("Bogus platform specifier [key=" + pair[0] +
|
||||
", value=" + pair[1] + "].");
|
||||
} else {
|
||||
String platform = pair[1].substring(1, cidx);
|
||||
@@ -100,12 +100,12 @@ public class ConfigUtil
|
||||
if (platform.startsWith("!")) {
|
||||
platform = platform.substring(1);
|
||||
if (osname.indexOf(platform) != -1) {
|
||||
Log.info("Skipping [platform=!" + platform +
|
||||
log.info("Skipping [platform=!" + platform +
|
||||
", key=" + pair[0] + ", value=" + pair[1] + "].");
|
||||
continue;
|
||||
}
|
||||
} else if (osname.indexOf(platform) == -1) {
|
||||
Log.info("Skipping [platform=" + platform +
|
||||
log.info("Skipping [platform=" + platform +
|
||||
", key=" + pair[0] + ", value=" + pair[1] + "].");
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ import com.samskivert.io.StreamUtil;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import com.threerings.getdown.Log;
|
||||
import static com.threerings.getdown.Log.log;
|
||||
|
||||
/**
|
||||
* File related utilities.
|
||||
@@ -55,14 +55,14 @@ public class FileUtil
|
||||
File temp = new File(dest.getPath() + "_old");
|
||||
if (temp.exists()) {
|
||||
if (!temp.delete()) {
|
||||
Log.warning("Failed to delete old intermediate file " + temp + ".");
|
||||
log.warning("Failed to delete old intermediate file " + temp + ".");
|
||||
// the subsequent code will probably fail
|
||||
}
|
||||
}
|
||||
if (dest.renameTo(temp)) {
|
||||
if (source.renameTo(dest)) {
|
||||
if (temp.delete()) {
|
||||
Log.warning("Failed to delete intermediate file " + temp + ".");
|
||||
log.warning("Failed to delete intermediate file " + temp + ".");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -77,13 +77,13 @@ public class FileUtil
|
||||
fout = new FileOutputStream(dest);
|
||||
IOUtils.copy(fin, fout);
|
||||
if (!source.delete()) {
|
||||
Log.warning("Failed to delete " + source +
|
||||
log.warning("Failed to delete " + source +
|
||||
" after brute force copy to " + dest + ".");
|
||||
}
|
||||
return true;
|
||||
|
||||
} catch (IOException ioe) {
|
||||
Log.warning("Failed to copy " + source + " to " + dest + ": " + ioe);
|
||||
log.warning("Failed to copy " + source + " to " + dest + ": " + ioe);
|
||||
return false;
|
||||
|
||||
} finally {
|
||||
|
||||
@@ -90,7 +90,7 @@ public class LaunchUtil
|
||||
Runtime.getRuntime().exec(args, null);
|
||||
return true;
|
||||
} catch (IOException ioe) {
|
||||
log.log(Level.WARNING, "Failed to run getdown", ioe);
|
||||
log.warning("Failed to run getdown", ioe);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -136,7 +136,7 @@ public class LaunchUtil
|
||||
vmpath = "/usr/bin/java";
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
log.log(Level.WARNING, "Failed to check Mac OS canonical VM path.", ioe);
|
||||
log.warning("Failed to check Mac OS canonical VM path.", ioe);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ public class LaunchUtil
|
||||
try {
|
||||
IOUtils.copy(new FileInputStream(newgd), new FileOutputStream(curgd));
|
||||
} catch (IOException ioe) {
|
||||
log.log(Level.WARNING, "Mayday! Brute force copy method also failed.", ioe);
|
||||
log.warning("Mayday! Brute force copy method also failed.", ioe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user