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:
parent
c2fb1f036f
commit
b422f4d663
|
@ -80,23 +80,23 @@ try
|
||||||
{ // do the search
|
{ // do the search
|
||||||
if (topic!=null)
|
if (topic!=null)
|
||||||
{ // search the topic
|
{ // search the topic
|
||||||
view.results = topic.searchPosts(term,offset,view.maxResults);
|
view.results = topic.searchPosts(view.term,view.offset,view.maxResults);
|
||||||
if (view.findCount<0)
|
if (view.findCount<0)
|
||||||
view.findCount = topic.getSearchPostCount(term);
|
view.findCount = topic.getSearchPostCount(view.term);
|
||||||
|
|
||||||
} // end if
|
} // end if
|
||||||
else if (conf!=null)
|
else if (conf!=null)
|
||||||
{ // search the conference
|
{ // search the conference
|
||||||
view.results = conf.searchPosts(term,offset,view.maxResults);
|
view.results = conf.searchPosts(view.term,view.offset,view.maxResults);
|
||||||
if (view.findCount<0)
|
if (view.findCount<0)
|
||||||
view.findCount = conf.getSearchPostCount(term);
|
view.findCount = conf.getSearchPostCount(view.term);
|
||||||
|
|
||||||
} // end else if
|
} // end else if
|
||||||
else
|
else
|
||||||
{ // search the community
|
{ // search the community
|
||||||
view.results = comm.searchPosts(term,offset,view.maxResults);
|
view.results = comm.searchPosts(view.term,view.offset,view.maxResults);
|
||||||
if (view.findCount<0)
|
if (view.findCount<0)
|
||||||
view.findCount = comm.getSearchPostCount(term);
|
view.findCount = comm.getSearchPostCount(view.term);
|
||||||
|
|
||||||
} // end else
|
} // end else
|
||||||
|
|
||||||
|
|
|
@ -222,6 +222,21 @@ public class ScriptManager
|
||||||
|
|
||||||
} // end fixupRhino
|
} // 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)
|
private void translateScriptException(String source, String lang, BSFException e)
|
||||||
throws ScriptingException, ThrowableContent
|
throws ScriptingException, ThrowableContent
|
||||||
{
|
{
|
||||||
|
@ -338,6 +353,10 @@ public class ScriptManager
|
||||||
|
|
||||||
} // end finally
|
} // 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
|
} // end exec
|
||||||
|
|
||||||
public void register(String name, Object obj)
|
public void register(String name, Object obj)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user