Uploaded image for project: 'Commons JCS'
  1. Commons JCS
  2. JCS-140

JCacheFilter code logic error

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: jcs-2.0-beta-2
    • Component/s: None
    • Labels:
      None

      Description

      final PageKey key = new PageKey(key(servletRequest), gzip);
      Page page = cache.get(key);
      if (page == null)

      { .... }

      if (page.status == SC_OK) {
      checkResponse(httpServletResponse);

      the last line always throw exception for the first time the specified url is requested,because the response is commited in the previous if.

      I think the logic of doFilter should be like this:

      String key=getKeyFromRequest();
      Page page=cache.get(key);
      if(page==null){
      chain.doFilter();
      cache.put(key,response);
      }else{
      response.write(cache);
      }

        Attachments

          Activity

            People

            • Assignee:
              romain.manni-bucau Romain Manni-Bucau
              Reporter:
              gerryliang liangjiarui
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: