Merge pull request #3326 from hmlnarik/KEYCLOAK-3664

KEYCLOAK-3664 Fix for NPE in subsystem when secure-deployment is undefined for a particular deployment
This commit is contained in:
Marek Posolda 2016-10-17 13:23:02 +02:00 committed by GitHub
commit c62c60c723
3 changed files with 18 additions and 3 deletions

View file

@ -165,6 +165,9 @@ public final class KeycloakAdapterConfigService {
protected boolean isDeploymentConfigured(DeploymentUnit deploymentUnit) {
ModelNode deployment = getSecureDeployment(deploymentUnit);
if (! deployment.isDefined()) {
return false;
}
ModelNode resource = deployment.get(SecureDeploymentDefinition.RESOURCE.getName());
return resource.isDefined();
}
@ -202,7 +205,9 @@ public final class KeycloakAdapterConfigService {
private ModelNode getSecureDeployment(DeploymentUnit deploymentUnit) {
String deploymentName = preferredDeploymentName(deploymentUnit);
return this.secureDeployments.get(deploymentName);
return this.secureDeployments.containsKey(deploymentName)
? this.secureDeployments.get(deploymentName)
: new ModelNode();
}
// KEYCLOAK-3273: prefer module name if available

View file

@ -164,6 +164,9 @@ public final class KeycloakAdapterConfigService {
protected boolean isDeploymentConfigured(DeploymentUnit deploymentUnit) {
ModelNode deployment = getSecureDeployment(deploymentUnit);
if (! deployment.isDefined()) {
return false;
}
ModelNode resource = deployment.get(SecureDeploymentDefinition.RESOURCE.getName());
return resource.isDefined();
}
@ -201,7 +204,9 @@ public final class KeycloakAdapterConfigService {
private ModelNode getSecureDeployment(DeploymentUnit deploymentUnit) {
String deploymentName = preferredDeploymentName(deploymentUnit);
return this.secureDeployments.get(deploymentName);
return this.secureDeployments.containsKey(deploymentName)
? this.secureDeployments.get(deploymentName)
: new ModelNode();
}
// KEYCLOAK-3273: prefer module name if available

View file

@ -164,6 +164,9 @@ public final class KeycloakAdapterConfigService {
protected boolean isDeploymentConfigured(DeploymentUnit deploymentUnit) {
ModelNode deployment = getSecureDeployment(deploymentUnit);
if (! deployment.isDefined()) {
return false;
}
ModelNode resource = deployment.get(SecureDeploymentDefinition.RESOURCE.getName());
return resource.isDefined();
}
@ -201,7 +204,9 @@ public final class KeycloakAdapterConfigService {
private ModelNode getSecureDeployment(DeploymentUnit deploymentUnit) {
String deploymentName = preferredDeploymentName(deploymentUnit);
return this.secureDeployments.get(deploymentName);
return this.secureDeployments.containsKey(deploymentName)
? this.secureDeployments.get(deploymentName)
: new ModelNode();
}
// KEYCLOAK-3273: prefer module name if available