Don't NPE if properties param isn't set; allow overriding torrent behavior for testing

This commit is contained in:
Elizabeth Fong
2006-10-19 20:39:02 +00:00
parent cd02c01f30
commit 5644e62dc5
2 changed files with 11 additions and 7 deletions
@@ -439,7 +439,8 @@ public class Application
} }
// determine whether or not we should be using bit torrent // 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 // 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 // Windows so that we can obtain a thread dump of the running JVM
@@ -99,12 +99,15 @@ public class GetdownApplet extends JApplet
} }
// Pass through properties parameter. // Pass through properties parameter.
String[] properties = getParameter("properties").split(" "); String properties = getParameter("properties");
for (String property : properties) { if (properties != null) {
String key = property.substring(property.indexOf("-D") + 2, String[] proparray = properties.split(" ");
property.indexOf("=")); for (String property : proparray) {
String value = property.substring(property.indexOf("=") + 1); String key = property.substring(property.indexOf("-D") + 2,
System.setProperty(key, value); property.indexOf("="));
String value = property.substring(property.indexOf("=") + 1);
System.setProperty(key, value);
}
} }
// when run from an applet, we install // when run from an applet, we install