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

Cannot create 20 or more subGroups #1014

Closed
alviss7 opened this issue Apr 29, 2024 · 2 comments · Fixed by #1059
Closed

Cannot create 20 or more subGroups #1014

alviss7 opened this issue Apr 29, 2024 · 2 comments · Fixed by #1059
Labels

Comments

@alviss7
Copy link

alviss7 commented Apr 29, 2024

Current Behavior

Cannot create 20 or more subGroups

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(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        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 "org.keycloak.representations.idm.GroupRepresentation.getRealmRoles()" because "existingGroup" is null
        at de.adorsys.keycloak.config.service.GroupImportService.addRealmRoles(GroupImportService.java:175)
        at de.adorsys.keycloak.config.service.GroupImportService.addSubGroup(GroupImportService.java:213)
        at de.adorsys.keycloak.config.service.GroupImportService.addSubGroups(GroupImportService.java:202)
        at de.adorsys.keycloak.config.service.GroupImportService.createGroup(GroupImportService.java:151)
        at de.adorsys.keycloak.config.service.GroupImportService.createOrUpdateRealmGroup(GroupImportService.java:139)
        at de.adorsys.keycloak.config.service.GroupImportService.lambda$createOrUpdateGroups$0(GroupImportService.java:77)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
        at de.adorsys.keycloak.config.service.GroupImportService.createOrUpdateGroups(GroupImportService.java:81)
        at de.adorsys.keycloak.config.service.GroupImportService.importGroups(GroupImportService.java:69)
        at de.adorsys.keycloak.config.service.RealmImportService.configureRealm(RealmImportService.java:203)
        at de.adorsys.keycloak.config.service.RealmImportService.updateRealm(RealmImportService.java:195)
        at de.adorsys.keycloak.config.service.RealmImportService.updateRealmIfNecessary(RealmImportService.java:153)
        at de.adorsys.keycloak.config.service.RealmImportService.doImport(RealmImportService.java:144)
        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

Create more than 20 subGroups, divided into one or more groups

Steps To Reproduce

With this config :

id: master
realm: master
displayName: Keycloak
enabled: true
userManagedAccessAllowed: true
eventsEnabled: true
adminEventsEnabled: true
rememberMe: true
bruteForceProtected: true
failureFactor: 5
internationalizationEnabled: true
passwordPolicy: "length(8) and specialChars(1) and upperCase(1) and lowerCase(1) and digits(1)"
supportedLocales:
- en
- fr
- es

groups:
- name: group
  subGroups:
    - name: group1
    - name: group2
    - name: group3
    - name: group4
    - name: group5
    - name: group6
    - name: group7
    - name: group8
    - name: group9
    - name: group10
    - name: group11
    - name: group12
    - name: group13
    - name: group14
    - name: group15
    - name: group16
    - name: group17
    - name: group18
    - name: group19
    - name: group20
    - name: group21
    - name: group22
    - name: group23
    - name: group24
    - name: group25
    - name: group26

And run java -jar keycloak-config-cli.jar

Environment

  • Keycloak Version: 24.0.3
  • keycloak-config-cli Version: 5.12.0
  • Java Version: 17

Anything else?

No response

@alviss7 alviss7 added the bug label Apr 29, 2024
@timadevelop
Copy link
Contributor

timadevelop added a commit to timadevelop/keycloak-config-cli that referenced this issue Jun 17, 2024
@jonasvoelcker
Copy link
Collaborator

jonasvoelcker commented Jun 17, 2024

@jonasvoelcker @st3v0rr Does it make sense to use something like .getSubGroups(null, group.getSubGroupCount(), false); instead?

Sorry for not responding. Integer.MAX_VALUE seems to be the perfect way. I've added some comment to your PR, please stay on the topic :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants