Code example for MalformedCookieException

0
        } 
        int age;
        try { 
            age = Integer.parseInt(value);
        } catch (NumberFormatException e) {
            throw new MalformedCookieException ("Invalid max-age attribute: " 
                    + value);
        } 
        if (age < 0) {
            throw new MalformedCookieException ("Negative max-age attribute: " 
                    + value);
        } 
        cookie.setExpiryDate(new Date(System.currentTimeMillis() + age * 1000L));
    } 
     
}