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

Error when RoleRepresentation.getDescription() returns no description #970

Open
schuerg opened this issue Dec 15, 2023 · 0 comments
Open
Labels

Comments

@schuerg
Copy link

schuerg commented Dec 15, 2023

Current Behavior

An error is thrown when org.keycloak.representations.idm.RoleRepresentation.getDescription() returns null.

It happens, when roles have no description.

This happens here https://github.com/adorsys/keycloak-config-cli/blob/main/src/main/java/de/adorsys/keycloak/config/util/KeycloakUtil.java#L50

Cannot invoke "String.equals(Object)" because the return value of "org.keycloak.representations.idm.RoleRepresentation.getDescription()" is null
	at de.adorsys.keycloak.config.util.KeycloakUtil.isDefaultRole(KeycloakUtil.java:50)

Here is the complete error log with stacktrace:

2023-12-15 13:24:21.809  INFO 1 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2023-12-15 13:24:21.852 ERROR 1 --- [           main] o.s.boot.SpringApplication               : Application run failed

java.lang.IllegalStateException: Failed to execute CommandLineRunner
	at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:771)
	at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:752)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1303)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1292)
	at de.adorsys.keycloak.config.KeycloakConfigApplication.main(KeycloakConfigApplication.java:35)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
	at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:108)
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
	at org.springframework.boot.loader.PropertiesLauncher.main(PropertiesLauncher.java:467)
Caused by: java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because the return value of "org.keycloak.representations.idm.RoleRepresentation.getDescription()" is null
	at de.adorsys.keycloak.config.util.KeycloakUtil.isDefaultRole(KeycloakUtil.java:50)
	at de.adorsys.keycloak.config.service.RoleImportService.deleteRealmRolesMissingInImport(RoleImportService.java:262)
	at de.adorsys.keycloak.config.service.RoleImportService.doImport(RoleImportService.java:94)
	at de.adorsys.keycloak.config.service.RealmImportService.configureRealm(RealmImportService.java:199)
	at de.adorsys.keycloak.config.service.RealmImportService.updateRealm(RealmImportService.java:192)
	at de.adorsys.keycloak.config.service.RealmImportService.updateRealmIfNecessary(RealmImportService.java:150)
	at de.adorsys.keycloak.config.service.RealmImportService.doImport(RealmImportService.java:141)
	at de.adorsys.keycloak.config.KeycloakConfigRunner.run(KeycloakConfigRunner.java:79)
	at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:768)
	... 13 common frames omitted

Expected Behavior

Should execute without error.

Environment

  • Keycloak Version: 21.1.2
  • keycloak-config-cli Version: docker.io/adorsys/keycloak-config-cli:5.10.0-21.1.1
@schuerg schuerg added the bug label Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant