fixed bugs in the Find script and also rigged ScriptManager to better handle
the JavaScript native errors that crop up occasionally
This commit is contained in:
@@ -222,6 +222,21 @@ public class ScriptManager
|
||||
|
||||
} // end fixupRhino
|
||||
|
||||
private static void translateReturnedObject(ScriptReturn sro) throws ScriptingException
|
||||
{
|
||||
Object obj = sro.get();
|
||||
if (obj==null)
|
||||
return; // nothing to do
|
||||
|
||||
Class klass = obj.getClass();
|
||||
final String klassname = klass.getName();
|
||||
|
||||
// Special processing for JavaScript NativeError objects
|
||||
if (klassname.equals("org.mozilla.javascript.NativeError"))
|
||||
throw new ScriptingException("JavaScript runtime error: " + obj.toString());
|
||||
|
||||
} // end translateReturnedObject
|
||||
|
||||
private void translateScriptException(String source, String lang, BSFException e)
|
||||
throws ScriptingException, ThrowableContent
|
||||
{
|
||||
@@ -338,6 +353,10 @@ public class ScriptManager
|
||||
|
||||
} // end finally
|
||||
|
||||
// if we've gotten this far, see if the returned object is actually an error that needs
|
||||
// translation before it can be presented to the world
|
||||
translateReturnedObject(sro);
|
||||
|
||||
} // end exec
|
||||
|
||||
public void register(String name, Object obj)
|
||||
|
||||
Reference in New Issue
Block a user