FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix: update usages of String.format to explicitly pass Locale.US by BenWhitehead · Pull Request #2974 · googleapis/java-storage · GitHub

fix: update usages of String.format to explicitly pass Locale.US - #2974

Merged
BenWhitehead merged 1 commit into
mainfrom
format-explicit-locale
Mar 5, 2025
Merged

fix: update usages of String.format to explicitly pass Locale.US#2974
BenWhitehead merged 1 commit into
mainfrom
format-explicit-locale

Conversation

Copy link
Copy Markdown
Collaborator

Usage of Storage#format(String, Object...) will use the default locale for it's formatting. This can lead to unexpected formatting if a right-to-left language such as Arabic is the default locale.

Update all usages to use String.format(Locale.US, pattern, Object...) so we ensure things like headers or error messages are formatted according to the US conventions which match en_US and ascii byte conventions.

Incidentally, things like right-to-left formatting seem to only apply to java11+ not java8.

Fixes #2972

Usage of `Storage#format(String, Object...)` will use the default locale for it's formatting. This can lead to unexpected formatting if a right-to-left language such as Arabic is the default locale.

Update all usages to use `String.format(Locale.US, pattern, Object...)` so we ensure things like headers or error messages are formatted according to the US conventions which match `en_US` and ascii byte conventions.

Incidentally, things like right-to-left formatting seem to only apply to java11+ not java8.

Fixes #2972
BenWhitehead requested a review from a team March 5, 2025 19:58
product-auto-label Bot added size: m Pull request size is medium. api: storage Issues related to the googleapis/java-storage API. labels Mar 5, 2025

ddelgrosso1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Yowza! This touches a lot of files but looks pretty boilerplate

BenWhitehead merged commit 8bcb2de into main Mar 5, 2025
BenWhitehead deleted the format-explicit-locale branch March 5, 2025 22:08

Copy link
Copy Markdown

Incidentally, things like right-to-left formatting seem to only apply to java11+ not java8.

Perhaps related to https://openjdk.org/jeps/252

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: storage Issues related to the googleapis/java-storage API. size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Storage: Content-Range header is formatted with default locale

3 participants


Back | FazBrowse Home | New Git URL