You're using integer arithmetic for a sum that overflows beyond the maximum positive value for an integer. So 1000*60*60*24*30 is negative.
You could try 1000L*60*60*24*30
Paul
On 31 Jul 2014 01:53, "Tom" <HenryHa5@gmail.com> wrote:
-- --This is very weird. Ok, the below code works fine
public void setCookie(String cookiesName, String cookiesValue){ final int COOKIE_TIMEOUT = 1000 * 60 * 60 * 24;//1 days Date expires = new Date((new Date()).getTime() + COOKIE_TIMEOUT); Cookies.setCookie(cookiesName, cookiesValue, expires); } //then setCookie("currentLang","de"); Collection<String> cookies = Cookies.getCookieNames(); for(String cookie : cookies){ if("currentLang".equals(cookie)){ System.out.println("got currentlang"); } }
If i run the above code then I can see output: "got currentlang" However, if I set timeout=30 days
final int COOKIE_TIMEOUT = 1000 * 60 * 60 * 24 * 30;//30 days
, then nothing got printed out, so "currentLang" has not even been stored if we set 30 days?Why is that? does Gwt prevent that to happen?
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment