if (hasErrors) { proxy = new Packages.org.apache.lenya.cms.usecase.impl.UsecaseProxy(usecase); cocoon.sendPage("usecases-view/nomenu/modules/usecase/templates/error.jx", { "usecase" : proxy}); } 
function executeUsecase() {    var usecaseName;    var usecase; // the Usecase object    var proxy; // a UsecaseProxy to make the usecase state persistent across continuations    var view; // the UsecaseView object that belongs to our usecase.    var state; // the state of the usecase ("continue"|"success"|"cancel");    var targetUrl; // URL to redirect to after completion.    var generic = new Object; // a generic helper object for custom flow code to preserve state information.    try {        usecaseName = cocoon.parameters["usecaseName"];        usecase = getUsecase(usecaseName);        passRequestParameters(usecase);        usecase.checkPreconditions();        if (!usecase.hasErrors()) {            usecase.lockInvolvedObjects();        }        // create proxy object to save usecase state        proxy = new Packages.org.apache.lenya.cms.usecase.impl.UsecaseProxy(usecase);        view = usecase.getView();        log("debug", "Successfully prepared usecase.", usecaseName);    } catch (exception) {        log("error", "Could not prepare usecase: " + exception, usecaseName);        throw exception;    } finally {        releaseUsecase(usecase);    }    loadCustomFlow(view);    // If the usecase has a view uri, this means we want to display something     // to the user before proceeding. This also means the usecase can consist    // of several steps; repeated until the user chooses to submit or cancel.    if (view != null && view.getViewURI()) {        do {            // show the view:            try {                loopFlow(view, proxy, generic); //usecase must be released here!            } catch (exception) {                // if something went wrong, try and rollback the usecase:                log("error", "Exception during loopFlow(): " + exception, usecaseName);                try {                    usecase = getUsecase(usecaseName);                    proxy.setup(usecase);                    usecase.cancel();                    throw exception;                } finally {                    releaseUsecase(usecase);                }            }            log("debug", "Advancing in usecase.", usecaseName);            // restore the usecase state and handle the user input:            usecase = getUsecase(usecaseName);            proxy.setup(usecase);            passRequestParameters(usecase);            state = submitFlow(usecase, generic);            // create a new proxy with the updated usecase state            proxy = new Packages.org.apache.lenya.cms.usecase.impl.UsecaseProxy(usecase);            releaseUsecase(usecase);        } while (state == "continue");    // If the usecase does not have a view uri, we can directly jump to     // executeFlow().    } else {        usecase = getUsecase(usecaseName);        proxy.setup(usecase);        passRequestParameters(usecase);        state = executeFlow(usecase);        releaseUsecase(usecase);    }    //getTargetURL takes a boolean that is true on success:    targetUrl = usecase.getTargetURL(state == "success");    log("debug", "Completed, redirecting to url = [context:/" + targetUrl + "]", usecaseName);    // jump to the appropriate URL:    redirect(targetUrl);}
791	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/791/91f711e73ac4e8c477c58f5be027d6ca7a3a4b6c/usecases.js/buggy/src/modules-core/usecase/usecases.js