Update . I tried to clear the created cookie in the browser and try again, and this did not happen. It is clear that I set a cookie with the value "null" at some point.
(Well, this is probably a rhetorical question, so I do this CW)
The documentation for the Google Web Toolkit says Cookies.getCookie:
public static java.lang.String getCookie (name java.lang.String)
Gets the cookie associated with this name.
Parameters:
- name - name of the cookie received
Return:
- cookie or null if cookie does not exist
Well, I just spent a few hours hitting my head against the wall, because at least in a browser with hosted mode (I have not tested a real browser yet), it does not return null, it returns "null" , ie . a literal string, 4 characters long, starting with "n".
Both null and "null" look very similar if you print them out, but only one answers if (cookie == null) Cookies.setCookie(cookie, newValue);
Is there any conceivable reason why Google did it this way, or is someone just fooling me?
source share