Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@thomasdarimont
Copy link
Contributor

@thomasdarimont thomasdarimont commented Aug 2, 2023

  • Use charset in Encode class
  • Replace reflective call to protected Liquibase#resetServices() with call to exposed public method on a custom subclass KeycloakLiquibase
  • Remove usage of deprecated AccessController class in Reflections
  • Mark unused SetAccessibleProvilegedAction and UnsetAccessibleProvilegedAction as deprecated for removal in Keycloak 27

Fixes #22209

@thomasdarimont thomasdarimont force-pushed the issue/GH-22209-common-deprecations branch 3 times, most recently from ebf3a22 to 128729b Compare June 25, 2024 21:50
@thomasdarimont thomasdarimont marked this pull request as ready for review June 25, 2024 21:50
@thomasdarimont thomasdarimont requested review from a team as code owners June 25, 2024 21:50
@thomasdarimont thomasdarimont changed the title Fix deprections in common module (#22209) Fix deprecations in common module (#22209) Jun 25, 2024
@ahus1 ahus1 self-assigned this Jun 28, 2024
Copy link
Contributor

@ahus1 ahus1 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 this PR. I agree the Liquibase parts can be improved by using less reflection.

The removal of the classes in keycloak-common should be done by first deprecating them, and later removing them in a future issue.

The change in Encode.java should not be a problem as we set -Dfile.encoding=UTF-8 in the JAVA_OPTS in kc.sh, still it would be good to mention it in the release notes as it could lead to a different encoding of URL parameters.

@thomasdarimont thomasdarimont force-pushed the issue/GH-22209-common-deprecations branch 2 times, most recently from ae74284 to 3a7deb3 Compare June 28, 2024 20:44
@thomasdarimont
Copy link
Contributor Author

@ahus1 thanks for taking a look! I readded the removed classes and marked them for removal in KC27. I also added a brief note to the release notes.

@keycloak-github-bot
Copy link

Unreported flaky test detected

If the 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.model.session.SessionTimeoutsTest#testOfflineUserClientMaxLifespanSmallerThanSession

Keycloak CI - Store Model Tests

java.lang.AssertionError
	at org.junit.Assert.fail(Assert.java:87)
	at org.junit.Assert.assertTrue(Assert.java:42)
	at org.junit.Assert.assertNotNull(Assert.java:713)
	at org.junit.Assert.assertNotNull(Assert.java:723)
...

Report flaky test

Copy link

@keycloak-github-bot keycloak-github-bot bot 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

Copy link
Contributor

@ahus1 ahus1 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 changes. Please add the deprecated methods to changes-26_0_0.adoc so people will know that that they'll need to change something.

* @throws InstantiationException
*/
public static <T> T newInstance(final Class<T> fromClass) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
public static <T> T newInstance(final Class<T> fromClass) throws ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException, NoSuchMethodException {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: Changing the signature of the method is also a breaking change at least when people want to compile their code. AFAIK this method is not used, so I'd suggest to either keep it as is for now, deprecate it for KC27 and eventually remove it.

* @throws IllegalAccessException
* @throws InstantiationException
*/
public static <T> T newInstance(final Class<?> type, final String fullQualifiedName) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick - as above, I suggest deprecation and removal.

ahus1
ahus1 previously approved these changes Jul 2, 2024
Copy link
Contributor

@ahus1 ahus1 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 this PR. I pushed one more commit as the updated class in common still contained additional exceptions in its signature.

Thinking again about the docs, also decided to move all the docs changes to the upgrading guide as only those upgrading might be interested in them. The release notes usually only contain the highlights.

thomasdarimont and others added 5 commits July 2, 2024 16:57
- Use charset in `Encode` class
- Replace reflective call to protected `Liquibase#resetServices()` with call to exposed public method on a custom subclass `KeycloakLiquibase`
- Remove usage of deprecated AccessController class in Reflections
- Remove unused SetAccessibleProvilegedAction and UnsetAccessibleProvilegedAction

Fixes keycloak#22209

Signed-off-by: Thomas Darimont <[email protected]>
Avoid usage of interfaces used by deprecated AccessController infrastructure.

Signed-off-by: Thomas Darimont <[email protected]>
- Added keycloak-common deprecations to changes-26 document
- Avoid breaking API changes

Signed-off-by: Thomas Darimont <[email protected]>
Closes keycloak#22209

Signed-off-by: Alexander Schwartz <[email protected]>
@ahus1 ahus1 force-pushed the issue/GH-22209-common-deprecations branch from eb5c41b to 64099e6 Compare July 2, 2024 14:57
@ahus1 ahus1 enabled auto-merge (squash) July 2, 2024 14:58
@ahus1 ahus1 merged commit f34bb21 into keycloak:main Jul 2, 2024
Copy link

@keycloak-github-bot keycloak-github-bot bot 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

@keycloak-github-bot
Copy link

Unreported flaky test detected

If the 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.admin.AdminConsoleWhoAmILocaleTest#testLocaleRealmI18nEnabledUserWithoutLocale

Keycloak CI - Store IT (mysql)

org.openqa.selenium.TimeoutException: 
java.net.SocketTimeoutException: Read timed out
Build info: version: '4.21.0', revision: '79ed462ef4'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '6.5.0-1022-azure', java.version: '21.0.3'
Driver info: driver.version: HtmlUnitDriver
...

Report flaky test

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.

Fix usage of deprecated API in common module

2 participants