Getting InvalidFormatException in android project, using Annotation + Json and jackson for api fetching data

37
December 06, 2018, at 4:40 PM

Json Data list :

    {
      "pages": 0,
      "all": {
        "Link": "https:\/\/www.xyz.info\/en\/about-us\/announcements\/",
        "Title": "Read more announcements"
      },
      "announcements": [
        {
          "Title": "Updates to xyz's Privacy Policy & Cookies Statement",
          "ActivatedDate": "30 October 2018",
          "ShortDescription": "Please note updates to xyz's privacy policy and cookies statement that addresses new data regulations, including GDPR.",
          "Content": "<p>At xyz we're constantly striving to help buyers and sellers to trade with confidence in global and local dairy markets.<br><br> Considering this, we\u00a0want to share our updated privacy policy and cookies statement that addresses new data regulations, including GDPR.<\/p>\n<p><strong>Privacy policy<\/strong><br> Read the full version\u00a0<strong><a href=\"https:\/\/www.xyz.info\/en\/generic-pages\/privacy-policy\/\" target=\"_blank\">here.<\/a><\/strong><br><br><strong>Cookies statement<\/strong><br> Read the full version\u00a0<strong><a href=\"https:\/\/www.xyz.info\/en\/generic-pages\/cookies-statement\/\" target=\"_blank\">here.<\/a><\/strong><\/p>",
          "Link": "https:\/\/www.xyz.info\/en\/about-us\/announcements\/updates-to-gdts-privacy-policy-and-cookies-statement\/"
        },
        {
          "Title": "More data now available via xyz Insight subscriptions",
          "ActivatedDate": "17 September 2018",
          "ShortDescription": "xyz has added a new report to xyz Insight, which now includes data showing the total quantity sold for each product group by region.",
          "Content": "<p>xyz has added a new report to xyz Insight, which now includes data showing the total quantity sold for each product group by region.<br><br> This supplements the existing data available via all xyz Insight packs, including:<\/p>\n<ul><li>Number of buyers per region<\/li>\n<li>Historical data of key pricing metrics<\/li>\n<\/ul><p>Round-by-round information is available in the Analyst and Trader packs including:<\/p>\n<ul><li>Announced prices per product group and contract period<\/li>\n<li>Demand\/supply ratios by product group<\/li>\n<\/ul><p>If you make decisions that rely on access to the most complete dairy data available, then GDT Insight is relevant to you.\u00a0All packs are available at highly competitive prices.<\/p>\n<p class=\"btn-call-action\"><a href=\"https:\/\/www.xyz.info\/en\/gdt-insight\/gdt-insight-2\/\">Find out more<\/a><\/p>",
          "Link": "https:\/\/www.xyz.info\/en\/about-us\/announcements\/more-data-now-available-via-gdt-insight-subscriptions\/"
        }
]
}

This is datalayer DLAnnouncement.java code

@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class DLAnnouncement {
    @JsonProperty("Link")
    private String id;
    @JsonProperty("Title")
    private String title;
    @JsonProperty("ActivatedDate")
    @JsonInclude(value= JsonInclude.Include.NON_EMPTY)
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "d MMMM yyyy")
    private Date date;
    @JsonProperty("ShortDescription")
    private String shortContent = "";
    @JsonProperty("Content")
    private String fullContent;

This is Datalayer DLAnnouncementContext.java code

@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class DLAnnouncementsContext {
    private List<DLAnnouncement> announcements;
}

How to fix this issue, this crashes occurs -

