}  if (wrapped instanceof RedirectException) {
} else if (wrapped instanceof RedirectException) {
    public Object invoke(Object thisObject, String functionName, Object[] args,                         int argsWrapMode, boolean resolve) throws ScriptingException {        try {            for (int i = 0; i < args.length; i++) {                switch (argsWrapMode) {                    case ARGS_WRAP_DEFAULT:                        // convert java objects to JavaScript                        if (args[i] != null) {                            args[i] = Context.javaToJS(args[i], global);                        }                        break;                    case ARGS_WRAP_XMLRPC:                        // XML-RPC requires special argument conversion                        args[i] = core.processXmlRpcArgument(args[i]);                        break;                }            }            Scriptable obj = thisObject == null ? global : Context.toObject(thisObject, global);            // if function name should be resolved interpret it as member expression,            // otherwise replace dots with underscores.            if (resolve) {                if (functionName.indexOf('.') > 0) {                    StringTokenizer st = new StringTokenizer(functionName, ".");                    for (int i=0; i<st.countTokens()-1; i++) {                        String propName = st.nextToken();                        Object propValue = ScriptableObject.getProperty(obj, propName);                        if (propValue instanceof Scriptable) {                            obj = (Scriptable) propValue;                        } else {                            throw new RuntimeException("Can't resolve function name " +                                    functionName + " in " + thisObject);                        }                    }                    functionName = st.nextToken();                }            } else {                functionName = functionName.replace('.', '_');            }            Object f = ScriptableObject.getProperty(obj, functionName);            if ((f == ScriptableObject.NOT_FOUND) || !(f instanceof Function)) {                return null;            }            Object retval = ((Function) f).call(context, global, obj, args);            if (retval instanceof Wrapper) {                retval = ((Wrapper) retval).unwrap();            }            if ((retval == null) || (retval == Undefined.instance)) {                return null;            } else if (argsWrapMode == ARGS_WRAP_XMLRPC) {                return core.processXmlRpcResponse (retval);            } else {                return retval;            }        } catch (RedirectException redirect) {            throw redirect;        } catch (TimeoutException timeout) {            throw timeout;        } catch (ConcurrencyException concur) {            throw concur;        } catch (Exception x) {            // has the request timed out? If so, throw TimeoutException            if (thread != Thread.currentThread()) {                throw new TimeoutException();            }            // create and throw a ScriptingException with the right message            String msg;            if (x instanceof JavaScriptException) {                // created by javascript throw statement                msg = x.getMessage();            } else if (x instanceof WrappedException) {                // wrapped java excepiton                WrappedException wx = (WrappedException) x;                Throwable wrapped = wx.getWrappedException();                // if this is a wrapped concurrencyException, rethrow it.                if (wrapped instanceof ConcurrencyException) {                    throw (ConcurrencyException) wrapped;                }                // also check if this is a wrapped redirect exception                if (wrapped instanceof RedirectException) {                    throw (RedirectException) wrapped;                }                // we need to build our own message here, default implementation is broken                StringBuffer b = new StringBuffer(wrapped.toString());                b.append(" (").append(wx.getSourceName()).append("#")                        .append(wx.getLineNumber()).append(")");                msg = b.toString();                // replace wrapper with original exception                if (wrapped instanceof Exception) {                    x = (Exception) wrapped;                }            } else if (x instanceof EcmaError) {                msg = x.toString();            } else {                msg = x.getMessage();            }            throw new ScriptingException(msg, x);        }    }