We don't use guava in getdown because we're size sensitive.
Let's go further and prefer some standard java library classes, nixing reference to samskivert ones with limited utility.
This commit is contained in:
@@ -51,10 +51,12 @@ import java.security.Signature;
|
|||||||
import java.security.cert.Certificate;
|
import java.security.cert.Certificate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
@@ -64,7 +66,6 @@ import org.apache.commons.codec.binary.Base64;
|
|||||||
|
|
||||||
import com.samskivert.io.StreamUtil;
|
import com.samskivert.io.StreamUtil;
|
||||||
import com.samskivert.text.MessageUtil;
|
import com.samskivert.text.MessageUtil;
|
||||||
import com.samskivert.util.ArrayIntSet;
|
|
||||||
import com.samskivert.util.RandomUtil;
|
import com.samskivert.util.RandomUtil;
|
||||||
import com.samskivert.util.RunAnywhere;
|
import com.samskivert.util.RunAnywhere;
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
@@ -509,9 +510,13 @@ public class Application
|
|||||||
// check for tracking progress percent configuration
|
// check for tracking progress percent configuration
|
||||||
String trackPcts = (String)cdata.get("tracking_percents");
|
String trackPcts = (String)cdata.get("tracking_percents");
|
||||||
if (!StringUtil.isBlank(trackPcts)) {
|
if (!StringUtil.isBlank(trackPcts)) {
|
||||||
_trackingPcts = new ArrayIntSet(StringUtil.parseIntArray(trackPcts));
|
_trackingPcts = new HashSet<Integer>();
|
||||||
|
for (int pct : StringUtil.parseIntArray(trackPcts)) {
|
||||||
|
_trackingPcts.add(pct);
|
||||||
|
}
|
||||||
} else if (!StringUtil.isBlank(_trackingURL)) {
|
} else if (!StringUtil.isBlank(_trackingURL)) {
|
||||||
_trackingPcts = new ArrayIntSet(new int[] { 50 });
|
_trackingPcts = new HashSet<Integer>();
|
||||||
|
_trackingPcts.add(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for tracking cookie configuration
|
// Check for tracking cookie configuration
|
||||||
@@ -1450,7 +1455,7 @@ public class Application
|
|||||||
protected boolean _allowOffline;
|
protected boolean _allowOffline;
|
||||||
|
|
||||||
protected String _trackingURL;
|
protected String _trackingURL;
|
||||||
protected ArrayIntSet _trackingPcts;
|
protected Set<Integer> _trackingPcts;
|
||||||
protected String _trackingCookieName;
|
protected String _trackingCookieName;
|
||||||
protected String _trackingCookieProperty;
|
protected String _trackingCookieProperty;
|
||||||
protected String _trackingURLSuffix;
|
protected String _trackingURLSuffix;
|
||||||
|
|||||||
@@ -32,13 +32,13 @@ import java.net.URL;
|
|||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
import java.util.jar.JarEntry;
|
import java.util.jar.JarEntry;
|
||||||
import java.util.jar.JarFile;
|
import java.util.jar.JarFile;
|
||||||
|
|
||||||
import com.samskivert.io.StreamUtil;
|
import com.samskivert.io.StreamUtil;
|
||||||
import com.samskivert.util.CollectionUtil;
|
|
||||||
import com.samskivert.util.FileUtil;
|
import com.samskivert.util.FileUtil;
|
||||||
import com.samskivert.util.SortableArrayList;
|
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
|
|
||||||
import com.threerings.getdown.util.ProgressObserver;
|
import com.threerings.getdown.util.ProgressObserver;
|
||||||
@@ -224,10 +224,8 @@ public class Resource
|
|||||||
if (target.getPath().endsWith(".jar")) {
|
if (target.getPath().endsWith(".jar")) {
|
||||||
JarFile jar = new JarFile(target);
|
JarFile jar = new JarFile(target);
|
||||||
try {
|
try {
|
||||||
SortableArrayList<JarEntry> entries =
|
List<JarEntry> entries = Collections.list(jar.entries());
|
||||||
new SortableArrayList<JarEntry>();
|
Collections.sort(entries, ENTRY_COMP);
|
||||||
CollectionUtil.addAll(entries, jar.entries());
|
|
||||||
entries.sort(ENTRY_COMP);
|
|
||||||
|
|
||||||
int eidx = 0;
|
int eidx = 0;
|
||||||
for (JarEntry entry : entries) {
|
for (JarEntry entry : entries) {
|
||||||
|
|||||||
@@ -35,8 +35,10 @@ import java.io.IOException;
|
|||||||
import java.io.BufferedOutputStream;
|
import java.io.BufferedOutputStream;
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.samskivert.swing.util.SwingUtil;
|
import com.samskivert.swing.util.SwingUtil;
|
||||||
import com.samskivert.util.ArrayUtil;
|
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
|
|
||||||
import static com.threerings.getdown.Log.log;
|
import static com.threerings.getdown.Log.log;
|
||||||
@@ -46,32 +48,28 @@ import static com.threerings.getdown.Log.log;
|
|||||||
*/
|
*/
|
||||||
public class GetdownApp
|
public class GetdownApp
|
||||||
{
|
{
|
||||||
public static void main (String[] args)
|
public static void main (String[] argArray)
|
||||||
{
|
{
|
||||||
// maybe they specified the appdir in a system property
|
// maybe they specified the appdir in a system property
|
||||||
int aidx = 0;
|
int aidx = 0;
|
||||||
|
List<String> args = Arrays.asList(argArray);
|
||||||
String adarg = System.getProperty("appdir");
|
String adarg = System.getProperty("appdir");
|
||||||
// if not, check for a command line argument
|
// if not, check for a command line argument
|
||||||
if (StringUtil.isBlank(adarg)) {
|
if (StringUtil.isBlank(adarg)) {
|
||||||
if (args.length < 1) {
|
if (args.isEmpty()) {
|
||||||
System.err.println(
|
System.err.println(
|
||||||
"Usage: java -jar getdown.jar app_dir [app_id] [app args]");
|
"Usage: java -jar getdown.jar app_dir [app_id] [app args]");
|
||||||
System.exit(-1);
|
System.exit(-1);
|
||||||
}
|
}
|
||||||
adarg = args[aidx++];
|
adarg = args.get(aidx++);
|
||||||
}
|
}
|
||||||
|
|
||||||
// look for a specific app identifier
|
// look for a specific app identifier
|
||||||
String appId = null;
|
String appId = (aidx < args.size()) ? args.get(aidx++) : null;
|
||||||
if (args.length > aidx) {
|
|
||||||
appId = args[aidx++];
|
|
||||||
}
|
|
||||||
|
|
||||||
// pass along anything after that as jvm args
|
// pass along anything after that as jvm args
|
||||||
String[] appargs = null;
|
String[] appargs = (aidx < args.size())
|
||||||
if (args.length > aidx) {
|
? args.subList(aidx, args.size()).toArray(new String[0]) : null;
|
||||||
appargs = ArrayUtil.splice(args, 0, aidx);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ensure a valid directory was supplied
|
// ensure a valid directory was supplied
|
||||||
File appDir = new File(adarg);
|
File appDir = new File(adarg);
|
||||||
|
|||||||
Reference in New Issue
Block a user