java.lang.Error: at [Source: line: 1, column: 226] (through reference chain: nz.co.xyz.kit.announcements.datalayer.models.DLAnnouncementsContext["announcements"]->java.util.ArrayList[0]->nz.co.xyz.kit.announcements.datalayer.models.DLAnnouncement["ActivatedDate"])
  at nz.co.xyz.kit.apisession.APISessionFacade.lambda$getAnnouncements$8 (APISessionFacade.java:187)
  at nz.co.xyz.kit.apisession.APISessionFacade$$Lambda$9.accept (Unknown Source)
  at nz.co.xyz.kit.apisession.datalayer.APIExternalServiceAgent.lambda$get$2 (APIExternalServiceAgent.java:83)
  at nz.co.xyz.kit.apisession.datalayer.APIExternalServiceAgent$$Lambda$3.run (Unknown Source)
  at nz.co.xyz.storage.sqlite.ObjectStorageAgent.store (ObjectStorageAgent.java:28)
  at nz.co.xyz.storage.sqlite.ObjectStorageAgent_.access$001 (ObjectStorageAgent_.java:15)
  at nz.co.xyz.storage.sqlite.ObjectStorageAgent_.store (ObjectStorageAgent_.java:40)
  at nz.co.xyz.kit.apisession.datalayer.APIExternalServiceAgent.get (APIExternalServiceAgent.java:83)
  at nz.co.xyz.kit.apisession.datalayer.APIExternalServiceAgent.lambda$get$0 (APIExternalServiceAgent.java:68)
  at nz.co.xyz.kit.apisession.datalayer.APIExternalServiceAgent$$Lambda$1.accept (Unknown Source)
  at nz.co.xyz.storage.sqlite.ObjectStorageAgent.read (ObjectStorageAgent.java:49)
  at nz.co.xyz.storage.sqlite.ObjectStorageAgent_.access$201 (ObjectStorageAgent_.java:15)
  at nz.co.xyz.storage.sqlite.ObjectStorageAgent_.read (ObjectStorageAgent_.java:52)
  at nz.co.xyz.kit.apisession.datalayer.APIExternalServiceAgent.get (APIExternalServiceAgent.java:66)
  at nz.co.xyz.kit.apisession.APISessionFacade.getAnnouncements (APISessionFacade.java:181)
  at nz.co.xyz.kit.announcements.datalayer.AnnouncementsServiceAgent.getAnnouncements (AnnouncementsServiceAgent.java:14)
  at nz.co.xyz.kit.announcements.businesslayer.AnnouncementsController.getAnnouncements (AnnouncementsController.java:26)
  at nz.co.xyz.kit.announcements.Announcements.getAnnouncements (Announcements.java:18)
  at nz.co.xyz.kit.KitAnnouncements.lambda$getAnnouncements$1 (KitAnnouncements.java:21)
  at nz.co.xyz.kit.KitAnnouncements$$Lambda$1.run (Unknown Source)
  at android.os.AsyncTask$SerialExecutor$1.run (AsyncTask.java:231)
  at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1112)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:587)
  at java.lang.Thread.run (Thread.java:818)
Caused by: com.fasterxml.jackson.databind.exc.InvalidFormatException: 
  at com.fasterxml.jackson.databind.DeserializationContext.weirdStringException (DeserializationContext.java:1410)
  at com.fasterxml.jackson.databind.DeserializationContext.handleWeirdStringValue (DeserializationContext.java:926)
  at com.fasterxml.jackson.databind.deser.std.DateDeserializers$DateBasedDeserializer._parseDate (DateDeserializers.java:156)
  at com.fasterxml.jackson.databind.deser.std.DateDeserializers$DateDeserializer.deserialize (DateDeserializers.java:259)
  at com.fasterxml.jackson.databind.deser.std.DateDeserializers$DateDeserializer.deserialize (DateDeserializers.java:242)
  at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize (SettableBeanProperty.java:499)
  at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet (MethodProperty.java:101)
  at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize (BeanDeserializer.java:276)
  at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize (BeanDeserializer.java:140)
  at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize (CollectionDeserializer.java:287)
  at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize (CollectionDeserializer.java:259)
  at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize (CollectionDeserializer.java:26)
  at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize (SettableBeanProperty.java:499)
  at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet (MethodProperty.java:101)
  at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize (BeanDeserializer.java:276)
  at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize (BeanDeserializer.java:140)
  at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose (ObjectMapper.java:3798)
  at com.fasterxml.jackson.databind.ObjectMapper.readValue (ObjectMapper.java:2842)
  at nz.co.xyz.kit.apisession.APISessionFacade.lambda$getAnnouncements$8 (APISessionFacade.java:183)
READ ALSO
how to get fixed header and scrolling list item on nativescirpt radlistview

how to get fixed header and scrolling list item on nativescirpt radlistview

my sample code herethe problem is when i scroll the list header will go off, which should be fixed in position

32
Android navigation architecture testing

Android navigation architecture testing

please help me to test android navigation architecture component by using androidarch

21
How to unregister multiple Broadcast receiver which are in different classes at a time?

How to unregister multiple Broadcast receiver which are in different classes at a time?

i want to unregister some broadcast receivers with single clickhere is the flow

44
Android App crashes only on specific devices

Android App crashes only on specific devices

I've recently released my first app on Google Play and many users installed it alreadyThere seem to be no problems so far, except 2 different errors reported by Google Play Console

40