@Override public void parse(final Cookie cookie,final String value) throws MalformedCookieException {
  if (cookie == null) {
    throw new IllegalArgumentException("Cookie may not be null");
  }
  if (cookie instanceof Cookie2) {
    final Cookie2 cookie2=(Cookie2)cookie;
    if (value == null) {
      throw new MalformedCookieException("Missing value for version attribute");
    }
    int version=-1;
    try {
      version=Integer.parseInt(value);
    }
 catch (    final NumberFormatException e) {
      version=-1;
    }
    if (version < 0) {
      throw new MalformedCookieException("Invalid cookie version.");
    }
    cookie2.setVersion(version);
    cookie2.setVersionAttributeSpecified(true);
  }
}

@ Override public void parse ( final Cookie cookie , final String value ) throws MalformedCookieException { if ( cookie == null ) { throw new IllegalArgumentException ( "Cookie may not be null" ) ; } if ( cookie instanceof Cookie2 ) { final Cookie2 cookie2 = ( Cookie2 ) cookie ; if ( value == null ) { throw new MalformedCookieException ( "Missing value for version attribute" ) ; } int version = - 1 ; try { version = Integer . parseInt ( value ) ; } catch ( final NumberFormatException e ) { version = - 1 ; } if ( version < 0 ) { throw new MalformedCookieException ( "Invalid cookie version." ) ; } cookie2 . setVersion ( version ) ; cookie2 . setVersionAttributeSpecified ( true ) ; } }
parse cookie version attribute .
