Program: 49844
Project: 49844
Buggy source:
public void doFilter(ServletRequest req,ServletResponse res,final FilterChain chain) throws IOException, ServletException {
  log("String_Node_Str" + req.getClass().getName());
  log(mapSessions.size() + "String_Node_Str" + mapOriginalSessions.size());
  if (!(req instanceof HttpServletRequest)) {
    chain.doFilter(req,res);
  }
 else {
    if (req instanceof RequestWrapper) {
      log("String_Node_Str");
      chain.doFilter(req,res);
      return;
    }
    HttpServletRequest httpReq=(HttpServletRequest)req;
    RequestWrapper existingReq=(RequestWrapper)req.getAttribute(HAZELCAST_REQUEST);
    final ResponseWrapper resWrapper=new ResponseWrapper((HttpServletResponse)res);
    final RequestWrapper reqWrapper=new RequestWrapper(httpReq,resWrapper);
    resWrapper.setRequest(reqWrapper);
    if (existingReq != null) {
      reqWrapper.setHazelcastSession(existingReq.hazelcastSession,existingReq.requestedSessionId);
    }
    req=null;
    res=null;
    httpReq=null;
    chain.doFilter(reqWrapper,resWrapper);
    if (existingReq != null)     return;
    req=null;
    HazelcastHttpSession session=reqWrapper.getSession(false);
    if (session != null && session.isValid()) {
      final Enumeration<String> attNames=session.getAttributeNames();
      Map mapData=null;
      while (attNames.hasMoreElements()) {
        final String attName=attNames.nextElement();
        final Object value=session.getAttribute(attName);
        if (value instanceof Serializable) {
          if (mapData == null) {
            mapData=new HashMap<String,Object>();
          }
          mapData.put(attName,value);
        }
      }
      Data data=session.writeObject(mapData);
      boolean sessionChanged=session.sessionChanged(data);
      if (sessionChanged) {
        if (data == null) {
          mapData=new HashMap<String,Object>();
          data=session.writeObject(mapData);
        }
        log("String_Node_Str" + session.getId());
        getClusterMap().put(session.getId(),data);
      }
    }
  }
}

Fixed version (ground truth):
public void doFilter(ServletRequest req,ServletResponse res,final FilterChain chain) throws IOException, ServletException {
  if (!(req instanceof HttpServletRequest)) {
    chain.doFilter(req,res);
  }
 else {
    if (req instanceof RequestWrapper) {
      log("String_Node_Str");
      chain.doFilter(req,res);
      return;
    }
    HttpServletRequest httpReq=(HttpServletRequest)req;
    RequestWrapper existingReq=(RequestWrapper)req.getAttribute(HAZELCAST_REQUEST);
    final ResponseWrapper resWrapper=new ResponseWrapper((HttpServletResponse)res);
    final RequestWrapper reqWrapper=new RequestWrapper(httpReq,resWrapper);
    resWrapper.setRequest(reqWrapper);
    if (existingReq != null) {
      reqWrapper.setHazelcastSession(existingReq.hazelcastSession,existingReq.requestedSessionId);
    }
    req=null;
    res=null;
    httpReq=null;
    chain.doFilter(reqWrapper,resWrapper);
    if (existingReq != null)     return;
    req=null;
    HazelcastHttpSession session=reqWrapper.getSession(false);
    if (session != null && session.isValid()) {
      session.setAccessed();
      final Enumeration<String> attNames=session.getAttributeNames();
      Map mapData=null;
      while (attNames.hasMoreElements()) {
        final String attName=attNames.nextElement();
        final Object value=session.getAttribute(attName);
        if (mapData == null) {
          mapData=new HashMap<String,Object>();
        }
        mapData.put(attName,value);
      }
      Data data=session.writeObject(mapData);
      boolean sessionChanged=session.sessionChanged(data);
      if (sessionChanged) {
        if (data == null) {
          mapData=new HashMap<String,Object>();
          data=session.writeObject(mapData);
        }
        log("String_Node_Str" + session.getId());
        getClusterMap().put(session.getId(),data);
      }
    }
  }
}