diff options
author | Christopher Vogt <oss.nsp@cvogt.org> | 2016-03-06 19:12:26 -0500 |
---|---|---|
committer | Christopher Vogt <oss.nsp@cvogt.org> | 2016-03-06 19:12:26 -0500 |
commit | d5b43bc0eaedfba1c5be6bff1673b426af030c81 (patch) | |
tree | a97aef8fb2bac74d9814017f4f6fddbbc8485771 /nailgun_launcher/NailgunLauncher.java | |
parent | a9e9e03446bf9068e97686d73b87944da374c118 (diff) | |
download | cbt-d5b43bc0eaedfba1c5be6bff1673b426af030c81.tar.gz cbt-d5b43bc0eaedfba1c5be6bff1673b426af030c81.tar.bz2 cbt-d5b43bc0eaedfba1c5be6bff1673b426af030c81.zip |
fix ArrayIndexOutOfBoundsException cause by an off by two
Diffstat (limited to 'nailgun_launcher/NailgunLauncher.java')
-rw-r--r-- | nailgun_launcher/NailgunLauncher.java | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/nailgun_launcher/NailgunLauncher.java b/nailgun_launcher/NailgunLauncher.java index 8b3b746..3765457 100644 --- a/nailgun_launcher/NailgunLauncher.java +++ b/nailgun_launcher/NailgunLauncher.java @@ -8,7 +8,7 @@ import java.util.*; import java.util.concurrent.ConcurrentHashMap; /** - * This launcher allows to use Nailgun without loading anything else permanenetly into its + * This launcher allows to start the JVM without loading anything else permanently into its * classpath except for the launcher itself. That's why it is written in Java without * dependencies outside the JDK. * @@ -36,10 +36,14 @@ public class NailgunLauncher{ String[] cp = args[1].split(File.pathSeparator); URL[] urls = new URL[cp.length]; - for(int i = 0; i < cp.length; i++){ urls[i] = new URL("file:"+cp[i]); } + for(int i = 0; i < cp.length; i++){ + urls[i] = new URL("file:"+cp[i]); + } - String[] newArgs = new String[cp.length - 2]; - for(int i = 2; i < cp.length; i++){ newArgs[i] = args[i]; } + String[] newArgs = new String[args.length-2]; + for(int i = 0; i < args.length-2; i++){ + newArgs[i] = args[i+2]; + } new URLClassLoader( urls ) .loadClass(args[0]) |