Problem with JodaTime

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with JodaTime

kaelumania
Hi,

I noticed the following Problem with a POJO I use to encapsulate Values.

java.lang.NullPointerException
at org.joda.time.tz.CachedDateTimeZone.getInfo(CachedDateTimeZone.java:143)
at org.joda.time.tz.CachedDateTimeZone.getOffset(CachedDateTimeZone.java:103)
at org.joda.time.format.DateTimeFormatter.printTo(DateTimeFormatter.java:722)
at org.joda.time.format.DateTimeFormatter.printTo(DateTimeFormatter.java:535)
at org.joda.time.format.DateTimeFormatter.print(DateTimeFormatter.java:671)
at org.joda.time.base.AbstractInstant.toString(AbstractInstant.java:424)
at org.joda.time.base.AbstractDateTime.toString(AbstractDateTime.java:314)
at java.lang.String.valueOf(String.java:2994)
at java.lang.StringBuilder.append(StringBuilder.java:131)

and found this 


Help is really appreciated.

best,
Stephan



Reply | Threaded
Open this post in threaded view
|

Re: Problem with JodaTime

rmetzger0
Hi Stephan,

Can you post the list of fields in the POJO and the full exception (so that I can see which serializer is being used).

In general, to fix such an issue, you have to implement a custom serializer for the field that is causing the issues.

On Thu, Dec 22, 2016 at 3:44 PM, Stephan Epping <[hidden email]> wrote:
Hi,

I noticed the following Problem with a POJO I use to encapsulate Values.

java.lang.NullPointerException
at org.joda.time.tz.CachedDateTimeZone.getInfo(CachedDateTimeZone.java:143)
at org.joda.time.tz.CachedDateTimeZone.getOffset(CachedDateTimeZone.java:103)
at org.joda.time.format.DateTimeFormatter.printTo(DateTimeFormatter.java:722)
at org.joda.time.format.DateTimeFormatter.printTo(DateTimeFormatter.java:535)
at org.joda.time.format.DateTimeFormatter.print(DateTimeFormatter.java:671)
at org.joda.time.base.AbstractInstant.toString(AbstractInstant.java:424)
at org.joda.time.base.AbstractDateTime.toString(AbstractDateTime.java:314)
at java.lang.String.valueOf(String.java:2994)
at java.lang.StringBuilder.append(StringBuilder.java:131)

and found thisĀ 


Help is really appreciated.

best,
Stephan




Reply | Threaded
Open this post in threaded view
|

Re: Problem with JodaTime

kaelumania
Hi Robert,

thanks for the fast response. The following line fixed the problem (maybe a good topic for the docs), because I thought JodaTime is supported out of the box.
Buts I think thats only the case with the JacksonParser.

this.env.addDefaultKryoSerializer(DateTime.class, JodaDateTimeSerializer.class);
best,
Stephan



On 24 Dec 2016, at 09:40, Robert Metzger <[hidden email]> wrote:

Hi Stephan,

Can you post the list of fields in the POJO and the full exception (so that I can see which serializer is being used).

In general, to fix such an issue, you have to implement a custom serializer for the field that is causing the issues.

On Thu, Dec 22, 2016 at 3:44 PM, Stephan Epping <[hidden email]> wrote:
Hi,

I noticed the following Problem with a POJO I use to encapsulate Values.

java.lang.NullPointerException
at org.joda.time.tz.CachedDateTimeZone.getInfo(CachedDateTimeZone.java:143)
at org.joda.time.tz.CachedDateTimeZone.getOffset(CachedDateTimeZone.java:103)
at org.joda.time.format.DateTimeFormatter.printTo(DateTimeFormatter.java:722)
at org.joda.time.format.DateTimeFormatter.printTo(DateTimeFormatter.java:535)
at org.joda.time.format.DateTimeFormatter.print(DateTimeFormatter.java:671)
at org.joda.time.base.AbstractInstant.toString(AbstractInstant.java:424)
at org.joda.time.base.AbstractDateTime.toString(AbstractDateTime.java:314)
at java.lang.String.valueOf(String.java:2994)
at java.lang.StringBuilder.append(StringBuilder.java:131)

and found this 


Help is really appreciated.

best,
Stephan