From 5644e62dc547280644dc5264e19e61dd4b3bb10c Mon Sep 17 00:00:00 2001 From: Elizabeth Fong Date: Thu, 19 Oct 2006 20:39:02 +0000 Subject: [PATCH] Don't NPE if properties param isn't set; allow overriding torrent behavior for testing --- .../com/threerings/getdown/data/Application.java | 3 ++- .../getdown/launcher/GetdownApplet.java | 15 +++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/java/com/threerings/getdown/data/Application.java b/src/java/com/threerings/getdown/data/Application.java index ac4dbc7..39812fb 100644 --- a/src/java/com/threerings/getdown/data/Application.java +++ b/src/java/com/threerings/getdown/data/Application.java @@ -439,7 +439,8 @@ public class Application } // determine whether or not we should be using bit torrent - _useTorrent = (cdata.get("torrent") != null); + _useTorrent = (cdata.get("torrent") != null) || + (System.getProperty("torrent") != null); // look for a debug.txt file which causes us to run in java.exe on // Windows so that we can obtain a thread dump of the running JVM diff --git a/src/java/com/threerings/getdown/launcher/GetdownApplet.java b/src/java/com/threerings/getdown/launcher/GetdownApplet.java index 3a2beaa..54dae9c 100644 --- a/src/java/com/threerings/getdown/launcher/GetdownApplet.java +++ b/src/java/com/threerings/getdown/launcher/GetdownApplet.java @@ -99,12 +99,15 @@ public class GetdownApplet extends JApplet } // Pass through properties parameter. - String[] properties = getParameter("properties").split(" "); - for (String property : properties) { - String key = property.substring(property.indexOf("-D") + 2, - property.indexOf("=")); - String value = property.substring(property.indexOf("=") + 1); - System.setProperty(key, value); + String properties = getParameter("properties"); + if (properties != null) { + String[] proparray = properties.split(" "); + for (String property : proparray) { + String key = property.substring(property.indexOf("-D") + 2, + property.indexOf("=")); + String value = property.substring(property.indexOf("=") + 1); + System.setProperty(key, value); + } } // when run from an applet, we install