rem: if (view.getViewURI()) { 
add: if (view != null && view.getViewURI()) { 
context: 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();        usecase.lockInvolvedObjects();        // create proxy object to save usecase state        proxy = new Packages.org.apache.lenya.cms.usecase.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 (view.getViewURI()) {        // 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.        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.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);}
meta: 791	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/791/5950da15528f14729d0b785fe484f5d74d7b7804/usecases.js/buggy/src/webapp/lenya/usecases/usecases.js