This repository has been archived by the owner on Feb 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
JSON get does not handle missing cookie #16
Comments
@literakl What do you expect if the cookie is missing? You can also wrap this with |
Please read the attached code. There is a bug because there is no null check. It should be: String value = this.get(name); |
@literakl Sorry, I missed that. It helps when you format your code 😉 As I‘m currently fixing some stuff here, I‘ll try to fix this as well. |
tholu
pushed a commit
to tholu/java-cookie
that referenced
this issue
Feb 28, 2019
FagnerMartinsBrack
pushed a commit
that referenced
this issue
Mar 1, 2019
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
public synchronized String get(String name) returns null when cookie is not present. The JSON variant does not checks returned value and passes null to object mapper where NPE is thrown.
public T get(String name, Class dataType) throws CookieParseException {
String value = this.get(name);
try {
return this.mapper.readValue(value, dataType);
} catch (IOException var5) {
throw new CookieParseException(var5);
}
}
The text was updated successfully, but these errors were encountered: