prevent NPE

git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1436670 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2013-01-21 22:42:59 +00:00
parent e12772a856
commit 8e61f56f9d
1 changed files with 17 additions and 8 deletions

View File

@ -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 );
}
if ( guest != null )
{
try
{
roleManager.assignRole( config.getString( UserConfigurationKeys.DEFAULT_GUEST ), guest.getUsername() );
roleManager.assignRole( config.getString( UserConfigurationKeys.DEFAULT_GUEST ),
guest.getUsername() );
}
catch ( RoleManagerException rpe )
{
violations.add( "unable to initialize guest user properly: " + rpe.getMessage() );
}
}
else
{
violations.add( "cannot find neither create guest user" );
}
checked = true;
}
}