Code example for MalformedCookieException

0
            throw new MalformedCookieException("Blank value for version attribute");
        } 
        try { 
           cookie.setVersion(Integer.parseInt(value));
        } catch (NumberFormatException e) {
            throw new MalformedCookieException("Invalid version: " 
                + e.getMessage());
        } 
    } 
 
    @Override 
    public void validate(final Cookie cookie, final CookieOrigin origin) 
            throws MalformedCookieException { 
        if (cookie == null) {
            throw new IllegalArgumentException("Cookie may not be null");
        } 
        if (cookie.getVersion() < 0) {
            throw new MalformedCookieException("Cookie version may not be negative");
        } 
    }