Added checks to ensure object is properly initialized

This commit is contained in:
Carlos Sanchez 2006-07-10 11:48:35 +00:00
parent 488abe58fb
commit 94a9acedad
3 changed files with 7 additions and 2 deletions

View File

@ -148,7 +148,8 @@ public class LdapAuthenticationProvider extends AbstractUserDetailsAuthenticatio
this.authenticator = authenticator; this.authenticator = authenticator;
} }
public LdapAuthenticator getAuthenticator() { protected LdapAuthenticator getAuthenticator() {
Assert.notNull(authenticator, "You must set the authenticator before using this instance.");
return authenticator; return authenticator;
} }
@ -157,7 +158,8 @@ public class LdapAuthenticationProvider extends AbstractUserDetailsAuthenticatio
this.authoritiesPopulator = authoritiesPopulator; this.authoritiesPopulator = authoritiesPopulator;
} }
public LdapAuthoritiesPopulator getAuthoritiesPopulator() { protected LdapAuthoritiesPopulator getAuthoritiesPopulator() {
Assert.notNull(authoritiesPopulator, "You must set the authoritiesPopulator before using this instance.");
return authoritiesPopulator; return authoritiesPopulator;
} }

View File

@ -111,6 +111,7 @@ public abstract class AbstractLdapAuthenticator implements LdapAuthenticator, In
} }
public InitialDirContextFactory getInitialDirContextFactory() { public InitialDirContextFactory getInitialDirContextFactory() {
Assert.notNull(initialDirContextFactory, "You must set the initialDirContextFactory before using this instance.");
return initialDirContextFactory; return initialDirContextFactory;
} }

View File

@ -248,6 +248,7 @@ public class DefaultLdapAuthoritiesPopulator implements LdapAuthoritiesPopulator
} }
protected InitialDirContextFactory getInitialDirContextFactory() { protected InitialDirContextFactory getInitialDirContextFactory() {
Assert.notNull(initialDirContextFactory, "You must set the initialDirContextFactory before using this instance.");
return initialDirContextFactory; return initialDirContextFactory;
} }
@ -280,6 +281,7 @@ public class DefaultLdapAuthoritiesPopulator implements LdapAuthoritiesPopulator
} }
protected String getGroupSearchBase() { protected String getGroupSearchBase() {
Assert.notNull(groupSearchBase, "You must set the groupSearchBase before using this instance.");
return groupSearchBase; return groupSearchBase;
} }