Comments (5)
What output do you get if you run the following code?
System.out.println(Locale.getDefault());
var formatter = DateTimeFormatter.ofPattern("E, d LLL yyyy HH:mm:ss O");
System.out.println(formatter);
var timestamp = ZonedDateTime.parse("Sat, 21 Jan 2023 11:12:30 GMT", formatter);
System.out.println(timestamp);
from rssreader.
An exception is thrown:
de_DE
Text(DayOfWeek,SHORT)','' 'Value(DayOfMonth)' 'Text(MonthOfYear,SHORT_STANDALONE)' 'Value(YearOfEra,4,19,EXCEEDS_PAD)' 'Value(HourOfDay,2)':'Value(MinuteOfHour,2)':'Value(SecondOfMinute,2)' 'LocalizedOffset(SHORT)
Exception in thread "main" java.time.format.DateTimeParseException: Text 'Sat, 21 Jan 2023 11:12:30 GMT' could not be parsed at index 0
at java.base/java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:2052)
at java.base/java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1954)
at java.base/java.time.ZonedDateTime.parse(ZonedDateTime.java:600)
at main.Main.main(Main.java:14)
If I change the locale to English it works fine: Locale.setDefault(Locale.ENGLISH);
I don't know the implementation details of the parser, but it could respect the language property of the RSS feed: <language>en-us</language>
if available. Otherwise the parser defaults to the English locale.
from rssreader.
DateTimeFormatter
was using system default locale. Changed it to use Locale.ENGLISH formatting when parsing timestamp strings.
Fixed by PR #77
from rssreader.
Fixed in release 3.4.2
from rssreader.
Thank you. Everything works now.
from rssreader.
Related Issues (20)
- JCenter is being sunset HOT 2
- Are the RSS items cached? HOT 2
- java.time.format.DateTimeParseException HOT 5
- How to get all image? HOT 4
- Datetime format not recognized
- [FEATURE REQUEST] Parse String directly. HOT 1
- "content" tag should be treated separately HOT 1
- Support for multiple instances of Enclosure HOT 2
- Author and pubDate are not set HOT 2
- How to subscribe to RSS feed? HOT 1
- blank enclosure length leads to exception HOT 1
- Multiple categories HOT 1
- How to extend the class Item? HOT 4
- How to pass some object / parameter into custom RssReader / AbstractRssReader? HOT 4
- Too Many Open Files HOT 2
- How to get the raw string of the RSS xml response? HOT 1
- Support read from file HOT 1
- image field/tag missing HOT 2
- Problems with some special date time format(s) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rssreader.