From 30bc1314d4206cafea412dcd9decdea7e318481f Mon Sep 17 00:00:00 2001 From: jprocter Date: Mon, 30 Jun 2008 09:49:44 +0000 Subject: [PATCH] safer retrieval of groovy scripts from URLs --- src/jalview/bin/Jalview.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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) { -- 1.7.10.2