#96 StackOverflowException on Google App Engine (Joda-Time 1.6.1

closed
Joda-Time (76)
7
2012-10-08
2010-08-30
No

This bug is related to 3048468

When an application using joda-time 1.6.1 is deployed to Google App Engine the following sentence produce an StackOverflowException when a java.util.Date object is retrieved from App Engine's Datasotre:

new DateTime(aJavaDate);

The problem is that sometimes java.util.Date objects retrieved from google's datastore hasn't any timezone, so DateTime constructor tries to get the default time zone. This ends calling method DateTimeZone.getDefault(), then this method (line 132) makes the following invocation:

Line 132: temp = forID(System.getProperty("user.timezone"));

But in Google App Engine (maybe the same happends in Android) System.getProperty("user.timezone") returns NULL, so DateTimeZone.forID() is invoked with null argument which causes DateTimeZone.getDefault() to be called again... it's an infinite loop.

A possible solution could be to check whether System.getProperty("user.timezone") is not null before to call System.getProperty("user.timezone"):
(132) ---->
temp = forID(System.getProperty("user.timezone"));
(132) <----
String timeZoneId = System.getProperty("user.timezone");
if(timeZoneId != null){
temp = forID(timeZoneId);
} else {
temp = UTC;
}


Discussion

  • Stephen Colebourne

    Thanks for investigating. I'll probably apply the suggested fix when I get a chance.

     
  • Stephen Colebourne

    Fixed in v2.0 svn as proposed. I can't test Android, but please raise a new issue if svn doesn't work.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks