Skip to content

Conversation

@kuaikuai
Copy link

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.

@kuaikuai kuaikuai requested a review from a team as a code owner November 12, 2025 09:43
@gemini-code-assist
Copy link

Summary of Changes

Hello @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 GoFeatureFlagApi by explicitly setting the locale to English when interpreting the Last-Modified HTTP header. This ensures that date strings, which are standardized to an English format in HTTP, are correctly parsed regardless of the JVM's default locale, thereby preventing unexpected parsing failures and improving the stability of the API's interaction with HTTP responses.

Highlights

  • Locale Specification for Date Parsing: Explicitly added Locale.ENGLISH to the SimpleDateFormat constructor used for parsing the Last-Modified HTTP header.
  • Improved Robustness: This change prevents potential ParseException errors that could arise from variations in the default system locale when interpreting date strings from HTTP headers, ensuring consistent parsing behavior.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a 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.

@kuaikuai kuaikuai changed the title Added Locale.ENGLISH to SimpleDateFormat for parsing the Last-Modified HTTP header fix: Added Locale.ENGLISH to SimpleDateFormat for parsing the Last-Modified HTTP header Nov 12, 2025
@thomaspoignant
Copy link
Member

@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 have some time and willing to contribute to the provider by changing that it would be awesome.

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.

@thomaspoignant
Copy link
Member

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a 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.

@kuaikuai
Copy link
Author

@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 have some time and willing to contribute to the provider by changing that it would be awesome.

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.

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. ^_^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants