Domanda

I need to parse pubDate from RSS feeds in an Android App. Unfortunately, the pubDate is formatted differently in different RSS feeds (e.g. EEE, dd MMM yyyy HH:mm:ss z, yyyy-MM-dd'T'HH:mm:ss.SSSz...)

I have found a solution to parse most different date formats with the DateParser.java which uses SimpleDateFormat. However, this implementation is really slow since it does not cache the SimpleDateFormat instances (as recommended for example here).

Any ideas how I can parse all possible date formats faster and avoid reinventing the wheel? Thanks for your input.

È stato utile?

Soluzione

A fixed DateParser.java can be found here. Here is how the problem was fixed by the contributor:

I modified com.sun.syndication.io.impl.DateParser to use a cache with a limited size for keeping existing SimpleDateFormat objects and will clone them when needed to avoid using constructor method.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top