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