From 31cace3107f9ac8033853567ff06aa57ef317cfd Mon Sep 17 00:00:00 2001 From: Charlie Groves Date: Mon, 17 Aug 2009 20:13:31 +0000 Subject: [PATCH] @Override, generics and unused imports --- .../com/threerings/getdown/data/Application.java | 15 ++++++--------- src/java/com/threerings/getdown/data/Digest.java | 12 ++++-------- .../com/threerings/getdown/data/Resource.java | 12 ++++++------ .../threerings/getdown/launcher/AbortPanel.java | 1 + .../com/threerings/getdown/launcher/Getdown.java | 8 +++++--- .../threerings/getdown/launcher/GetdownApp.java | 8 +++++++- .../getdown/launcher/GetdownApplet.java | 7 +++++++ .../threerings/getdown/launcher/ProxyPanel.java | 3 +++ .../threerings/getdown/launcher/StatusPanel.java | 7 +++++-- .../threerings/getdown/net/HTTPDownloader.java | 2 ++ .../threerings/getdown/net/TorrentDownloader.java | 2 ++ src/java/com/threerings/getdown/tools/Differ.java | 10 +++++----- .../threerings/getdown/tools/DigesterTask.java | 1 + .../threerings/getdown/tools/JarDiffPatcher.java | 13 ++++++------- .../com/threerings/getdown/tools/Patcher.java | 9 +++++---- .../com/threerings/getdown/util/ConfigUtil.java | 11 ++++------- .../com/threerings/getdown/util/LaunchUtil.java | 2 -- 17 files changed, 69 insertions(+), 54 deletions(-) diff --git a/src/java/com/threerings/getdown/data/Application.java b/src/java/com/threerings/getdown/data/Application.java index b7adc8b..6770a59 100644 --- a/src/java/com/threerings/getdown/data/Application.java +++ b/src/java/com/threerings/getdown/data/Application.java @@ -23,12 +23,6 @@ // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. package com.threerings.getdown.data; -import java.io.FileInputStream; - -import com.samskivert.io.StreamUtil; - -import static com.threerings.getdown.Log.log; - import java.awt.Color; import java.awt.Rectangle; import java.io.BufferedReader; @@ -81,6 +75,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 getdown.txt * configuration file. @@ -140,6 +136,7 @@ public class Application public String installError; /** Generates a string representation of this instance. */ + @Override public String toString () { return "[name=" + name + ", bg=" + backgroundImage + ", pi=" + progressImage + @@ -750,7 +747,7 @@ public class Application } // pass along any pass-through arguments - for (Map.Entry entry : System.getProperties().entrySet()) { + for (Map.Entry entry : System.getProperties().entrySet()) { String key = (String)entry.getKey(); if (key.startsWith(PROP_PASSTHROUGH_PREFIX)) { key = key.substring(PROP_PASSTHROUGH_PREFIX.length()); @@ -834,7 +831,7 @@ public class Application URLClassLoader loader = new URLClassLoader( jars.toArray(new URL[jars.size()]), ClassLoader.getSystemClassLoader()) { - protected PermissionCollection getPermissions (CodeSource code) { + @Override protected PermissionCollection getPermissions (CodeSource code) { Permissions perms = new Permissions(); perms.add(new AllPermission()); return perms; @@ -856,7 +853,7 @@ public class Application // pass along any pass-through arguments Map passProps = new HashMap(); - for (Map.Entry entry : System.getProperties().entrySet()) { + for (Map.Entry entry : System.getProperties().entrySet()) { String key = (String)entry.getKey(); if (key.startsWith(PROP_PASSTHROUGH_PREFIX)) { key = key.substring(PROP_PASSTHROUGH_PREFIX.length()); diff --git a/src/java/com/threerings/getdown/data/Digest.java b/src/java/com/threerings/getdown/data/Digest.java index 3421d54..cb6d0cd 100644 --- a/src/java/com/threerings/getdown/data/Digest.java +++ b/src/java/com/threerings/getdown/data/Digest.java @@ -6,13 +6,13 @@ // // Redistribution and use in source and binary forms, with or without modification, are permitted // provided that the following conditions are met: -// +// // 1. Redistributions of source code must retain the above copyright notice, this list of // conditions and the following disclaimer. // 2. Redistributions in binary form must reproduce the above copyright notice, this list of // conditions and the following disclaimer in the documentation and/or other materials provided // with the distribution. -// +// // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, @@ -33,7 +33,6 @@ import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.HashMap; -import java.util.Iterator; import java.util.List; import com.samskivert.text.MessageUtil; @@ -63,9 +62,7 @@ public class Digest // parse and validate our digest file contents StringBuilder data = new StringBuilder(); File dfile = new File(appdir, DIGEST_FILE); - List pairs = ConfigUtil.parsePairs(dfile, false); - for (Iterator iter = pairs.iterator(); iter.hasNext(); ) { - String[] pair = (String[])iter.next(); + for (String[] pair : ConfigUtil.parsePairs(dfile, false)) { if (pair[0].equals(DIGEST_FILE)) { _metaDigest = pair[1]; break; @@ -132,8 +129,7 @@ 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 = iter.next(); + for (Resource rsrc : resources) { String path = rsrc.getPath(); try { String digest = rsrc.computeDigest(md, null); diff --git a/src/java/com/threerings/getdown/data/Resource.java b/src/java/com/threerings/getdown/data/Resource.java index 036f64c..fa85578 100644 --- a/src/java/com/threerings/getdown/data/Resource.java +++ b/src/java/com/threerings/getdown/data/Resource.java @@ -6,13 +6,13 @@ // // Redistribution and use in source and binary forms, with or without modification, are permitted // provided that the following conditions are met: -// +// // 1. Redistributions of source code must retain the above copyright notice, this list of // conditions and the following disclaimer. // 2. Redistributions in binary form must reproduce the above copyright notice, this list of // conditions and the following disclaimer in the documentation and/or other materials provided // with the distribution. -// +// // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, @@ -32,7 +32,6 @@ import java.net.URL; import java.security.MessageDigest; import java.util.Comparator; -import java.util.Iterator; import java.util.jar.JarEntry; import java.util.jar.JarFile; @@ -180,6 +179,7 @@ public class Resource /** * If our path is equal, we are equal. */ + @Override public boolean equals (Object other) { if (other instanceof Resource) { @@ -192,6 +192,7 @@ public class Resource /** * We hash on our path. */ + @Override public int hashCode () { return _path.hashCode(); @@ -200,6 +201,7 @@ public class Resource /** * Returns a string representation of this instance. */ + @Override public String toString () { return _path; @@ -228,9 +230,7 @@ public class Resource entries.sort(ENTRY_COMP); int eidx = 0; - for (Iterator iter = entries.iterator(); iter.hasNext(); ) { - JarEntry entry = (JarEntry)iter.next(); - + for (JarEntry entry : entries) { // skip metadata; we just want the goods if (entry.getName().startsWith("META-INF")) { updateProgress(obs, eidx, entries.size()); diff --git a/src/java/com/threerings/getdown/launcher/AbortPanel.java b/src/java/com/threerings/getdown/launcher/AbortPanel.java index 00be061..a5dd768 100644 --- a/src/java/com/threerings/getdown/launcher/AbortPanel.java +++ b/src/java/com/threerings/getdown/launcher/AbortPanel.java @@ -76,6 +76,7 @@ public class AbortPanel extends JFrame } // documentation inherited + @Override public Dimension getPreferredSize () { // this is annoyingly hardcoded, but we can't just force the width diff --git a/src/java/com/threerings/getdown/launcher/Getdown.java b/src/java/com/threerings/getdown/launcher/Getdown.java index 3c33595..88d3532 100644 --- a/src/java/com/threerings/getdown/launcher/Getdown.java +++ b/src/java/com/threerings/getdown/launcher/Getdown.java @@ -139,6 +139,7 @@ public abstract class Getdown extends Thread } } + @Override public void run () { // if we have no messages, just bail because we're hosed; the error message will be @@ -245,7 +246,7 @@ public abstract class Getdown extends Thread boolean enabled = false; RegistryKey.initialize(); RegistryKey r = new RegistryKey(RootKey.HKEY_CURRENT_USER, PROXY_REGISTRY); - for (Iterator iter = r.values(); iter.hasNext(); ) { + for (Iterator iter = r.values(); iter.hasNext(); ) { RegistryValue value = (RegistryValue)iter.next(); if (value.getName().equals("ProxyEnable")) { enabled = value.getStringValue().equals("1"); @@ -277,7 +278,7 @@ public abstract class Getdown extends Thread File pfile = _app.getLocalPath("proxy.txt"); if (pfile.exists()) { try { - HashMap pconf = ConfigUtil.parseConfig(pfile, false); + HashMap pconf = ConfigUtil.parseConfig(pfile, false); setProxyProperties((String)pconf.get("host"), (String)pconf.get("port")); return true; } catch (IOException ioe) { @@ -744,7 +745,7 @@ public abstract class Getdown extends Thread // spawn a daemon thread that will catch the early bits of stderr in case the // launch fails Thread t = new Thread() { - public void run () { + @Override public void run () { copyStream(stderr, System.err); } }; @@ -971,6 +972,7 @@ public abstract class Getdown extends Thread _url = url; } + @Override public void run () { try { HttpURLConnection ucon = (HttpURLConnection)_url.openConnection(); diff --git a/src/java/com/threerings/getdown/launcher/GetdownApp.java b/src/java/com/threerings/getdown/launcher/GetdownApp.java index 8101566..306f71a 100644 --- a/src/java/com/threerings/getdown/launcher/GetdownApp.java +++ b/src/java/com/threerings/getdown/launcher/GetdownApp.java @@ -27,6 +27,7 @@ import java.awt.Container; import java.awt.event.WindowEvent; import java.awt.event.WindowAdapter; import javax.swing.JFrame; +import javax.swing.WindowConstants; import java.io.File; import java.io.FileOutputStream; @@ -99,6 +100,7 @@ public class GetdownApp try { Getdown app = new Getdown(appDir, appId) { + @Override protected Container createContainer () { // create our user interface, and display it String title = @@ -106,6 +108,7 @@ public class GetdownApp if (_frame == null) { _frame = new JFrame(title); _frame.addWindowListener(new WindowAdapter() { + @Override public void windowClosing (WindowEvent evt) { handleWindowClose(); } @@ -115,9 +118,10 @@ public class GetdownApp _frame.setTitle(title); _frame.getContentPane().removeAll(); } - _frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); + _frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); return _frame.getContentPane(); } + @Override protected void showContainer () { if (_frame != null) { _frame.pack(); @@ -125,12 +129,14 @@ public class GetdownApp _frame.setVisible(true); } } + @Override protected void disposeContainer () { if (_frame != null) { _frame.dispose(); _frame = null; } } + @Override protected void exit (int exitCode) { System.exit(exitCode); } diff --git a/src/java/com/threerings/getdown/launcher/GetdownApplet.java b/src/java/com/threerings/getdown/launcher/GetdownApplet.java index 0526fc6..d72fab8 100644 --- a/src/java/com/threerings/getdown/launcher/GetdownApplet.java +++ b/src/java/com/threerings/getdown/launcher/GetdownApplet.java @@ -61,25 +61,32 @@ public class GetdownApplet extends JApplet // statically included trusted keys. _getdown = new Getdown(_config.appdir, null, GetdownApplet.class.getSigners(), _config.jvmargs) { + @Override protected Container createContainer () { getContentPane().removeAll(); return getContentPane(); } + @Override protected RotatingBackgrounds getBackground () { return _config.getBackgroundImages(GetdownApplet.this); } + @Override protected void showContainer () { ((JPanel)getContentPane()).revalidate(); } + @Override protected void disposeContainer () { // nothing to do as we're in an applet } + @Override protected boolean invokeDirect () { return _config.invokeDirect; } + @Override protected JApplet getApplet () { return GetdownApplet.this; } + @Override protected void exit (int exitCode) { _app.releaseLock(); _config.redirect(); diff --git a/src/java/com/threerings/getdown/launcher/ProxyPanel.java b/src/java/com/threerings/getdown/launcher/ProxyPanel.java index ba2b3b0..c261c34 100644 --- a/src/java/com/threerings/getdown/launcher/ProxyPanel.java +++ b/src/java/com/threerings/getdown/launcher/ProxyPanel.java @@ -96,6 +96,7 @@ public class ProxyPanel extends JPanel } // documentation inherited + @Override public void addNotify () { super.addNotify(); @@ -103,6 +104,7 @@ public class ProxyPanel extends JPanel } // documentation inherited + @Override public Dimension getPreferredSize () { // this is annoyingly hardcoded, but we can't just force the width @@ -144,6 +146,7 @@ public class ProxyPanel extends JPanel protected static class SaneTextField extends JTextField { + @Override public Dimension getPreferredSize () { Dimension d = super.getPreferredSize(); d.width = Math.max(d.width, 150); diff --git a/src/java/com/threerings/getdown/launcher/StatusPanel.java b/src/java/com/threerings/getdown/launcher/StatusPanel.java index 30e6d0f..d3a8746 100644 --- a/src/java/com/threerings/getdown/launcher/StatusPanel.java +++ b/src/java/com/threerings/getdown/launcher/StatusPanel.java @@ -36,6 +36,7 @@ import java.util.ResourceBundle; import javax.swing.JComponent; import com.samskivert.swing.Label; +import com.samskivert.swing.LabelStyleConstants; import com.samskivert.swing.util.SwingUtil; import com.samskivert.text.MessageUtil; import com.samskivert.util.StringUtil; @@ -110,7 +111,7 @@ public class StatusPanel extends JComponent _newplab = new Label(label, _ifc.progressText, _font); if (_ifc.textShadow != null) { _newplab.setAlternateColor(_ifc.textShadow); - _newplab.setStyle(Label.SHADOW); + _newplab.setStyle(LabelStyleConstants.SHADOW); } repaint(); } @@ -128,12 +129,13 @@ public class StatusPanel extends JComponent _newlab.setTargetWidth(width); if (_ifc.textShadow != null) { _newlab.setAlternateColor(_ifc.textShadow); - _newlab.setStyle(Label.SHADOW); + _newlab.setStyle(LabelStyleConstants.SHADOW); } repaint(); } // documentation inherited + @Override public void paintComponent (Graphics g) { super.paintComponent(g); @@ -204,6 +206,7 @@ public class StatusPanel extends JComponent } // documentation inherited + @Override public Dimension getPreferredSize () { return _psize; diff --git a/src/java/com/threerings/getdown/net/HTTPDownloader.java b/src/java/com/threerings/getdown/net/HTTPDownloader.java index bebf456..fe89699 100644 --- a/src/java/com/threerings/getdown/net/HTTPDownloader.java +++ b/src/java/com/threerings/getdown/net/HTTPDownloader.java @@ -60,6 +60,7 @@ public class HTTPDownloader extends Downloader * Issues a HEAD request for the specified resource and notes the * amount of data we will be downloading to account for it. */ + @Override protected long checkSize (Resource rsrc) throws IOException { @@ -80,6 +81,7 @@ public class HTTPDownloader extends Downloader } // documentation inherited + @Override protected void doDownload (Resource rsrc) throws IOException { diff --git a/src/java/com/threerings/getdown/net/TorrentDownloader.java b/src/java/com/threerings/getdown/net/TorrentDownloader.java index f2b6231..a1aff04 100644 --- a/src/java/com/threerings/getdown/net/TorrentDownloader.java +++ b/src/java/com/threerings/getdown/net/TorrentDownloader.java @@ -58,6 +58,7 @@ public class TorrentDownloader extends Downloader } // documentation inherited + @Override protected long checkSize(Resource rsrc) throws IOException { @@ -89,6 +90,7 @@ public class TorrentDownloader extends Downloader } // documentation inherited + @Override protected void doDownload(Resource rsrc) throws IOException { diff --git a/src/java/com/threerings/getdown/tools/Differ.java b/src/java/com/threerings/getdown/tools/Differ.java index db54943..dbd13ee 100644 --- a/src/java/com/threerings/getdown/tools/Differ.java +++ b/src/java/com/threerings/getdown/tools/Differ.java @@ -6,13 +6,13 @@ // // Redistribution and use in source and binary forms, with or without modification, are permitted // provided that the following conditions are met: -// +// // 1. Redistributions of source code must retain the above copyright notice, this list of // conditions and the following disclaimer. // 2. Redistributions in binary form must reproduce the above copyright notice, this list of // conditions and the following disclaimer in the documentation and/or other materials provided // with the distribution. -// +// // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, @@ -131,7 +131,7 @@ public class Differ // by leaving it out, it will be left as is during the // patching process continue; - } + } // otherwise potentially create a jar diff if (rsrc.getPath().endsWith(".jar")) { @@ -192,8 +192,8 @@ public class Differ JarOutputStream jout = new JarOutputStream( new BufferedOutputStream(new FileOutputStream(temp))); byte[] buffer = new byte[4096]; - for (Enumeration iter = jar.entries(); iter.hasMoreElements(); ) { - JarEntry entry = (JarEntry)iter.nextElement(); + for (Enumeration iter = jar.entries(); iter.hasMoreElements(); ) { + JarEntry entry = iter.nextElement(); entry.setCompressedSize(-1); jout.putNextEntry(entry); InputStream in = jar.getInputStream(entry); diff --git a/src/java/com/threerings/getdown/tools/DigesterTask.java b/src/java/com/threerings/getdown/tools/DigesterTask.java index 672ddc4..00b69b1 100644 --- a/src/java/com/threerings/getdown/tools/DigesterTask.java +++ b/src/java/com/threerings/getdown/tools/DigesterTask.java @@ -83,6 +83,7 @@ public class DigesterTask extends Task /** * Performs the actual work of the task. */ + @Override public void execute () throws BuildException { // make sure appdir is set diff --git a/src/java/com/threerings/getdown/tools/JarDiffPatcher.java b/src/java/com/threerings/getdown/tools/JarDiffPatcher.java index 74b08a8..c99b9d2 100644 --- a/src/java/com/threerings/getdown/tools/JarDiffPatcher.java +++ b/src/java/com/threerings/getdown/tools/JarDiffPatcher.java @@ -6,13 +6,13 @@ // // Redistribution and use in source and binary forms, with or without modification, are permitted // provided that the following conditions are met: -// +// // 1. Redistributions of source code must retain the above copyright notice, this list of // conditions and the following disclaimer. // 2. Redistributions in binary form must reproduce the above copyright notice, this list of // conditions and the following disclaimer in the documentation and/or other materials provided // with the distribution. -// +// // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, @@ -88,7 +88,7 @@ public class JarDiffPatcher determineNameMapping(jarDiff, ignoreSet, renameMap); // get all keys in renameMap - Object[] keys = renameMap.keySet().toArray(); + String[] keys = renameMap.keySet().toArray(new String[renameMap.size()]); // Files to implicit move Set oldjarNames = new HashSet(); @@ -139,9 +139,8 @@ public class JarDiffPatcher } // go through the renameMap and apply move for each entry - for (int j = 0; j < keys.length; j++) { + for (String newName : keys) { // Apply move command - String newName = (String)keys[j]; String oldName = renameMap.get(newName); // Get source JarEntry @@ -177,10 +176,10 @@ public class JarDiffPatcher } // implicit move - Iterator iEntries = oldjarNames.iterator(); + Iterator iEntries = oldjarNames.iterator(); if (iEntries != null) { while (iEntries.hasNext()) { - String name = (String)iEntries.next(); + String name = iEntries.next(); JarEntry entry = oldJar.getJarEntry(name); updateObserver(observer, currentEntry, size); currentEntry++; diff --git a/src/java/com/threerings/getdown/tools/Patcher.java b/src/java/com/threerings/getdown/tools/Patcher.java index d301f43..ccc7fb8 100644 --- a/src/java/com/threerings/getdown/tools/Patcher.java +++ b/src/java/com/threerings/getdown/tools/Patcher.java @@ -6,13 +6,13 @@ // // Redistribution and use in source and binary forms, with or without modification, are permitted // provided that the following conditions are met: -// +// // 1. Redistributions of source code must retain the above copyright notice, this list of // conditions and the following disclaimer. // 2. Redistributions in binary form must reproduce the above copyright notice, this list of // conditions and the following disclaimer in the documentation and/or other materials provided // with the distribution. -// +// // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, @@ -29,6 +29,7 @@ import java.io.IOException; import java.io.InputStream; import java.util.Enumeration; +import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.zip.ZipEntry; @@ -74,9 +75,9 @@ public class Patcher _plength = patch.length(); JarFile file = new JarFile(patch); - Enumeration entries = file.entries(); // old skool! + Enumeration entries = file.entries(); // old skool! while (entries.hasMoreElements()) { - ZipEntry entry = (ZipEntry)entries.nextElement(); + JarEntry entry = entries.nextElement(); String path = entry.getName(); long elength = entry.getCompressedSize(); diff --git a/src/java/com/threerings/getdown/util/ConfigUtil.java b/src/java/com/threerings/getdown/util/ConfigUtil.java index 9c2e1c3..3b134b3 100644 --- a/src/java/com/threerings/getdown/util/ConfigUtil.java +++ b/src/java/com/threerings/getdown/util/ConfigUtil.java @@ -6,13 +6,13 @@ // // Redistribution and use in source and binary forms, with or without modification, are permitted // provided that the following conditions are met: -// +// // 1. Redistributions of source code must retain the above copyright notice, this list of // conditions and the following disclaimer. // 2. Redistributions in binary form must reproduce the above copyright notice, this list of // conditions and the following disclaimer in the documentation and/or other materials provided // with the distribution. -// +// // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, @@ -31,7 +31,6 @@ import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashMap; -import java.util.Iterator; import java.util.List; import com.samskivert.io.StreamUtil; @@ -136,14 +135,12 @@ public class ConfigUtil public static HashMap parseConfig (File config, boolean checkPlatform) throws IOException { - 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(); + for (String[] pair : parsePairs(config, checkPlatform)) { Object value = data.get(pair[0]); if (value == null) { data.put(pair[0], pair[1]); @@ -165,7 +162,7 @@ public class ConfigUtil * Massages a single string into an array and leaves existing array values as is. Simplifies * access to parameters that are expected to be arrays. */ - public static String[] getMultiValue (HashMap data, String name) + public static String[] getMultiValue (HashMap data, String name) { Object value = data.get(name); if (value instanceof String) { diff --git a/src/java/com/threerings/getdown/util/LaunchUtil.java b/src/java/com/threerings/getdown/util/LaunchUtil.java index 455c205..13a2ad2 100644 --- a/src/java/com/threerings/getdown/util/LaunchUtil.java +++ b/src/java/com/threerings/getdown/util/LaunchUtil.java @@ -28,8 +28,6 @@ import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintStream; -import java.util.logging.Level; - import com.samskivert.io.StreamUtil; import com.samskivert.util.RunAnywhere; import com.samskivert.util.StringUtil;