result.setMaxAge((int)((expires.getTime() - current.getTime()) / 1000));
expires = DateUtils.parse(pair.getValue(), DateUtils.FORMAT_RFC_1123); }  if(expires == null) { expires = DateUtils.parse(pair.getValue(), DateUtils.FORMAT_ASC_TIME); }  if(expires != null) { if(DateUtils.after(current, expires)) { result.setMaxAge((int)((expires.getTime() - current.getTime()) / 1000)); } else { result.setMaxAge(0); }
   public CookieSetting readCookieSetting() throws IOException   {      CookieSetting result = null;      Parameter pair = readPair();      while((pair != null) && (pair.getName().charAt(0) == '$'))      {         // Unexpected special attribute         // Silently ignore it as it may have been introduced by new         // specifications         pair = readPair();      }      if(pair != null)      {         // Set the cookie name and value         result = new CookieSettingImpl(pair.getName(), pair.getValue());         pair = readPair();      }      while(pair != null)      {         if(pair.getName().equalsIgnoreCase(NAME_SET_PATH))         {            result.setPath(pair.getValue());         }         else if(pair.getName().equalsIgnoreCase(NAME_SET_DOMAIN))         {            result.setDomain(pair.getValue());         }         else if(pair.getName().equalsIgnoreCase(NAME_SET_COMMENT))         {            result.setComment(pair.getValue());         }         else if(pair.getName().equalsIgnoreCase(NAME_SET_COMMENT_URL))         {            // No yet supported         }         else if(pair.getName().equalsIgnoreCase(NAME_SET_DISCARD))         {            result.setMaxAge(-1);         }         else if(pair.getName().equalsIgnoreCase(NAME_SET_EXPIRES))         {            Date expires = DateUtils.parse(pair.getValue(), DateUtils.FORMAT_RFC_1036);            Date current = new Date(System.currentTimeMillis());                        if(DateUtils.after(current, expires))            {               result.setMaxAge((int)((expires.getTime() - current.getTime()) / 1000));            }            else            {               result.setMaxAge(0);            }         }         else if(pair.getName().equalsIgnoreCase(NAME_SET_MAX_AGE))         {            result.setMaxAge(Integer.valueOf(pair.getValue()));         }         else if(pair.getName().equalsIgnoreCase(NAME_SET_PORT))         {            // No yet supported         }         else if(pair.getName().equalsIgnoreCase(NAME_SET_SECURE))         {            if((pair.getValue() == null) || (pair.getValue().length() == 0))            {               result.setSecure(true);            }         }         else if(pair.getName().equalsIgnoreCase(NAME_SET_VERSION))         {            result.setVersion(Integer.valueOf(pair.getValue()));         }         else         {            // Unexpected special attribute            // Silently ignore it as it may have been introduced by new            // specifications         }         pair = readPair();      }      if(pair != null)      {         // We started to read the next cookie         // So let's put it back into the stream         this.cachedPair = pair;      }      return result;   }