if (shouldCacheResult && actionName != null && actionClass != null) {
if (shouldCacheResult) {
    public WOResponse handleRequest(WORequest request) {        WOResponse response = null;                String actionName = null;        Class actionClass = null;        boolean shouldCacheResult = false;                if (ERXWOResponseCache.sharedInstance().isEnabled()) {            try {                // Caching scheme for 5.2 applications. Will uncomment once we are building 5.2 only ERExtensions                //Object[] actionClassAndName = getRequestActionClassAndNameForPath(getRequestHandlerPathForRequest(request));                Object[] actionClassAndName = null;                if (actionClassAndName != null && actionClassAndName.length == 3) {                    actionName = (String)actionClassAndName[1];                    actionClass = (Class)actionClassAndName[2];                    if (actionClass.isAssignableFrom(ERXWOResponseCache.Cacheable.class)) {                        response = ERXWOResponseCache.sharedInstance().cachedResponseForRequest(actionClass,                                                                                                actionName,                                                                                                request);                    }                }            } catch (Exception e) {                log.info("Caught exception checking for cache. Leaving it up to the regular exception handler to cache. Request: " + request + " exception: " + e);                // Resetting everything to make sure nothing is cached                actionName = null;                actionClass = null;                shouldCacheResult = true;            }         }        if (response == null)            response = super.handleRequest(request);        if (shouldCacheResult && actionName != null && actionClass != null) {            try {                ERXWOResponseCache.sharedInstance().cacheResponseForRequest(actionClass, actionName, request, response);            } catch (Exception e) {                log.error("Caught exception when caching response. Request: " + request + " exception: " + e);            }        }        if (automaticMessageEncodingEnabled()) {            ERXMessageEncoding messageEncoding = null;                        // This should retrieve the session object belonging to the same            // worker thread that's been calling the current handleRequest method.            WOSession session;            if(false) {                // ak only enable when fixed                // as we will create deadlocks checking out the session this early.                WOContext context = (WOContext)ERXThreadStorage.valueForKey("wocontext");                session = context != null ? context.session() : null;            } else {                session = ERXExtensions.session();   // get it from the thread specific storage            }            if (session != null  &&  session instanceof ERXSession) {                ERXSession erxSession = (ERXSession)session;                messageEncoding = erxSession.messageEncoding();                erxSession.lastActionWasDA = true;            } else if (request instanceof ERXRequest) {                ERXBrowser browser = ((ERXRequest)request).browser();                messageEncoding = browser.messageEncodingForRequest(request);            } else {                messageEncoding = new ERXMessageEncoding(request.browserLanguages());            }            messageEncoding.setEncodingToResponse(response);        }         return response;    }