Revision: 13840
http://gate.svn.sourceforge.net/gate/?rev=13840&view=rev
Author: markagreenwood
Date: 2011-05-20 17:01:38 +0000 (Fri, 20 May 2011)
Log Message:
-----------
added a check to see if the Groovy script has been specified, if not then we
now throw a ResourceInstantiationException instead of a cryptic NPE
Modified Paths:
--------------
gate/trunk/plugins/Groovy/src/gate/groovy/ScriptPR.java
Modified: gate/trunk/plugins/Groovy/src/gate/groovy/ScriptPR.java
===================================================================
--- gate/trunk/plugins/Groovy/src/gate/groovy/ScriptPR.java 2011-05-20
09:45:04 UTC (rev 13839)
+++ gate/trunk/plugins/Groovy/src/gate/groovy/ScriptPR.java 2011-05-20
17:01:38 UTC (rev 13840)
@@ -13,20 +13,33 @@
package gate.groovy;
+import gate.AnnotationSet;
+import gate.Controller;
+import gate.Corpus;
+import gate.CorpusController;
+import gate.FeatureMap;
+import gate.Gate;
import gate.ProcessingResource;
import gate.Resource;
-import gate.creole.*;
-import gate.creole.metadata.*;
-import gate.util.*;
-import gate.*;
-import java.util.*;
-import java.io.IOException;
-import java.io.Reader;
-import java.net.URL;
+import gate.creole.AbstractLanguageAnalyser;
+import gate.creole.ControllerAwarePR;
+import gate.creole.ExecutionException;
+import gate.creole.ResourceInstantiationException;
+import gate.creole.metadata.CreoleParameter;
+import gate.creole.metadata.CreoleResource;
+import gate.creole.metadata.Optional;
+import gate.creole.metadata.RunTime;
+import gate.util.BomStrippingInputStreamReader;
import groovy.lang.Binding;
import groovy.lang.GroovyShell;
import groovy.lang.MetaMethod;
import groovy.lang.Script;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.net.URL;
+import java.util.List;
+
import org.codehaus.groovy.control.CompilationFailedException;
import org.codehaus.groovy.runtime.InvokerInvocationException;
@@ -77,6 +90,9 @@
/** Initialise this resource, and return it. */
public Resource init() throws ResourceInstantiationException {
+ if (scriptURL == null)
+ throw new ResourceInstantiationException("You must specify a Groovy
script to load");
+
// Create the shell, with the GateClassLoader as its parent (so the script
// will have access to plugin classes)
GroovyShell groovyShell = new GroovyShell(Gate.getClassLoader());
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its
next-generation tools to help Windows* and Linux* C/C++ and Fortran
developers boost performance applications - including clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs