[KEYCLOAK-12097] Fix NPE when trying to obtain the cache container name from jboss-web.xml

- check if the cache name as configured in jboss-web.xml is composite - i.e. has a 'parent.child' structure
This commit is contained in:
Stefan Guilhen 2020-04-20 21:43:03 -03:00 committed by Hynek Mlnařík
parent 44b489b571
commit fd9c4e9228
2 changed files with 2 additions and 2 deletions

View file

@ -113,7 +113,7 @@ public class KeycloakClusteredSsoDeploymentProcessor implements DeploymentUnitPr
// Update names from jboss-web.xml's <replicationConfig> // Update names from jboss-web.xml's <replicationConfig>
if (webMetaData.getReplicationConfig() != null && webMetaData.getReplicationConfig().getCacheName() != null) { if (webMetaData.getReplicationConfig() != null && webMetaData.getReplicationConfig().getCacheName() != null) {
ServiceName sn = ServiceName.parse(webMetaData.getReplicationConfig().getCacheName()); ServiceName sn = ServiceName.parse(webMetaData.getReplicationConfig().getCacheName());
cacheContainer = sn.getParent().getSimpleName(); cacheContainer = (sn.length() > 1) ? sn.getParent().getSimpleName() : sn.getSimpleName();
deploymentSessionCacheName = sn.getSimpleName(); deploymentSessionCacheName = sn.getSimpleName();
} }
String ssoCacheName = deploymentSessionCacheName + ".ssoCache"; String ssoCacheName = deploymentSessionCacheName + ".ssoCache";

View file

@ -116,7 +116,7 @@ public class KeycloakClusteredSsoDeploymentProcessor implements DeploymentUnitPr
// Update names from jboss-web.xml's <replicationConfig> // Update names from jboss-web.xml's <replicationConfig>
if (webMetaData.getReplicationConfig() != null && webMetaData.getReplicationConfig().getCacheName() != null) { if (webMetaData.getReplicationConfig() != null && webMetaData.getReplicationConfig().getCacheName() != null) {
ServiceName sn = ServiceName.parse(webMetaData.getReplicationConfig().getCacheName()); ServiceName sn = ServiceName.parse(webMetaData.getReplicationConfig().getCacheName());
cacheContainer = sn.getParent().getSimpleName(); cacheContainer = (sn.length() > 1) ? sn.getParent().getSimpleName() : sn.getSimpleName();
deploymentSessionCacheName = sn.getSimpleName(); deploymentSessionCacheName = sn.getSimpleName();
} }
String ssoCacheName = deploymentSessionCacheName + ".ssoCache"; String ssoCacheName = deploymentSessionCacheName + ".ssoCache";