From: jprocter Date: Mon, 30 Jun 2008 09:49:44 +0000 (+0000) Subject: safer retrieval of groovy scripts from URLs X-Git-Tag: Release_2_4~91 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=30bc1314d4206cafea412dcd9decdea7e318481f;hp=067a6494124d4f1d0fe8b6d758b593145393b7dd;p=jalview.git safer retrieval of groovy scripts from URLs --- diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index faf98db..4f383a0 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -25,6 +25,7 @@ import java.io.IOException; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.lang.reflect.Constructor; +import java.net.URL; import java.util.*; import javax.swing.*; @@ -466,10 +467,10 @@ public class Jalview java.lang.reflect.Method setvar = gbindingc.getMethod("setVariable", new Class[] { String.class, Object.class} ); setvar.invoke(gbinding, new Object[] { "Jalview", jalviewContext}); Class gsec = cl.loadClass("groovy.util.GroovyScriptEngine"); - Constructor gseccons = gsec.getConstructor(new Class[] { String[].class }); - Object gse = gseccons.newInstance(new Object[] { new String[] { sfile.toURL().toString() } }); + Constructor gseccons = gsec.getConstructor(new Class[] { URL[].class } ); // String[].class }); + Object gse = gseccons.newInstance(new Object[] { new URL[] { sfile.toURL() } }); // .toString() } }); java.lang.reflect.Method run = gsec.getMethod("run", new Class[]{ String.class, gbindingc }); - run.invoke(gse, new Object[] { sfile.toURL().toString(), gbinding }); + run.invoke(gse, new Object[] { sfile.getName(), gbinding }); success = true; } catch (Exception e) {