Skip to content
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

Use Java mechanisms to read language files and default to UTF-8 #21755

Merged

Conversation

ahus1
Copy link
Contributor

@ahus1 ahus1 commented Jul 17, 2023

Closes #21753

Discussion: #9270

@ahus1
Copy link
Contributor Author

ahus1 commented Jul 17, 2023

While this is still in draft, it already contains updates to all property files and the docs.

@ahus1 ahus1 self-assigned this Jul 17, 2023
jonkoops
jonkoops previously approved these changes Jul 17, 2023
Charset encoding = PropertiesUtil.detectEncoding(new FileInputStream(file));
try (Reader reader = new InputStreamReader(new FileInputStream(file), encoding)) {
m.load(reader);
try (InputStream stream = Files.newInputStream(file.toPath())) {

Check failure

Code scanning / CodeQL

Uncontrolled data used in path expression High

This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
This path depends on a
user-provided value
.
@ahus1
Copy link
Contributor Author

ahus1 commented Jul 18, 2023

It would be great to have a review from one of the maintainers on the Java side on this. Thanks!

Copy link
Contributor

@hmlnarik hmlnarik left a comment

Choose a reason for hiding this comment

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

Approving for the Java part

hmlnarik
hmlnarik previously approved these changes Jul 19, 2023
@jonkoops
Copy link
Contributor

@ahus1 looks like the code scanner has some issues with the changes introduced here.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Unreported flaky test detected, please review

@ghost
Copy link

ghost commented Jul 20, 2023

Unreported flaky test detected

If the below flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR.

org.keycloak.testsuite.forms.LoginTest#loginDifferentUserAfterDisabledUserThrownOut

Keycloak CI - Forms IT (firefox)

java.lang.AssertionError: Expected LoginPage but was Keycloak Account Management (https://localhost:8543/auth/realms/test/account/#/)
	at org.junit.Assert.fail(Assert.java:89)
	at org.junit.Assert.assertTrue(Assert.java:42)
	at org.keycloak.testsuite.pages.AbstractPage.assertCurrent(AbstractPage.java:47)
	at org.keycloak.testsuite.pages.LoginPage.open(LoginPage.java:236)
...

Report flaky test

1 similar comment
@ghost
Copy link

ghost commented Jul 20, 2023

Unreported flaky test detected

If the below flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR.

org.keycloak.testsuite.forms.LoginTest#loginDifferentUserAfterDisabledUserThrownOut

Keycloak CI - Forms IT (firefox)

java.lang.AssertionError: Expected LoginPage but was Keycloak Account Management (https://localhost:8543/auth/realms/test/account/#/)
	at org.junit.Assert.fail(Assert.java:89)
	at org.junit.Assert.assertTrue(Assert.java:42)
	at org.keycloak.testsuite.pages.AbstractPage.assertCurrent(AbstractPage.java:47)
	at org.keycloak.testsuite.pages.LoginPage.open(LoginPage.java:236)
...

Report flaky test

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Unreported flaky test detected, please review

@ahus1
Copy link
Contributor Author

ahus1 commented Jul 22, 2023

@jonkoops - I've look at the CodeQL alert, and also added a Regex check for filenames - CodeQL still complains. The logic to create the filename didn't change in this PR, so I assume it is as safe as before. I'll follow up with Bruno to find out why CodeQL complains here.

@jonkoops
Copy link
Contributor

@ahus1 sounds good to me, should we go ahead and merge this then?

@ahus1
Copy link
Contributor Author

ahus1 commented Jul 22, 2023

@jonkoops - yes, I think this is the way to go. Please approve it for the UI part.
I'll also get an re-approval of a maintainer/Java developer, and then it will be ready to be merged.

jonkoops
jonkoops previously approved these changes Jul 22, 2023
Copy link
Contributor

@jonkoops jonkoops left a comment

Choose a reason for hiding this comment

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

LGTM

@ahus1
Copy link
Contributor Author

ahus1 commented Jul 23, 2023

@hmlnarik - I've added one more commit to make CodeQL happy, but it continues to warn. I'd like to keep that change, and have it squashed when committing. I'll contact @abstractj separately to figure out how to make CodeQL happy.

Could you please re-approve and merge? Thanks!

@ahus1 ahus1 force-pushed the is-21753-standardize-translation-handling branch from 471daad to e7c31c1 Compare July 26, 2023 07:42
@ahus1
Copy link
Contributor Author

ahus1 commented Jul 26, 2023

Rebased to resolve conflicts on the docs. Also squashed the two commits.

Copy link
Contributor

@mhajas mhajas left a comment

Choose a reason for hiding this comment

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

thank you for the PR @ahus1, I added two comments. Also, it seems a rebase is needed (sorry for the late review).

docs/documentation/release_notes/topics/23_0_0.adoc Outdated Show resolved Hide resolved
@ahus1 ahus1 force-pushed the is-21753-standardize-translation-handling branch from e7c31c1 to badab44 Compare July 31, 2023 10:05
@ahus1 ahus1 force-pushed the is-21753-standardize-translation-handling branch from badab44 to 21eda42 Compare July 31, 2023 10:05
@ahus1 ahus1 requested a review from mhajas July 31, 2023 10:07
Copy link
Contributor

@mhajas mhajas left a comment

Choose a reason for hiding this comment

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

Thank you @ahus1

@mhajas mhajas enabled auto-merge (squash) July 31, 2023 11:27
@ahus1
Copy link
Contributor Author

ahus1 commented Jul 31, 2023

@jonkoops - could you please re-review before we run into another merge conflict? Thank you very much!

@ahus1 ahus1 requested a review from jonkoops July 31, 2023 11:56
@mhajas mhajas merged commit 748c53d into keycloak:main Aug 1, 2023
62 of 64 checks passed
@ahus1 ahus1 deleted the is-21753-standardize-translation-handling branch September 21, 2023 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Standardize message property handling for translation tools
4 participants