From da3d23a973e64c76080dc98ac06a2704479aeeaa Mon Sep 17 00:00:00 2001 From: Dave Hoover Date: Tue, 30 Nov 2010 01:06:20 +0000 Subject: [PATCH] Whitespace --- .../threerings/getdown/data/Application.java | 57 +++++++++---------- .../com/threerings/getdown/data/Digest.java | 37 +++++------- .../threerings/getdown/launcher/Getdown.java | 26 ++++----- 3 files changed, 53 insertions(+), 67 deletions(-) diff --git a/src/main/java/com/threerings/getdown/data/Application.java b/src/main/java/com/threerings/getdown/data/Application.java index f3e0ce1..bdb175f 100644 --- a/src/main/java/com/threerings/getdown/data/Application.java +++ b/src/main/java/com/threerings/getdown/data/Application.java @@ -302,8 +302,8 @@ public class Application public Resource getPatchResource (String auxgroup) { if (_targetVersion <= _version) { - log.warning("Requested patch resource for up-to-date or non-versioned application " + - "[cvers=" + _version + ", tvers=" + _targetVersion + "]."); + log.warning("Requested patch resource for up-to-date or non-versioned application", + "cvers", _version, "tvers", _targetVersion); return null; } @@ -313,9 +313,8 @@ 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 + - ", appbase=" + _appbase + ", tvers=" + _targetVersion + - ", error=" + e + "]."); + log.warning("Failed to create patch resource path", + "pfile", pfile, "appbase", _appbase, "tvers", _targetVersion, "error", e); return null; } } @@ -336,9 +335,8 @@ 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 + - ", tvers=" + _targetVersion + ", javaloc=" + _javaLocation + - ", error=" + e + "]."); + log.warning("Failed to create VM resource", "vmfile", vmfile, "appbase", _appbase, + "tvers", _targetVersion, "javaloc", _javaLocation, "error", e); return null; } } @@ -354,9 +352,8 @@ 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 + - ", appbase=" + _appbase + ", tvers=" + _targetVersion + - ", error=" + e + "]."); + log.warning("Failed to create full resource path", + "file", file, "appbase", _appbase, "tvers", _targetVersion, "error", e); return null; } } @@ -372,11 +369,9 @@ public class Application try { String suffix = _trackingURLSuffix == null ? "" : _trackingURLSuffix; String ga = getGATrackingCode(); - return _trackingURL == null ? - null : new URL(_trackingURL + event + suffix + ga); + return _trackingURL == null ? null : new URL(_trackingURL + event + suffix + ga); } catch (MalformedURLException mue) { - log.warning("Invalid tracking URL [path=" + _trackingURL + ", event=" + event + - ", error=" + mue + "]."); + log.warning("Invalid tracking URL", "path", _trackingURL, "event", event, "error", mue); return null; } } @@ -681,8 +676,8 @@ 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 + - ", needed=" + _javaVersion + "]."); + log.warning("Unable to parse VM version, hoping for the best", + "version", verstr, "needed", _javaVersion); return true; } @@ -1069,12 +1064,12 @@ 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 + "]. " + - "Requesting redownload..."); + log.info("Failure validating resource. Requesting redownload...", + "rsrc", rsrc, "error", e); } finally { mpobs.progress(100); @@ -1133,13 +1128,13 @@ 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() + "]", 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() + "]", 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", e); @@ -1159,12 +1154,12 @@ public class Application try { _lock.release(); } catch (IOException e) { - log.warning("Unable to release lock [message=" + e.getMessage() + "]", 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() + "]", e); + log.warning("Unable to close lock channel", "message", e.getMessage(), e); } _lockChannel = null; _lock = null; @@ -1200,7 +1195,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); @@ -1232,10 +1227,10 @@ 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++; } @@ -1280,8 +1275,8 @@ public class Application try { targetURL = getRemoteURL(path); } catch (Exception e) { - log.warning("Requested to download invalid control file [appbase=" + _vappbase + - ", path=" + path + ", error=" + e + "]."); + log.warning("Requested to download invalid control file", + "appbase", _vappbase, "path", path, "error", e); throw (IOException) new IOException("Invalid path '" + path + "'.").initCause(e); } @@ -1355,7 +1350,7 @@ public class Application } /** Used to parse color specifications from the config file. */ - protected Color parseColor (HashMap cdata, String name, Color def) + protected Color parseColor (HashMap cdata, String name, Color def) { return parseColor(cdata, name, def, true); } @@ -1391,7 +1386,7 @@ public class Application } /** Parses a list of strings from the config file. */ - protected String[] parseList (HashMap cdata, String name) + protected String[] parseList (HashMap cdata, String name) { String value = (String)cdata.get(name); return (value == null) ? new String[0] : StringUtil.parseStringArray(value); diff --git a/src/main/java/com/threerings/getdown/data/Digest.java b/src/main/java/com/threerings/getdown/data/Digest.java index a7f0eca..2bfd8c8 100644 --- a/src/main/java/com/threerings/getdown/data/Digest.java +++ b/src/main/java/com/threerings/getdown/data/Digest.java @@ -46,8 +46,8 @@ import com.threerings.getdown.util.ProgressObserver; import static com.threerings.getdown.Log.log; /** - * Manages the digest.txt file and the computing and - * processing of MD5 digests for an application. + * Manages the digest.txt file and the computing and processing of MD5 digests for an + * application. */ public class Digest { @@ -55,8 +55,8 @@ public class Digest public static final String DIGEST_FILE = "digest.txt"; /** - * Creates a digest instance which will parse and validate the - * digest.txt in the supplied application directory. + * Creates a digest instance which will parse and validate the digest.txt in the + * supplied application directory. */ public Digest (File appdir) throws IOException @@ -78,8 +78,7 @@ public class Digest byte[] contents = data.toString().getBytes("UTF-8"); String md5 = StringUtil.hexlate(md.digest(contents)); if (!md5.equals(_metaDigest)) { - String err = MessageUtil.tcompose( - "m.invalid_digest_file", _metaDigest, md5); + String err = MessageUtil.tcompose("m.invalid_digest_file", _metaDigest, md5); throw new IOException(err); } } @@ -93,13 +92,11 @@ public class Digest } /** - * Computes the MD5 hash of the specified resource and compares it - * with the value parsed from the digest file. Logs a message if the - * resource fails validation. + * Computes the MD5 hash of the specified resource and compares it with the value parsed from + * the digest file. Logs a message if the resource fails validation. * - * @return true if the resource is valid, false if it failed the - * digest check or if an I/O error was encountered during the - * validation process. + * @return true if the resource is valid, false if it failed the digest check or if an I/O + * error was encountered during the validation process. */ public boolean validateResource (Resource resource, ProgressObserver obs) { @@ -109,18 +106,16 @@ public class Digest if (cmd5.equals(emd5)) { return true; } - log.info("Resource failed digest check [rsrc=" + resource + - ", computed=" + cmd5 + ", expected=" + emd5 + "]."); + log.info("Resource failed digest check", + "rsrc", resource, "computed", cmd5, "expected", emd5); } catch (Throwable t) { - log.info("Resource failed digest check [rsrc=" + resource + - ", error=" + t + "]."); + log.info("Resource failed digest check", "rsrc", resource, "error", t); } return false; } /** - * Creates a digest file at the specified location using the supplied - * list of resources. + * Creates a digest file at the specified location using the supplied list of resources. */ public static void createDigest (List resources, File output) throws IOException @@ -146,15 +141,13 @@ public class Digest // finally compute and append the digest for the file contents md.reset(); byte[] contents = data.toString().getBytes("UTF-8"); - pout.println(DIGEST_FILE + " = " + - StringUtil.hexlate(md.digest(contents))); + pout.println(DIGEST_FILE + " = " + StringUtil.hexlate(md.digest(contents))); pout.close(); } /** - * Obtains an appropriate message digest instance for use by the - * Getdown system. + * Obtains an appropriate message digest instance for use by the Getdown system. */ public static MessageDigest getMessageDigest () { diff --git a/src/main/java/com/threerings/getdown/launcher/Getdown.java b/src/main/java/com/threerings/getdown/launcher/Getdown.java index 6fd98be..21da6b5 100644 --- a/src/main/java/com/threerings/getdown/launcher/Getdown.java +++ b/src/main/java/com/threerings/getdown/launcher/Getdown.java @@ -201,7 +201,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)) { @@ -273,7 +273,7 @@ public abstract class Getdown extends Thread } } 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); } } @@ -347,7 +347,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); } } @@ -525,7 +525,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; } } @@ -568,8 +568,7 @@ public abstract class Getdown extends Thread 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 + - ", error=" + e + "]."); + 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 } } @@ -580,7 +579,7 @@ public abstract class Getdown extends Thread 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); @@ -621,7 +620,7 @@ 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 + "].", e); + log.warning("Failed to apply patch", "prsrc", prsrc, e); } // clean up the patch file @@ -683,7 +682,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 + "].", e); + log.warning("Download failed", "rsrc", rsrc, e); } /** The last percentage at which we checked for another getdown running, or -1 for not @@ -950,7 +949,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); } } @@ -980,16 +979,15 @@ public abstract class Getdown extends Thread ucon.connect(); try { if (ucon.getResponseCode() != HttpURLConnection.HTTP_OK) { - log.warning("Failed to report tracking event [url=" + _url + - ", rcode=" + ucon.getResponseCode() + "]."); + log.warning("Failed to report tracking event", + "url", _url, "rcode", ucon.getResponseCode()); } } finally { ucon.disconnect(); } } catch (IOException ioe) { - log.warning("Failed to report tracking event [url=" + _url + - ", error=" + ioe + "]."); + log.warning("Failed to report tracking event", "url", _url, "error", ioe); } }