Author: sebb
Date: Wed Mar 25 20:24:57 2009
New Revision: 758430

URL: http://svn.apache.org/viewvc?rev=758430&view=rev
Log:
Add some checks to better show why failures occur

Modified:
    jakarta/bsf/trunk/bsf3/bsf-utils/src/main/java/org/apache/bsf/Main.java

Modified: 
jakarta/bsf/trunk/bsf3/bsf-utils/src/main/java/org/apache/bsf/Main.java
URL: 
http://svn.apache.org/viewvc/jakarta/bsf/trunk/bsf3/bsf-utils/src/main/java/org/apache/bsf/Main.java?rev=758430&r1=758429&r2=758430&view=diff
==============================================================================
--- jakarta/bsf/trunk/bsf3/bsf-utils/src/main/java/org/apache/bsf/Main.java 
(original)
+++ jakarta/bsf/trunk/bsf3/bsf-utils/src/main/java/org/apache/bsf/Main.java Wed 
Mar 25 20:24:57 2009
@@ -23,6 +23,7 @@
 import java.io.InputStreamReader;
 import java.io.Reader;
 import java.util.Hashtable;
+import java.util.List;
 
 import javax.script.Bindings;
 import javax.script.ScriptContext;
@@ -79,6 +80,10 @@
         }
 
         ScriptEngineManager mgr = new ScriptEngineManager();
+        final List engineFactories = mgr.getEngineFactories();
+        if (engineFactories.isEmpty()){
+            throw new RuntimeException("Could not find any engine factories");
+        }
 
         Reader in;
 
@@ -91,6 +96,9 @@
 
         try {
             ScriptEngine engine = mgr.getEngineByExtension(language);
+            if (engine == null){
+                throw new IllegalArgumentException("unable to find engine 
using Extension: "+language);
+            }
             Bindings bindings = engine.getBindings(ScriptContext.ENGINE_SCOPE);
             bindings.put("args", args);
             Object obj = engine.eval(in);



---------------------------------------------------------------------
To unsubscribe, e-mail: bsf-dev-unsubscr...@jakarta.apache.org
For additional commands, e-mail: bsf-dev-h...@jakarta.apache.org

Reply via email to