diff --git a/build.xml b/build.xml
index 12d4f98..5a3799b 100644
--- a/build.xml
+++ b/build.xml
@@ -43,7 +43,9 @@
+ source="1.5" target="1.5">
+
+
diff --git a/src/java/com/threerings/getdown/data/Application.java b/src/java/com/threerings/getdown/data/Application.java
index bfdd6f1..82e745b 100644
--- a/src/java/com/threerings/getdown/data/Application.java
+++ b/src/java/com/threerings/getdown/data/Application.java
@@ -123,6 +123,7 @@ public class Application
try {
return createResource(CONFIG_FILE, false);
} catch (Exception e) {
+ Thread.dumpStack();
throw new RuntimeException("Invalid appbase '" + _vappbase + "'.");
}
}
@@ -131,7 +132,7 @@ public class Application
* Returns a list of the code {@link Resource} objects used by this
* application.
*/
- public List getCodeResources ()
+ public List getCodeResources ()
{
return _codes;
}
@@ -140,7 +141,7 @@ public class Application
* Returns a list of the non-code {@link Resource} objects used by
* this application.
*/
- public List getResources ()
+ public List getResources ()
{
return _resources;
}
@@ -188,7 +189,7 @@ public class Application
throws IOException
{
// parse our configuration file
- HashMap cdata = null;
+ HashMap cdata = null;
try {
cdata = ConfigUtil.parseConfig(_config, checkPlatform);
} catch (FileNotFoundException fnfe) {
@@ -319,9 +320,10 @@ public class Application
File file = getLocalPath("extra.txt");
if (file.exists()) {
try {
- List args = ConfigUtil.parsePairs(file, false);
- for (Iterator iter = args.iterator(); iter.hasNext(); ) {
- String[] pair = (String[])iter.next();
+ List args = ConfigUtil.parsePairs(file, false);
+ for (Iterator iter = args.iterator();
+ iter.hasNext();) {
+ String[] pair = iter.next();
_jvmargs.add(pair[0] + "=" + pair[1]);
}
} catch (Throwable t) {
@@ -423,15 +425,15 @@ public class Application
{
// create our classpath
StringBuffer cpbuf = new StringBuffer();
- for (Iterator iter = _codes.iterator(); iter.hasNext(); ) {
+ for (Iterator iter = _codes.iterator(); iter.hasNext(); ) {
if (cpbuf.length() > 0) {
cpbuf.append(File.pathSeparator);
}
- Resource rsrc = (Resource)iter.next();
+ Resource rsrc = iter.next();
cpbuf.append(rsrc.getLocal().getAbsolutePath());
}
- ArrayList args = new ArrayList();
+ ArrayList args = new ArrayList();
// reconstruct the path to the JVM
args.add(LaunchUtil.getJVMPath(_windebug));
@@ -468,16 +470,16 @@ public class Application
}
// add the JVM arguments
- for (Iterator iter = _jvmargs.iterator(); iter.hasNext(); ) {
- args.add(processArg((String)iter.next()));
+ for (Iterator iter = _jvmargs.iterator(); iter.hasNext(); ) {
+ args.add(processArg(iter.next()));
}
// add the application class name
args.add(_class);
// finally add the application arguments
- for (Iterator iter = _appargs.iterator(); iter.hasNext(); ) {
- args.add(processArg((String)iter.next()));
+ for (Iterator iter = _appargs.iterator(); iter.hasNext(); ) {
+ args.add(processArg(iter.next()));
}
String[] sargs = new String[args.size()];
@@ -618,20 +620,21 @@ public class Application
*/
public List verifyResources (ProgressObserver obs)
{
- ArrayList rsrcs = new ArrayList(), failures = new ArrayList();
+ ArrayList rsrcs = new ArrayList();
+ ArrayList failures = new ArrayList();
rsrcs.addAll(_codes);
rsrcs.addAll(_resources);
// total up the file size of the resources to validate
long totalSize = 0L;
- for (Iterator iter = rsrcs.iterator(); iter.hasNext(); ) {
- Resource rsrc = (Resource)iter.next();
+ for (Iterator iter = rsrcs.iterator(); iter.hasNext(); ) {
+ Resource rsrc = iter.next();
totalSize += rsrc.getLocal().length();
}
MetaProgressObserver mpobs = new MetaProgressObserver(obs, totalSize);
- for (Iterator iter = rsrcs.iterator(); iter.hasNext(); ) {
- Resource rsrc = (Resource)iter.next();
+ for (Iterator iter = rsrcs.iterator(); iter.hasNext(); ) {
+ Resource rsrc = iter.next();
mpobs.startElement(rsrc.getLocal().length());
if (rsrc.isMarkedValid()) {
@@ -684,10 +687,10 @@ public class Application
/** Clears all validation marker files for the resources in the
* supplied iterator. */
- protected void clearValidationMarkers (Iterator iter)
+ protected void clearValidationMarkers (Iterator iter)
{
while (iter.hasNext()) {
- ((Resource)iter.next()).clearMarker();
+ iter.next().clearMarker();
}
}
@@ -761,7 +764,8 @@ public class Application
}
/** Used to parse rectangle specifications from the config file. */
- protected Rectangle parseRect (HashMap cdata, String name, Rectangle def)
+ protected Rectangle parseRect (HashMap cdata,
+ String name, Rectangle def)
{
String value = (String)cdata.get(name);
if (!StringUtil.isBlank(value)) {
@@ -777,7 +781,8 @@ 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)
{
String value = (String)cdata.get(name);
if (!StringUtil.isBlank(value)) {
@@ -804,9 +809,9 @@ public class Application
protected String _name;
protected boolean _windebug;
- protected ArrayList _codes = new ArrayList();
- protected ArrayList _resources = new ArrayList();
+ protected ArrayList _codes = new ArrayList();
+ protected ArrayList _resources = new ArrayList();
- protected ArrayList _jvmargs = new ArrayList();
- protected ArrayList _appargs = new ArrayList();
+ protected ArrayList _jvmargs = new ArrayList();
+ protected ArrayList _appargs = new ArrayList();
}
diff --git a/src/java/com/threerings/getdown/data/Digest.java b/src/java/com/threerings/getdown/data/Digest.java
index 7599151..f305154 100644
--- a/src/java/com/threerings/getdown/data/Digest.java
+++ b/src/java/com/threerings/getdown/data/Digest.java
@@ -85,7 +85,7 @@ public class Digest
{
try {
String cmd5 = resource.computeDigest(getMessageDigest(), obs);
- String emd5 = (String)_digests.get(resource.getPath());
+ String emd5 = _digests.get(resource.getPath());
if (cmd5.equals(emd5)) {
return true;
}
@@ -102,7 +102,7 @@ public class Digest
* Creates a digest file at the specified location using the supplied
* list of resources.
*/
- public static void createDigest (List resources, File output)
+ public static void createDigest (List resources, File output)
throws IOException
{
MessageDigest md = getMessageDigest();
@@ -111,8 +111,8 @@ public class Digest
new OutputStreamWriter(new FileOutputStream(output), "UTF-8"));
// compute and append the MD5 digest of each resource in the list
- for (Iterator iter = resources.iterator(); iter.hasNext(); ) {
- Resource rsrc = (Resource)iter.next();
+ for (Iterator iter = resources.iterator(); iter.hasNext();) {
+ Resource rsrc = iter.next();
String path = rsrc.getPath();
try {
String digest = rsrc.computeDigest(md, null);
@@ -152,6 +152,6 @@ public class Digest
data.append(path).append(" = ").append(digest).append("\n");
}
- protected HashMap _digests = new HashMap();
+ protected HashMap _digests = new HashMap();
protected String _metaDigest = "";
}
diff --git a/src/java/com/threerings/getdown/data/Resource.java b/src/java/com/threerings/getdown/data/Resource.java
index 536ff29..13284b7 100644
--- a/src/java/com/threerings/getdown/data/Resource.java
+++ b/src/java/com/threerings/getdown/data/Resource.java
@@ -8,7 +8,6 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.net.MalformedURLException;
import java.net.URL;
import java.security.MessageDigest;
@@ -204,7 +203,8 @@ public class Resource
if (target.getPath().endsWith(".jar")) {
JarFile jar = new JarFile(target);
try {
- SortableArrayList entries = new SortableArrayList();
+ SortableArrayList entries =
+ new SortableArrayList();
CollectionUtil.addAll(entries, jar.entries());
entries.sort(ENTRY_COMP);
@@ -272,10 +272,9 @@ public class Resource
protected boolean _unpack;
/** Used to sort the entries in a jar file. */
- protected static final Comparator ENTRY_COMP = new Comparator() {
- public int compare (Object o1, Object o2) {
- JarEntry e1 = (JarEntry)o1;
- JarEntry e2 = (JarEntry)o2;
+ protected static final Comparator ENTRY_COMP =
+ new Comparator() {
+ public int compare (JarEntry e1, JarEntry e2) {
return e1.getName().compareTo(e2.getName());
}
};
diff --git a/src/java/com/threerings/getdown/launcher/AbortPanel.java b/src/java/com/threerings/getdown/launcher/AbortPanel.java
index 89dd79b..b5705e7 100644
--- a/src/java/com/threerings/getdown/launcher/AbortPanel.java
+++ b/src/java/com/threerings/getdown/launcher/AbortPanel.java
@@ -12,11 +12,9 @@ import java.util.ResourceBundle;
import javax.swing.BorderFactory;
import javax.swing.JButton;
-import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
-import javax.swing.border.EmptyBorder;
import com.samskivert.swing.GroupLayout;
import com.samskivert.swing.Spacer;
diff --git a/src/java/com/threerings/getdown/launcher/Getdown.java b/src/java/com/threerings/getdown/launcher/Getdown.java
index 9fb0d3c..d0252d0 100644
--- a/src/java/com/threerings/getdown/launcher/Getdown.java
+++ b/src/java/com/threerings/getdown/launcher/Getdown.java
@@ -10,7 +10,6 @@ import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import javax.imageio.ImageIO;
-import javax.swing.JDialog;
import javax.swing.JFrame;
import java.io.BufferedOutputStream;
@@ -26,7 +25,6 @@ import java.io.PrintStream;
import java.net.HttpURLConnection;
import java.net.URL;
-import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@@ -390,7 +388,7 @@ public class Getdown extends Thread
final Resource patch = _app.getPatchResource();
if (patch != null) {
// download the patch file...
- ArrayList list = new ArrayList();
+ ArrayList list = new ArrayList();
list.add(patch);
download(list);
@@ -495,8 +493,7 @@ public class Getdown extends Thread
InputStream stderr = proc.getErrorStream();
BufferedReader reader = new BufferedReader(
new InputStreamReader(stderr));
- String line = null;
- while ((line = reader.readLine()) != null) {
+ while (reader.readLine() != null) {
// nothing doing!
}
Log.info("Process exited: " + proc.waitFor());
diff --git a/src/java/com/threerings/getdown/launcher/StatusPanel.java b/src/java/com/threerings/getdown/launcher/StatusPanel.java
index d55b4b0..30a819c 100644
--- a/src/java/com/threerings/getdown/launcher/StatusPanel.java
+++ b/src/java/com/threerings/getdown/launcher/StatusPanel.java
@@ -3,7 +3,6 @@
package com.threerings.getdown.launcher;
-import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics2D;
diff --git a/src/java/com/threerings/getdown/tools/Differ.java b/src/java/com/threerings/getdown/tools/Differ.java
index 38f5008..e769eeb 100644
--- a/src/java/com/threerings/getdown/tools/Differ.java
+++ b/src/java/com/threerings/getdown/tools/Differ.java
@@ -3,14 +3,12 @@
package com.threerings.getdown.tools;
-import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Enumeration;
@@ -75,13 +73,13 @@ public class Differ
Application oapp = new Application(ovdir, null);
oapp.init(false);
- ArrayList orsrcs = new ArrayList();
+ ArrayList orsrcs = new ArrayList();
orsrcs.addAll(oapp.getCodeResources());
orsrcs.addAll(oapp.getResources());
Application napp = new Application(nvdir, null);
napp.init(false);
- ArrayList nrsrcs = new ArrayList();
+ ArrayList nrsrcs = new ArrayList();
nrsrcs.addAll(napp.getCodeResources());
nrsrcs.addAll(napp.getResources());
@@ -95,7 +93,7 @@ public class Differ
// for each file in the new application, it either already
// exists in the old application, or it is new
for (int ii = 0; ii < nrsrcs.size(); ii++) {
- Resource rsrc = (Resource)nrsrcs.get(ii);
+ Resource rsrc = nrsrcs.get(ii);
int oidx = orsrcs.indexOf(rsrc);
Resource orsrc = (oidx == -1) ?
null : (Resource)orsrcs.remove(oidx);
@@ -147,7 +145,7 @@ public class Differ
// now any file remaining in orsrcs needs to be removed
for (int ii = 0; ii < orsrcs.size(); ii++) {
- Resource rsrc = (Resource)orsrcs.get(ii);
+ Resource rsrc = orsrcs.get(ii);
// simply add an entry with the resource name and the
// deletion suffix
if (verbose) {
diff --git a/src/java/com/threerings/getdown/tools/DigesterTask.java b/src/java/com/threerings/getdown/tools/DigesterTask.java
index bbc11f6..59d9355 100644
--- a/src/java/com/threerings/getdown/tools/DigesterTask.java
+++ b/src/java/com/threerings/getdown/tools/DigesterTask.java
@@ -12,6 +12,7 @@ import org.apache.tools.ant.Task;
import com.threerings.getdown.data.Application;
import com.threerings.getdown.data.Digest;
+import com.threerings.getdown.data.Resource;
/**
* An ant task used to create a digest.txt for a Getdown
@@ -60,7 +61,7 @@ public class DigesterTask extends Task
Application app = new Application(appdir, null);
app.init(false);
- ArrayList rsrcs = new ArrayList();
+ ArrayList rsrcs = new ArrayList();
rsrcs.add(app.getConfigResource());
rsrcs.addAll(app.getCodeResources());
rsrcs.addAll(app.getResources());
diff --git a/src/java/com/threerings/getdown/tools/JarDiffPatcher.java b/src/java/com/threerings/getdown/tools/JarDiffPatcher.java
index 4b901b7..162ddcc 100644
--- a/src/java/com/threerings/getdown/tools/JarDiffPatcher.java
+++ b/src/java/com/threerings/getdown/tools/JarDiffPatcher.java
@@ -62,21 +62,21 @@ public class JarDiffPatcher
JarOutputStream jos = new JarOutputStream(target);
JarFile oldJar = new JarFile(oldFile);
JarFile jarDiff = new JarFile(diffFile);
- Set ignoreSet = new HashSet();
+ Set ignoreSet = new HashSet();
- Map renameMap = new HashMap();
+ Map renameMap = new HashMap();
determineNameMapping(jarDiff, ignoreSet, renameMap);
// get all keys in renameMap
Object[] keys = renameMap.keySet().toArray();
// Files to implicit move
- Set oldjarNames = new HashSet();
+ Set oldjarNames = new HashSet();
- Enumeration oldEntries = oldJar.entries();
+ Enumeration oldEntries = oldJar.entries();
if (oldEntries != null) {
while (oldEntries.hasMoreElements()) {
- oldjarNames.add(((JarEntry)oldEntries.nextElement()).getName());
+ oldjarNames.add(oldEntries.nextElement().getName());
}
}
@@ -94,10 +94,10 @@ public class JarDiffPatcher
size -= ignoreSet.size();
// Add content from JARDiff
- Enumeration entries = jarDiff.entries();
+ Enumeration entries = jarDiff.entries();
if (entries != null) {
while (entries.hasMoreElements()) {
- JarEntry entry = (JarEntry)entries.nextElement();
+ JarEntry entry = entries.nextElement();
if (!INDEX_NAME.equals(entry.getName())) {
updateObserver(observer, currentEntry, size);
currentEntry++;
@@ -188,55 +188,56 @@ public class JarDiffPatcher
}
}
- protected void determineNameMapping (JarFile jarDiff, Set ignoreSet,
- Map renameMap)
+ protected void determineNameMapping (JarFile jarDiff, Set ignoreSet,
+ Map renameMap)
throws IOException
{
InputStream is = jarDiff.getInputStream(jarDiff.getEntry(INDEX_NAME));
if (is == null) {
- throw new IOException("error.noindex");
- }
+ throw new IOException("error.noindex");
+ }
LineNumberReader indexReader =
new LineNumberReader(new InputStreamReader(is, "UTF-8"));
String line = indexReader.readLine();
if (line == null || !line.equals(VERSION_HEADER)) {
- throw new IOException("jardiff.error.badheader: " + line);
+ throw new IOException("jardiff.error.badheader: " + line);
}
while ((line = indexReader.readLine()) != null) {
if (line.startsWith(REMOVE_COMMAND)) {
- List sub = getSubpaths(
+ List sub = getSubpaths(
line.substring(REMOVE_COMMAND.length()));
if (sub.size() != 1) {
- throw new IOException("error.badremove: " + line);
+ throw new IOException("error.badremove: " + line);
}
ignoreSet.add(sub.get(0));
} else if (line.startsWith(MOVE_COMMAND)) {
- List sub = getSubpaths(line.substring(MOVE_COMMAND.length()));
+ List sub = getSubpaths(line.substring(
+ MOVE_COMMAND.length()));
if (sub.size() != 2) {
- throw new IOException("error.badmove: " + line);
+ throw new IOException("error.badmove: " + line);
}
- // target of move should be the key
+ // target of move should be the key
if (renameMap.put(sub.get(1), sub.get(0)) != null) {
- // invalid move - should not move to same target twice
- throw new IOException("error.badmove: " + line);
- }
+ // invalid move - should not move to same target twice
+ throw new IOException("error.badmove: " + line);
+ }
} else if (line.length() > 0) {
- throw new IOException("error.badcommand: " + line);
+ throw new IOException("error.badcommand: " + line);
}
}
}
- protected List getSubpaths (String path)
+ protected List getSubpaths (String path)
{
int index = 0;
int length = path.length();
- ArrayList sub = new ArrayList();
+ ArrayList sub = new ArrayList();
while (index < length) {
while (index < length && Character.isWhitespace
diff --git a/src/java/com/threerings/getdown/util/ConfigUtil.java b/src/java/com/threerings/getdown/util/ConfigUtil.java
index 3eb7237..23bcaa7 100644
--- a/src/java/com/threerings/getdown/util/ConfigUtil.java
+++ b/src/java/com/threerings/getdown/util/ConfigUtil.java
@@ -33,10 +33,10 @@ public class ConfigUtil
* @return a list of String[] instances containing the
* key/value pairs in the order they were parsed from the file.
*/
- public static List parsePairs (File config, boolean checkPlatform)
+ public static List parsePairs (File config, boolean checkPlatform)
throws IOException
{
- ArrayList pairs = new ArrayList();
+ ArrayList pairs = new ArrayList();
String osname = System.getProperty("os.name");
osname = (osname == null) ? "" : osname.toLowerCase();
@@ -118,12 +118,16 @@ public class ConfigUtil
* of strings if more than one key/value pair in the config file was
* associated with the same key.
*/
- public static HashMap parseConfig (File config, boolean checkPlatform)
+ public static HashMap parseConfig (File config,
+ boolean checkPlatform)
throws IOException
{
- List pairs = parsePairs(config, checkPlatform);
- HashMap data = new HashMap();
+ List pairs = parsePairs(config, checkPlatform);
+ HashMap data = new HashMap();
+ // I thought that we could use HashMap and put
+ // new String[] {pair[1]} for the null case, but it mysteriously dies
+ // on launch, so leaving it as HashMap for now
for (Iterator iter = pairs.iterator(); iter.hasNext(); ) {
String[] pair = (String[])iter.next();
Object value = data.get(pair[0]);