ok2c commented on a change in pull request #222: HTTPCLIENT-2076: fix NPE in
LaxExpiresHandler and ignore invalid Expires / MaxAge
URL:
https://github.com/apache/httpcomponents-client/pull/222#discussion_r409809666
##########
File path:
httpclient5/src/main/java/org/apache/hc/client5/http/impl/cookie/BasicMaxAgeHandler.java
##########
@@ -53,18 +53,16 @@ public void parse(final SetCookie cookie, final String
value)
throws MalformedCookieException {
Args.notNull(cookie, "Cookie");
if (value == null) {
- throw new MalformedCookieException("Missing value for 'max-age'
attribute");
+ return;
}
final int age;
try {
age = Integer.parseInt(value);
} catch (final NumberFormatException e) {
- throw new MalformedCookieException ("Invalid 'max-age' attribute: "
Review comment:
@heejeongkim I am quite sure the statement in the section 4.1.2 refers to
custom attributes, say `custom-stuff`, not malformed standard ones. I think it
would be wrong to silently ignore standard attribute values that are obviously
malformed.
Let's fix the NPE in this PR and decide what should be done about
`LaxExpiresHandler` in a new one. I prefer to not change the behavior of
`BasicExpiresHandler` and `BasicMaxAgeHandler` at all.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]