-
Notifications
You must be signed in to change notification settings - Fork 60
fix: Added Locale.ENGLISH to SimpleDateFormat for parsing the Last-Modified HTTP header #1626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: YuXiaoFeng <[email protected]>
Signed-off-by: YuXiaoFeng <[email protected]>
Summary of ChangesHello @kuaikuai, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the reliability of date parsing within the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request correctly addresses a potential locale-dependent parsing issue for the Last-Modified HTTP header by specifying Locale.ENGLISH. This is a good improvement. My review includes a suggestion to further modernize the code by replacing the legacy SimpleDateFormat with the java.time API, which is more robust and thread-safe. This would improve the code's maintainability and reliability.
...flag/src/main/java/dev/openfeature/contrib/providers/gofeatureflag/api/GoFeatureFlagApi.java
Outdated
Show resolved
Hide resolved
|
@kuaikuai thanks for this PR, there is a formatter issue that blocks the CI could you have a look? Also I've seen the gemini review and this implementation is probably better to what I've written. If you can't this is not a problem, you can just fix the formatting part, and we can release a new version of the provider, and I will work on updating the way to read the headers later. |
Signed-off-by: YuXiaoFeng <[email protected]>
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request addresses a potential bug in parsing the Last-Modified HTTP header by replacing the locale-sensitive SimpleDateFormat with the modern java.time API. The use of DateTimeFormatter.RFC_1123_DATE_TIME is a robust solution that correctly handles the date format as specified in RFC 1123, making the parsing independent of the default system locale. This is a significant improvement in correctness and code quality. While the PR title and description mention adding Locale.ENGLISH to SimpleDateFormat, the implemented change to use java.time is a superior approach. I have one minor suggestion regarding code style.
...flag/src/main/java/dev/openfeature/contrib/providers/gofeatureflag/api/GoFeatureFlagApi.java
Outdated
Show resolved
Hide resolved
Signed-off-by: YuXiaoFeng <[email protected]>
I submitted the code directly through the GitHub web interface, so it’s not easy to ensure proper formatting. I’ll make some adjustments to fix this. ^_^ |
Added Locale.ENGLISH to SimpleDateFormat for parsing the Last-Modified HTTP header. This makes the date parsing locale - specific to English, avoiding possible parsing issues caused by default locale differences.