if (cookie == null) {
throw new IllegalArgumentException("Cookie may not be null");
}
if (value == null) {
throw new MalformedCookieException("Missing value for version attribute");
}
if (value.trim().length() == 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());
}