diff options
author | Olivier Lamy <olamy@apache.org> | 2013-01-21 22:42:59 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2013-01-21 22:42:59 +0000 |
commit | 8e61f56f9d519fcf32653b740cee511a242009f2 (patch) | |
tree | b9ea0928521056468e44f43957d23d5a7171afff /redback-integrations/redback-common-integrations | |
parent | e12772a85643fd3036daabfa9723e76be53cae13 (diff) | |
download | archiva-8e61f56f9d519fcf32653b740cee511a242009f2.tar.gz archiva-8e61f56f9d519fcf32653b740cee511a242009f2.zip |
prevent NPE
git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1436670 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'redback-integrations/redback-common-integrations')
-rw-r--r-- | redback-integrations/redback-common-integrations/src/main/java/org/apache/archiva/redback/integration/checks/security/GuestUserEnvironmentCheck.java | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/redback-integrations/redback-common-integrations/src/main/java/org/apache/archiva/redback/integration/checks/security/GuestUserEnvironmentCheck.java b/redback-integrations/redback-common-integrations/src/main/java/org/apache/archiva/redback/integration/checks/security/GuestUserEnvironmentCheck.java index fcbcb94f1..c004ebcc6 100644 --- a/redback-integrations/redback-common-integrations/src/main/java/org/apache/archiva/redback/integration/checks/security/GuestUserEnvironmentCheck.java +++ b/redback-integrations/redback-common-integrations/src/main/java/org/apache/archiva/redback/integration/checks/security/GuestUserEnvironmentCheck.java @@ -53,7 +53,7 @@ public class GuestUserEnvironmentCheck private SecuritySystem securitySystem; @Inject - @Named( value = "userConfiguration#default" ) + @Named(value = "userConfiguration#default") private UserConfiguration config; /** @@ -86,20 +86,29 @@ public class GuestUserEnvironmentCheck catch ( UserManagerException ume ) { violations.add( "unable to initialize guest user properly: " + ume.getMessage() ); + checked = true; return; } policy.setEnabled( true ); } - try + if ( guest != null ) { - roleManager.assignRole( config.getString( UserConfigurationKeys.DEFAULT_GUEST ), guest.getUsername() ); + + try + { + roleManager.assignRole( config.getString( UserConfigurationKeys.DEFAULT_GUEST ), + guest.getUsername() ); + } + catch ( RoleManagerException rpe ) + { + violations.add( "unable to initialize guest user properly: " + rpe.getMessage() ); + } } - catch ( RoleManagerException rpe ) + else { - violations.add( "unable to initialize guest user properly: " + rpe.getMessage() ); + violations.add( "cannot find neither create guest user" ); } - checked = true; } } |